summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authorloos <loos@FreeBSD.org>2015-02-14 18:45:43 +0000
committerloos <loos@FreeBSD.org>2015-02-14 18:45:43 +0000
commite5545eed6d43a1f4df1bafe80823d023719c0938 (patch)
tree0ab80b566e668c55e25ce5d4fa1e89724d4c53ad /sys/arm
parent2c27c214706a894d470170c16be31383cb43024a (diff)
downloadFreeBSD-src-e5545eed6d43a1f4df1bafe80823d023719c0938.zip
FreeBSD-src-e5545eed6d43a1f4df1bafe80823d023719c0938.tar.gz
MFC r276298, r276303:
Remove the '#undef DEBUG' that should not be committed. Removes unused and duplicate headers. Bring the wait limit on mailbox write to a more sane value. Fix a off-by-one bug on wait time limit. Remove extra blank line.
Diffstat (limited to 'sys/arm')
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_mbox.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_mbox.c b/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
index 224a0d5..3372b61 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
@@ -31,25 +31,16 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
-#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/sema.h>
-#include <sys/timeet.h>
-#include <sys/timetc.h>
-#include <sys/watchdog.h>
#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-#include <dev/fdt/fdt_common.h>
-#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
-#include <machine/bus.h>
-#include <machine/fdt.h>
-
#include <arm/broadcom/bcm2835/bcm2835_mbox.h>
#include "mbox_if.h"
@@ -76,7 +67,6 @@ __FBSDID("$FreeBSD$");
mtx_unlock(&(sc)->lock); \
} while(0)
-#undef DEBUG
#ifdef DEBUG
#define dprintf(fmt, args...) printf(fmt, ##args)
#else
@@ -189,25 +179,21 @@ bcm_mbox_attach(device_t dev)
static int
bcm_mbox_write(device_t dev, int chan, uint32_t data)
{
- int limit = 20000;
+ int limit = 1000;
struct bcm_mbox_softc *sc = device_get_softc(dev);
dprintf("bcm_mbox_write: chan %d, data %08x\n", chan, data);
MBOX_LOCK(sc);
-
- while ((mbox_read_4(sc, REG_STATUS) & STATUS_FULL) && limit--) {
- DELAY(2);
- }
-
+ while ((mbox_read_4(sc, REG_STATUS) & STATUS_FULL) && --limit)
+ DELAY(5);
if (limit == 0) {
printf("bcm_mbox_write: STATUS_FULL stuck");
MBOX_UNLOCK(sc);
return (EAGAIN);
}
-
mbox_write_4(sc, REG_WRITE, MBOX_MSG(chan, data));
-
MBOX_UNLOCK(sc);
+
return (0);
}
@@ -255,4 +241,3 @@ static driver_t bcm_mbox_driver = {
static devclass_t bcm_mbox_devclass;
DRIVER_MODULE(mbox, simplebus, bcm_mbox_driver, bcm_mbox_devclass, 0, 0);
-
OpenPOWER on IntegriCloud