summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/usb-drv-as3525v2.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/usb-drv-as3525v2.h')
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525v2.h43
1 files changed, 42 insertions, 1 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.h b/firmware/target/arm/as3525/usb-drv-as3525v2.h
index ce132ad7b5..63e8460a5d 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525v2.h
+++ b/firmware/target/arm/as3525/usb-drv-as3525v2.h
@@ -96,6 +96,7 @@
96#define USB_GUSBCFG_SRP_cap 0x100 96#define USB_GUSBCFG_SRP_cap 0x100
97#define USB_GUSBCFG_HNP_cap 0x200 97#define USB_GUSBCFG_HNP_cap 0x200
98 98
99#define USB_GAHBCFG_glblintrmsk (1 << 0)
99#define USB_GAHBCFG_hburstlen_bit_pos 1 100#define USB_GAHBCFG_hburstlen_bit_pos 1
100#define USB_GAHBCFG_INT_DMA_BURST_INCR 1 /** note: the linux patch has several other value, this is one picked for internal dma */ 101#define USB_GAHBCFG_INT_DMA_BURST_INCR 1 /** note: the linux patch has several other value, this is one picked for internal dma */
101#define USB_GAHBCFG_dma_enable (1 << 5) 102#define USB_GAHBCFG_dma_enable (1 << 5)
@@ -147,6 +148,14 @@
147#define USB_DTKNQR1 (*(volatile unsigned long *)(USB_DEVICE + 0x20)) /** Device IN Token Sequence Learning Queue Read Register 1 */ 148#define USB_DTKNQR1 (*(volatile unsigned long *)(USB_DEVICE + 0x20)) /** Device IN Token Sequence Learning Queue Read Register 1 */
148#define USB_DTKNQR2 (*(volatile unsigned long *)(USB_DEVICE + 0x24)) /** Device IN Token Sequence Learning Queue Register 2 */ 149#define USB_DTKNQR2 (*(volatile unsigned long *)(USB_DEVICE + 0x24)) /** Device IN Token Sequence Learning Queue Register 2 */
149#define USB_DTKNQP (*(volatile unsigned long *)(USB_DEVICE + 0x28)) /** Device IN Token Queue Pop register */ 150#define USB_DTKNQP (*(volatile unsigned long *)(USB_DEVICE + 0x28)) /** Device IN Token Queue Pop register */
151/* fixme: those registers are not present in usb_registers.h but are in dwc_otgh_regs.h.
152 * the previous registers exists but has a different name :( */
153#define USB_DVBUSDIS (*(volatile unsigned long *)(USB_DEVICE + 0x28)) /** Device VBUS discharge register*/
154#define USB_DVBUSPULSE (*(volatile unsigned long *)(USB_DEVICE + 0x2C)) /** Device VBUS pulse register */
155#define USB_DTKNQR3 (*(volatile unsigned long *)(USB_DEVICE + 0x30)) /** Device IN Token Queue Read Register 3 (RO) */
156#define USB_DTHRCTL (*(volatile unsigned long *)(USB_DEVICE + 0x30)) /** Device Thresholding control register */
157#define USB_DTKNQR4 (*(volatile unsigned long *)(USB_DEVICE + 0x34)) /** Device IN Token Queue Read Register 4 (RO) */
158#define USB_FFEMPTYMSK (*(volatile unsigned long *)(USB_DEVICE + 0x34)) /** Device IN EPs empty Inr. Mask Register */
150 159
151#define USB_DCFG_devspd_bits 0x3 160#define USB_DCFG_devspd_bits 0x3
152#define USB_DCFG_devspd_hs_phy_hs 0 /** High speed PHY running at high speed */ 161#define USB_DCFG_devspd_hs_phy_hs 0 /** High speed PHY running at high speed */
@@ -158,6 +167,14 @@
158#define USB_DCFG_FRAME_INTERVAL_90 2 167#define USB_DCFG_FRAME_INTERVAL_90 2
159#define USB_DCFG_FRAME_INTERVAL_95 3 168#define USB_DCFG_FRAME_INTERVAL_95 3
160 169
170#define USB_DTHRCTL_non_iso_thr_en (1 << 0)
171#define USB_DTHRCTL_iso_thr_en (1 << 1)
172#define USB_DTHRCTL_tx_thr_len_bit_pos 2
173#define USB_DTHRCTL_tx_thr_len_bits (0x1FF << USB_DTHRCTL_tx_thr_len_bit_pos)
174#define USB_DTHRCTL_rx_thr_en (1 << 16)
175#define USB_DTHRCTL_rx_thr_len_bit_pos 17
176#define USB_DTHRCTL_rx_thr_len_bits (0x1FF << USB_DTHRCTL_rx_thr_len_bit_pos)
177
161/* 0<=ep<=15, you can use ep=0 */ 178/* 0<=ep<=15, you can use ep=0 */
162/** Device IN Endpoint (ep) Control Register */ 179/** Device IN Endpoint (ep) Control Register */
163#define USB_DIEPCTL(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20)) 180#define USB_DIEPCTL(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20))
@@ -170,6 +187,17 @@
170/** Device IN Endpoint (ep) Transmit FIFO Status Register */ 187/** Device IN Endpoint (ep) Transmit FIFO Status Register */
171#define USB_DTXFSTS(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20 + 0x18)) 188#define USB_DTXFSTS(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20 + 0x18))
172 189
190/* the following also apply to DIEPMSK */
191#define USB_DIEPINT_xfercompl (1 << 0) /** Transfer complete */
192#define USB_DIEPINT_epdisabled (1 << 1) /** Endpoint disabled */
193#define USB_DIEPINT_ahberr (1 << 2) /** AHB error */
194#define USB_DIEPINT_timeout (1 << 3) /** Tiemout handshake (non-iso TX) */
195#define USB_DIEPINT_intktxfemp (1 << 4) /** IN token received with tx fifo empty */
196#define USB_DIEPINT_intknepmis (1 << 5) /** IN token received with ep mismatch */
197#define USB_DIEPINT_inepnakeff (1 << 6) /** IN endpoint NAK effective */
198#define USB_DIEPINT_emptyintr (1 << 7) /** linux doc broken on this, empty fifo ? */
199#define USB_DIEPINT_txfifoundrn (1 << 8) /** linux doc void on this, tx fifo underrun ? */
200
173/** Device OUT Endpoint (ep) Control Register */ 201/** Device OUT Endpoint (ep) Control Register */
174#define USB_DOEPCTL(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x300 + (ep) * 0x20)) 202#define USB_DOEPCTL(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x300 + (ep) * 0x20))
175/** Device OUT Endpoint (ep) Frame number Register */ 203/** Device OUT Endpoint (ep) Frame number Register */
@@ -191,6 +219,19 @@
191/** 219/**
192 * Parameters 220 * Parameters
193 */ 221 */
194 222#ifdef USB_USE_CUSTOM_FIFO_LAYOUT
223/* Data fifo: includes RX fifo, non period TX fifo and periodic fifos
224 * NOTE: this is a hardware parameter, it cannot be changed ! */
225#define USB_DATA_FIFO_DEPTH 1333u
226/* size of the FX fifo */
227#define USB_RX_FIFO_SIZE 256u
228/* size of the non periodic TX fifo */
229#define USB_NPTX_FIFO_SIZE 256u
230/* size of each TX ep fifo size */
231#define USB_EPTX_FIFO_SIZE 256u
232#endif /* USB_USE_CUSTOM_FIFO_LAYOUT */
233/* Number of IN/OUT endpoints */
234#define USB_NUM_IN_EP 3u
235#define USB_NUM_OUT_EP 2u
195 236
196#endif /* __USB_DRV_AS3525v2_H__ */ 237#endif /* __USB_DRV_AS3525v2_H__ */