summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-09-14 20:36:24 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-09-17 11:26:04 -0400
commitec413f7692de3e33254d79a84c46bd036fd27d0a (patch)
treed5853dd677c5d39233a067a9d7f1dc2d3290a8ae /firmware/export
parenta66b9088014fd77d08c34fc07a4e701051e1525a (diff)
downloadrockbox-ec413f7692de3e33254d79a84c46bd036fd27d0a.tar.gz
rockbox-ec413f7692de3e33254d79a84c46bd036fd27d0a.zip
jz4760: Heavily rework USB driver to add working DMA support
* DMA Bulk IN (ie our TX) results in sequential transfers 33-68% faster. * DMA Bulk OUT (ie RX) is mostly stripped out due to complete brokenness. * Interrupt and control endpoints remain PIO-driven. Other improvements: 1) Use consistent endpoint references (no magic numbers) 2) Greatly enhanced logging 3) DMA support can be compiled out completely 4) Setting lockswitch will disable all DMA operations at runtime 5) Much more robust error checking and recovery Change-Id: I57b82e655e55ced0dfe289e379b0b61d8fe443b4
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/jz4760b.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/firmware/export/jz4760b.h b/firmware/export/jz4760b.h
index e61689105c..589f67800a 100644
--- a/firmware/export/jz4760b.h
+++ b/firmware/export/jz4760b.h
@@ -6992,8 +6992,12 @@ do { \
6992#define USB_OUTCSRH (USB_BASE + 0x17) /* EP1-15 OUT CSR MSB 8-bit */ 6992#define USB_OUTCSRH (USB_BASE + 0x17) /* EP1-15 OUT CSR MSB 8-bit */
6993#define USB_OUTCOUNT (USB_BASE + 0x18) /* EP1-15 OUT FIFO count 16-bit */ 6993#define USB_OUTCOUNT (USB_BASE + 0x18) /* EP1-15 OUT FIFO count 16-bit */
6994 6994
6995#define USB_CONFIGDATA (USB_BASE + 0x1f) /* Fixed config */
6996
6995#define USB_FIFO_EP(n) (USB_BASE + (n)*4 + 0x20) 6997#define USB_FIFO_EP(n) (USB_BASE + (n)*4 + 0x20)
6996 6998
6999#define USB_HWVERS (USB_BASE + 0x6c)
7000
6997#define USB_EPINFO (USB_BASE + 0x78) /* Endpoint information */ 7001#define USB_EPINFO (USB_BASE + 0x78) /* Endpoint information */
6998#define USB_RAMINFO (USB_BASE + 0x79) /* RAM information */ 7002#define USB_RAMINFO (USB_BASE + 0x79) /* RAM information */
6999 7003
@@ -7034,6 +7038,7 @@ do { \
7034#define USB_INCSRH_DMAREQENAB 0x10 7038#define USB_INCSRH_DMAREQENAB 0x10
7035#define USB_INCSRH_FRCDATATOG 0x08 7039#define USB_INCSRH_FRCDATATOG 0x08
7036#define USB_INCSRH_DMAREQMODE 0x04 7040#define USB_INCSRH_DMAREQMODE 0x04
7041#define USB_INCSR_INCOMPTX 0x80
7037#define USB_INCSR_CDT 0x40 7042#define USB_INCSR_CDT 0x40
7038#define USB_INCSR_SENTSTALL 0x20 7043#define USB_INCSR_SENTSTALL 0x20
7039#define USB_INCSR_SENDSTALL 0x10 7044#define USB_INCSR_SENDSTALL 0x10
@@ -7077,6 +7082,10 @@ do { \
7077#define USB_CNTL_BURST_8 (2 << 9) 7082#define USB_CNTL_BURST_8 (2 << 9)
7078#define USB_CNTL_BURST_16 (3 << 9) 7083#define USB_CNTL_BURST_16 (3 << 9)
7079 7084
7085/* USB HW revision */
7086#define USB_HWVERS_MAJOR(x) ((x >> 10) & 0x1f)
7087#define USB_HWVERS_MINOR(x) (x & 0x3ff)
7088
7080/* DMA interrupt bits */ 7089/* DMA interrupt bits */
7081#define USB_INTR_DMA_BULKIN 1 7090#define USB_INTR_DMA_BULKIN 1
7082#define USB_INTR_DMA_BULKOUT 2 7091#define USB_INTR_DMA_BULKOUT 2
@@ -7104,6 +7113,7 @@ do { \
7104#define REG_USB_OUTCSRH REG8(USB_OUTCSRH) 7113#define REG_USB_OUTCSRH REG8(USB_OUTCSRH)
7105#define REG_USB_OUTCOUNT REG16(USB_OUTCOUNT) 7114#define REG_USB_OUTCOUNT REG16(USB_OUTCOUNT)
7106 7115
7116#define REG_USB_CONFIGDATA REG8(USB_CONFIGDATA)
7107#define REG_USB_FIFO_EP(n) REG32(USB_FIFO_EP(n)) 7117#define REG_USB_FIFO_EP(n) REG32(USB_FIFO_EP(n))
7108 7118
7109#define REG_USB_INTR REG8(USB_INTR) 7119#define REG_USB_INTR REG8(USB_INTR)
@@ -7111,6 +7121,8 @@ do { \
7111#define REG_USB_ADDR(n) REG32(USB_ADDR(n)) 7121#define REG_USB_ADDR(n) REG32(USB_ADDR(n))
7112#define REG_USB_COUNT(n) REG32(USB_COUNT(n)) 7122#define REG_USB_COUNT(n) REG32(USB_COUNT(n))
7113 7123
7124#define REG_USB_HWVERS REG16(USB_HWVERS)
7125
7114#define REG_USB_EPINFO REG8(USB_EPINFO) 7126#define REG_USB_EPINFO REG8(USB_EPINFO)
7115#define REG_USB_RAMINFO REG8(USB_RAMINFO) 7127#define REG_USB_RAMINFO REG8(USB_RAMINFO)
7116 7128