summaryrefslogtreecommitdiff
path: root/sys/src/9/omap
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-02-14 03:00:31 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2015-02-14 03:00:31 +0100
commit995379e388e4cd202f683a00e99749c7f21a225d (patch)
tree046f2efc671554b5b6c5bfa9b8a38a95340a247f /sys/src/9/omap
parent6b2d1f0186f2e38a3b0cd6a19b5980dccb045c3c (diff)
usbehci: initial support for usb on zynq, remove uncached.h
the following hooks have been added to the ehci Ctlr structore to handle cache coherency (on arm): void* (*tdalloc)(ulong,int,ulong); void* (*dmaalloc)(ulong); void (*dmafree)(void*); void (*dmaflush)(int,void*,ulong); tdalloc() is used to allocate descriptors and the periodic frame schedule array. on arm, this needs to return uncached memory. tdalloc()ed memory is never freed. dmaalloc()/dmafree() is used for io buffers. this can return cached memory when when hardware maintains cache coherency (pc) or dmaflush() is provided to flush/invalidate the cache (zynq), otherwise needs to return uncached memory. dmaflush() is used to flush/invalidate the cache. the first argument tells us if we need to flush (non zero) or invalidate (zero). uncached.h is gone now. this change makes the handling explicit.
Diffstat (limited to 'sys/src/9/omap')
-rw-r--r--sys/src/9/omap/mkfile2
-rw-r--r--sys/src/9/omap/uncached.h36
-rw-r--r--sys/src/9/omap/usbehci.h5
-rw-r--r--sys/src/9/omap/usbehciomap.c4
4 files changed, 10 insertions, 37 deletions
diff --git a/sys/src/9/omap/mkfile b/sys/src/9/omap/mkfile
index 321d2971f..1b6fdef81 100644
--- a/sys/src/9/omap/mkfile
+++ b/sys/src/9/omap/mkfile
@@ -111,7 +111,7 @@ l.$O rebootcode.$O: cache.v7.s
main.$O: errstr.h init.h reboot.h
devdss.$O devmouse.$O mouse.$O screen.$O: screen.h
devusb.$O: ../port/usb.h
-usbehci.$O usbohci.$O usbuhci.$O: ../port/usb.h usbehci.h uncached.h
+usbehci.$O usbohci.$O usbuhci.$O: ../port/usb.h usbehci.h
init.h:D: ../port/initcode.c init9.s
$CC ../port/initcode.c
diff --git a/sys/src/9/omap/uncached.h b/sys/src/9/omap/uncached.h
deleted file mode 100644
index 9fffd31fc..000000000
--- a/sys/src/9/omap/uncached.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * running the l2 cache as write-back and using cached memory for
- * usb data structures yields spurious errors such as
- *
- * qhintr: td 0x60ee3d80 csw 0x8824a error 0x48 transaction error
- *
- * from usbehci. so, at least for now, we will use uncached memory until
- * we sort out the write-back problems.
- */
-#define free ucfree
-#define malloc myucalloc
-#define mallocz ucallocz
-#define smalloc myucalloc
-#define xspanalloc ucallocalign
-
-#define allocb ucallocb
-#define iallocb uciallocb
-#define freeb ucfreeb
-
-static void *
-ucallocz(uint n, int)
-{
- char *p = ucalloc(n);
-
- if (p)
- memset(p, 0, n);
- else
- panic("ucalloc: out of memory");
- return p;
-}
-
-static void *
-myucalloc(uint n)
-{
- return ucallocz(n, 1);
-}
diff --git a/sys/src/9/omap/usbehci.h b/sys/src/9/omap/usbehci.h
index b43d4774b..45e88169b 100644
--- a/sys/src/9/omap/usbehci.h
+++ b/sys/src/9/omap/usbehci.h
@@ -39,6 +39,11 @@ struct Ctlr
Ecapio* capio; /* Capability i/o regs */
Eopio* opio; /* Operational i/o regs */
+ void* (*tdalloc)(ulong,int,ulong);
+ void* (*dmaalloc)(ulong);
+ void (*dmafree)(void*);
+ void (*dmaflush)(int,void*,ulong len);
+
int nframes; /* 1024, 512, or 256 frames in the list */
ulong* frames; /* periodic frame list (hw) */
Qh* qhs; /* async Qh circular list for bulk/ctl */
diff --git a/sys/src/9/omap/usbehciomap.c b/sys/src/9/omap/usbehciomap.c
index 089dd525b..0634db69c 100644
--- a/sys/src/9/omap/usbehciomap.c
+++ b/sys/src/9/omap/usbehciomap.c
@@ -178,6 +178,10 @@ reset(Hci *hp)
capio->parms & 0x40 ? "explicit" : "automatic",
capio->parms & 0x10 ? "" : "no ", hp->nports);
+ ctlr->tdalloc = ucallocalign;
+ ctlr->dmaalloc = ucalloc;
+ cltr->dmafree = ucfree;
+
ehcireset(ctlr);
ehcimeminit(ctlr);