summaryrefslogtreecommitdiff
path: root/firmware/export/usb-s3c6400x.h
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2011-12-13 04:21:06 +0000
committerRafaël Carré <rafael.carre@gmail.com>2011-12-13 04:21:06 +0000
commitbc943a06ba06e7f23837a122ef760c6f660c26d3 (patch)
tree9220d218e292d19460134f616b647745f0907670 /firmware/export/usb-s3c6400x.h
parent62e0cdca26433d639e04fe0e172380cd599f8f5f (diff)
downloadrockbox-bc943a06ba06e7f23837a122ef760c6f660c26d3.tar.gz
rockbox-bc943a06ba06e7f23837a122ef760c6f660c26d3.zip
Move usb-s3c6400 register comments to usb-s3c6400.h
Use common defines in usb-s3c6400.c and usb-drv-as3525v2.c No functional changes git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31220 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export/usb-s3c6400x.h')
-rw-r--r--firmware/export/usb-s3c6400x.h453
1 files changed, 303 insertions, 150 deletions
diff --git a/firmware/export/usb-s3c6400x.h b/firmware/export/usb-s3c6400x.h
index eeac9d038e..e8fb4b10a4 100644
--- a/firmware/export/usb-s3c6400x.h
+++ b/firmware/export/usb-s3c6400x.h
@@ -22,6 +22,22 @@
22#define USB_S3C6400X_H 22#define USB_S3C6400X_H
23 23
24 24
25/* All multi-bit fields in the driver use the following convention.
26 * If the register name is NAME, then there is one define NAME_bitp
27 * which holds the bit position and one define NAME_bits which holds
28 * a mask of the bits within the register (after shift).
29 * These macros allow easy access and construction of such fields */
30/* Usage:
31 * - extract(reg_name,field_name)
32 * extract a field of the register
33 * - bitm(reg_name,field_name)
34 * build a bitmask for the field
35 */
36#define extract(reg_name, field_name) \
37 ((reg_name >> reg_name##_##field_name##_bitp) & reg_name##_##field_name##_bits)
38
39#define bitm(reg_name, field_name) \
40 (reg_name##_##field_name##_bits << reg_name##_##field_name##_bitp)
25 41
26 42
27/*** OTG PHY CONTROL REGISTERS ***/ 43/*** OTG PHY CONTROL REGISTERS ***/
@@ -34,35 +50,117 @@
34 50
35/*** OTG LINK CORE REGISTERS ***/ 51/*** OTG LINK CORE REGISTERS ***/
36/* Core Global Registers */ 52/* Core Global Registers */
53
54/** OTG Control and Status Register */
37#define GOTGCTL (*((uint32_t volatile*)(OTGBASE + 0x000))) 55#define GOTGCTL (*((uint32_t volatile*)(OTGBASE + 0x000)))
56
57/** OTG Interrupt Register */
38#define GOTGINT (*((uint32_t volatile*)(OTGBASE + 0x004))) 58#define GOTGINT (*((uint32_t volatile*)(OTGBASE + 0x004)))
59
60/** Core AHB Configuration Register */
39#define GAHBCFG (*((uint32_t volatile*)(OTGBASE + 0x008))) 61#define GAHBCFG (*((uint32_t volatile*)(OTGBASE + 0x008)))
62#define GAHBCFG_glblintrmsk (1 << 0) /** Global interrupt mask */
63#define GAHBCFG_hburstlen_bitp 1
64#define GAHBCFG_hburstlen_bits 0xf
65#define GAHBCFG_INT_DMA_BURST_SINGLE 0
66#define GAHBCFG_INT_DMA_BURST_INCR 1 /** note: the linux patch has several other value, this is one picked for internal dma */
67#define GAHBCFG_INT_DMA_BURST_INCR4 3
68#define GAHBCFG_INT_DMA_BURST_INCR8 5
69#define GAHBCFG_INT_DMA_BURST_INCR16 7
70#define GAHBCFG_dma_enable (1 << 5) /** Enable DMA */
71
72/** Core USB Configuration Register */
40#define GUSBCFG (*((uint32_t volatile*)(OTGBASE + 0x00C))) 73#define GUSBCFG (*((uint32_t volatile*)(OTGBASE + 0x00C)))
74#define GUSBCFG_toutcal_bitp 0
75#define GUSBCFG_toutcal_bits 0x7
76#define GUSBCFG_phy_if (1 << 3) /** select utmi bus width ? */
77#define GUSBCFG_ulpi_utmi_sel (1 << 4) /** select ulpi:1 or utmi:0 */
78#define GUSBCFG_fsintf (1 << 5)
79#define GUSBCFG_physel (1 << 6)
80#define GUSBCFG_ddrsel (1 << 7)
81#define GUSBCFG_srpcap (1 << 8)
82#define GUSBCFG_hnpcapp (1 << 9)
83#define GUSBCFG_usbtrdtim_bitp 10
84#define GUSBCFG_usbtrdtim_bits 0xf
85#define GUSBCFG_nptxfrwnden (1 << 14)
86#define GUSBCFG_phylpwrclksel (1 << 15)
87#define GUSBCFG_otgutmifssel (1 << 16)
88#define GUSBCFG_ulpi_fsls (1 << 17)
89#define GUSBCFG_ulpi_auto_res (1 << 18)
90#define GUSBCFG_ulpi_clk_sus_m (1 << 19)
91#define GUSBCFG_ulpi_ext_vbus_drv (1 << 20)
92#define GUSBCFG_ulpi_int_vbus_indicator (1 << 21)
93#define GUSBCFG_term_sel_dl_pulse (1 << 22)
94#define GUSBCFG_force_host_mode (1 << 29)
95#define GUSBCFG_force_device_mode (1 << 30)
96#define GUSBCFG_corrupt_tx_packet (1 << 31)
97
98
99/** Core Reset Register */
41#define GRSTCTL (*((uint32_t volatile*)(OTGBASE + 0x010))) 100#define GRSTCTL (*((uint32_t volatile*)(OTGBASE + 0x010)))
101#define GRSTCTL_csftrst (1 << 0) /** Core soft reset */
102#define GRSTCTL_hsftrst (1 << 1) /** Hclk soft reset */
103#define GRSTCTL_intknqflsh (1 << 3) /** In Token Sequence Learning Queue Flush */
104#define GRSTCTL_rxfflsh_flush (1 << 4) /** RxFIFO Flush */
105#define GRSTCTL_txfflsh_flush (1 << 5) /** TxFIFO Flush */
106#define GRSTCTL_txfnum_bitp 6 /** TxFIFO Number */
107#define GRSTCTL_txfnum_bits 0x1f
108#define GRSTCTL_ahbidle (1 << 31) /** AHB idle state*/
109
110/** Core Interrupt Register */
42#define GINTSTS (*((uint32_t volatile*)(OTGBASE + 0x014))) 111#define GINTSTS (*((uint32_t volatile*)(OTGBASE + 0x014)))
112/* NOTE: GINTSTS bits are the same as in GINTMSK plus this one */
113#define GINTSTS_curmode (1 << 0) /** Current mode, 0 for device */
114
115/** Core Interrupt Mask Register */
43#define GINTMSK (*((uint32_t volatile*)(OTGBASE + 0x018))) 116#define GINTMSK (*((uint32_t volatile*)(OTGBASE + 0x018)))
117#define GINTMSK_modemismatch (1 << 1) /** mode mismatch ? */
118#define GINTMSK_otgintr (1 << 2)
119#define GINTMSK_sofintr (1 << 3)
120#define GINTMSK_rxstsqlvl (1 << 4)
121#define GINTMSK_nptxfempty (1 << 5) /** Non-periodic TX fifo empty ? */
122#define GINTMSK_ginnakeff (1 << 6)
123#define GINTMSK_goutnakeff (1 << 7)
124#define GINTMSK_i2cintr (1 << 9)
125#define GINTMSK_erlysuspend (1 << 10)
126#define GINTMSK_usbsuspend (1 << 11) /** USB suspend */
127#define GINTMSK_usbreset (1 << 12) /** USB reset */
128#define GINTMSK_enumdone (1 << 13) /** Enumeration done */
129#define GINTMSK_isooutdrop (1 << 14)
130#define GINTMSK_eopframe (1 << 15)
131#define GINTMSK_epmismatch (1 << 17) /** endpoint mismatch ? */
132#define GINTMSK_inepintr (1 << 18) /** in pending ? */
133#define GINTMSK_outepintr (1 << 19) /** out pending ? */
134#define GINTMSK_incomplisoin (1 << 20) /** ISP in complete ? */
135#define GINTMSK_incomplisoout (1 << 21) /** ISO out complete ? */
136#define GINTMSK_portintr (1 << 24) /** Port status change ? */
137#define GINTMSK_hcintr (1 << 25)
138#define GINTMSK_ptxfempty (1 << 26) /** Periodic TX fifof empty ? */
139#define GINTMSK_conidstschng (1 << 28)
140#define GINTMSK_disconnect (1 << 29) /** Disconnect */
141#define GINTMSK_sessreqintr (1 << 30) /** Session request */
142#define GINTMSK_wkupintr (1 << 31) /** Wake up */
143
144/** Receive Status Debug Read Register (Read Only) */
44#define GRXSTSR (*((uint32_t volatile*)(OTGBASE + 0x01C))) 145#define GRXSTSR (*((uint32_t volatile*)(OTGBASE + 0x01C)))
146
147/** Receive Status Read /Pop Register (Read Only) */
45#define GRXSTSP (*((uint32_t volatile*)(OTGBASE + 0x020))) 148#define GRXSTSP (*((uint32_t volatile*)(OTGBASE + 0x020)))
149
150/** Receive FIFO Size Register */
46#define GRXFSIZ (*((uint32_t volatile*)(OTGBASE + 0x024))) 151#define GRXFSIZ (*((uint32_t volatile*)(OTGBASE + 0x024)))
152
153/** Periodic Transmit FIFO Size Register */
47#define GNPTXFSIZ (*((uint32_t volatile*)(OTGBASE + 0x028))) 154#define GNPTXFSIZ (*((uint32_t volatile*)(OTGBASE + 0x028)))
155#define MAKE_FIFOSIZE_DATA(depth) ((depth) | ((depth) << 16))
156
157/** Non-Periodic Transmit FIFO/Queue Status Register */
48#define GNPTXSTS (*((uint32_t volatile*)(OTGBASE + 0x02C))) 158#define GNPTXSTS (*((uint32_t volatile*)(OTGBASE + 0x02C)))
159
160/** Device IN Endpoint Transmit FIFO (ep) Size Register */
161/* 1<=ep<=15, don't use ep=0 !!! */
49#define HPTXFSIZ (*((uint32_t volatile*)(OTGBASE + 0x100))) 162#define HPTXFSIZ (*((uint32_t volatile*)(OTGBASE + 0x100)))
50#define DPTXFSIZ(x) (*((uint32_t volatile*)(OTGBASE + 0x100 + 4 * (x)))) 163#define DPTXFSIZ(x) (*((uint32_t volatile*)(OTGBASE + 0x100 + 4 * (x))))
51#define DPTXFSIZ1 (*((uint32_t volatile*)(OTGBASE + 0x104)))
52#define DPTXFSIZ2 (*((uint32_t volatile*)(OTGBASE + 0x108)))
53#define DPTXFSIZ3 (*((uint32_t volatile*)(OTGBASE + 0x10C)))
54#define DPTXFSIZ4 (*((uint32_t volatile*)(OTGBASE + 0x110)))
55#define DPTXFSIZ5 (*((uint32_t volatile*)(OTGBASE + 0x114)))
56#define DPTXFSIZ6 (*((uint32_t volatile*)(OTGBASE + 0x118)))
57#define DPTXFSIZ7 (*((uint32_t volatile*)(OTGBASE + 0x11C)))
58#define DPTXFSIZ8 (*((uint32_t volatile*)(OTGBASE + 0x120)))
59#define DPTXFSIZ9 (*((uint32_t volatile*)(OTGBASE + 0x124)))
60#define DPTXFSIZ10 (*((uint32_t volatile*)(OTGBASE + 0x128)))
61#define DPTXFSIZ11 (*((uint32_t volatile*)(OTGBASE + 0x12C)))
62#define DPTXFSIZ12 (*((uint32_t volatile*)(OTGBASE + 0x130)))
63#define DPTXFSIZ13 (*((uint32_t volatile*)(OTGBASE + 0x134)))
64#define DPTXFSIZ14 (*((uint32_t volatile*)(OTGBASE + 0x138)))
65#define DPTXFSIZ15 (*((uint32_t volatile*)(OTGBASE + 0x13C)))
66 164
67/*** HOST MODE REGISTERS ***/ 165/*** HOST MODE REGISTERS ***/
68/* Host Global Registers */ 166/* Host Global Registers */
@@ -182,162 +280,217 @@
182 280
183/*** DEVICE MODE REGISTERS ***/ 281/*** DEVICE MODE REGISTERS ***/
184/* Device Global Registers */ 282/* Device Global Registers */
283
284/** Device Configuration Register */
185#define DCFG (*((uint32_t volatile*)(OTGBASE + 0x800))) 285#define DCFG (*((uint32_t volatile*)(OTGBASE + 0x800)))
286#define DCFG_devspd_bitp 0 /** Device Speed */
287#define DCFG_devspd_bits 0x3
288#define DCFG_devspd_hs_phy_hs 0 /** High speed PHY running at high speed */
289#define DCFG_devspd_hs_phy_fs 1 /** High speed PHY running at full speed */
290#define DCFG_nzstsouthshk (1 << 2) /** Non Zero Length Status OUT Handshake */
291#define DCFG_devadr_bitp 4 /** Device Address */
292#define DCFG_devadr_bits 0x7f
293#define DCFG_perfrint_bitp 11 /** Periodic Frame Interval */
294#define DCFG_perfrint_bits 0x3
295#define DCFG_FRAME_INTERVAL_80 0
296#define DCFG_FRAME_INTERVAL_85 1
297#define DCFG_FRAME_INTERVAL_90 2
298#define DCFG_FRAME_INTERVAL_95 3
299
300/** Device Control Register */
186#define DCTL (*((uint32_t volatile*)(OTGBASE + 0x804))) 301#define DCTL (*((uint32_t volatile*)(OTGBASE + 0x804)))
302#define DCTL_rmtwkupsig (1 << 0) /** Remote Wakeup */
303#define DCTL_sftdiscon (1 << 1) /** Soft Disconnect */
304#define DCTL_gnpinnaksts (1 << 2) /** Global Non-Periodic IN NAK Status */
305#define DCTL_goutnaksts (1 << 3) /** Global OUT NAK Status */
306#define DCTL_tstctl_bitp 4 /** Test Control */
307#define DCTL_tstctl_bits 0x7
308#define DCTL_sgnpinnak (1 << 7) /** Set Global Non-Periodic IN NAK */
309#define DCTL_cgnpinnak (1 << 8) /** Clear Global Non-Periodic IN NAK */
310#define DCTL_sgoutnak (1 << 9) /** Set Global OUT NAK */
311#define DCTL_cgoutnak (1 << 10) /** Clear Global OUT NAK */
312#define DCTL_pwronprgdone (1 << 11) /** Power on Program Done ? */
313
314/** Device Status Register */
187#define DSTS (*((uint32_t volatile*)(OTGBASE + 0x808))) 315#define DSTS (*((uint32_t volatile*)(OTGBASE + 0x808)))
316#define DSTS_suspsts (1 << 0) /** Suspend status */
317#define DSTS_enumspd_bitp 1 /** Enumerated speed */
318#define DSTS_enumspd_bits 0x3
319#define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ 0
320#define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ 1
321#define DSTS_ENUMSPD_LS_PHY_6MHZ 2
322#define DSTS_ENUMSPD_FS_PHY_48MHZ 3
323#define DSTS_errticerr (1 << 3) /** Erratic errors ? */
324#define DSTS_soffn_bitp 8 /** Frame or Microframe Number of the received SOF */
325#define DSTS_soffn_bits 0x3fff
326
327/** Device IN Endpoint Common Interrupt Mask Register */
188#define DIEPMSK (*((uint32_t volatile*)(OTGBASE + 0x810))) 328#define DIEPMSK (*((uint32_t volatile*)(OTGBASE + 0x810)))
329/* the following apply to DIEPMSK and DIEPINT */
330#define DIEPINT_xfercompl (1 << 0) /** Transfer complete */
331#define DIEPINT_epdisabled (1 << 1) /** Endpoint disabled */
332#define DIEPINT_ahberr (1 << 2) /** AHB error */
333#define DIEPINT_timeout (1 << 3) /** Timeout handshake (non-iso TX) */
334#define DIEPINT_intktxfemp (1 << 4) /** IN token received with tx fifo empty */
335#define DIEPINT_intknepmis (1 << 5) /** IN token received with ep mismatch */
336#define DIEPINT_inepnakeff (1 << 6) /** IN endpoint NAK effective */
337#define DIEPINT_emptyintr (1 << 7) /** linux doc broken on this, empty fifo ? */
338#define DIEPINT_txfifoundrn (1 << 8) /** linux doc void on this, tx fifo underrun ? */
339
340/** Device OUT Endpoint Common Interrupt Mask Register */
189#define DOEPMSK (*((uint32_t volatile*)(OTGBASE + 0x814))) 341#define DOEPMSK (*((uint32_t volatile*)(OTGBASE + 0x814)))
342/* the following apply to DOEPMSK and DOEPINT */
343#define DOEPINT_xfercompl (1 << 0) /** Transfer complete */
344#define DOEPINT_epdisabled (1 << 1) /** Endpoint disabled */
345#define DOEPINT_ahberr (1 << 2) /** AHB error */
346#define DOEPINT_setup (1 << 3) /** Setup Phase Done (control EPs)*/
347
348/** Device All Endpoints Interrupt Register */
190#define DAINT (*((uint32_t volatile*)(OTGBASE + 0x818))) 349#define DAINT (*((uint32_t volatile*)(OTGBASE + 0x818)))
350/* valid for DAINT and DAINTMSK, for 0<=ep<=15 */
351#define DAINT_IN_EP(i) (1 << (i))
352#define DAINT_OUT_EP(i) (1 << ((i) + 16))
353
354/** Device Endpoints Interrupt Mask Register */
191#define DAINTMSK (*((uint32_t volatile*)(OTGBASE + 0x81C))) 355#define DAINTMSK (*((uint32_t volatile*)(OTGBASE + 0x81C)))
356
357/** Device IN Token Sequence Learning Queue Read Register 1 */
192#define DTKNQR1 (*((uint32_t volatile*)(OTGBASE + 0x820))) 358#define DTKNQR1 (*((uint32_t volatile*)(OTGBASE + 0x820)))
359
360/** Device IN Token Sequence Learning Queue Register 2 */
193#define DTKNQR2 (*((uint32_t volatile*)(OTGBASE + 0x824))) 361#define DTKNQR2 (*((uint32_t volatile*)(OTGBASE + 0x824)))
362
363/* fixme: those registers are not present in registers.h but are in dwc_otgh_regs.h.
364 * the previous registers exists but has a different name :( */
365/** Device VBUS discharge register*/
194#define DVBUSDIS (*((uint32_t volatile*)(OTGBASE + 0x828))) 366#define DVBUSDIS (*((uint32_t volatile*)(OTGBASE + 0x828)))
367
368/** Device VBUS pulse register */
195#define DVBUSPULSE (*((uint32_t volatile*)(OTGBASE + 0x82C))) 369#define DVBUSPULSE (*((uint32_t volatile*)(OTGBASE + 0x82C)))
370
371// FIXME : 2 names for the same reg?
372/** Device IN Token Queue Read Register 3 (RO) */
373/** Device Thresholding control register */
196#define DTKNQR3 (*((uint32_t volatile*)(OTGBASE + 0x830))) 374#define DTKNQR3 (*((uint32_t volatile*)(OTGBASE + 0x830)))
375#define DTHRCTL (*((uint32_t volatile*)(OTGBASE + 0x830)))
376#define DTHRCTL_non_iso_thr_en (1 << 0)
377#define DTHRCTL_iso_thr_en (1 << 1)
378#define DTHRCTL_tx_thr_len_bitp 2
379#define DTHRCTL_tx_thr_len_bits 0x1FF
380#define DTHRCTL_rx_thr_en (1 << 16)
381#define DTHRCTL_rx_thr_len_bitp 17
382#define DTHRCTL_rx_thr_len_bits 0x1FF
383
384/** Device IN Token Queue Read Register 4 (RO) */
197#define DTKNQR4 (*((uint32_t volatile*)(OTGBASE + 0x834))) 385#define DTKNQR4 (*((uint32_t volatile*)(OTGBASE + 0x834)))
198 386
199/* Device Logical IN Endpoint-Specific Registers */ 387/* Device Logical IN Endpoint-Specific Registers */
200#define DIEPCTL(x) (*((uint32_t volatile*)(OTGBASE + 0x900 + 0x20 * (x)))) 388#define DIEPCTL(x) (*((uint32_t volatile*)(OTGBASE + 0x900 + 0x20 * (x))))
201#define DIEPINT(x) (*((uint32_t volatile*)(OTGBASE + 0x908 + 0x20 * (x))))
202#define DIEPTSIZ(x) (*((uint32_t volatile*)(OTGBASE + 0x910 + 0x20 * (x))))
203#define DIEPDMA(x) (*((const void* volatile*)(OTGBASE + 0x914 + 0x20 * (x))))
204#define DIEPCTL0 (*((uint32_t volatile*)(OTGBASE + 0x900)))
205#define DIEPINT0 (*((uint32_t volatile*)(OTGBASE + 0x908)))
206#define DIEPTSIZ0 (*((uint32_t volatile*)(OTGBASE + 0x910)))
207#define DIEPDMA0 (*((const void* volatile*)(OTGBASE + 0x914)))
208#define DIEPCTL1 (*((uint32_t volatile*)(OTGBASE + 0x920)))
209#define DIEPINT1 (*((uint32_t volatile*)(OTGBASE + 0x928)))
210#define DIEPTSIZ1 (*((uint32_t volatile*)(OTGBASE + 0x930)))
211#define DIEPDMA1 (*((const void* volatile*)(OTGBASE + 0x934)))
212#define DIEPCTL2 (*((uint32_t volatile*)(OTGBASE + 0x940)))
213#define DIEPINT2 (*((uint32_t volatile*)(OTGBASE + 0x948)))
214#define DIEPTSIZ2 (*((uint32_t volatile*)(OTGBASE + 0x950)))
215#define DIEPDMA2 (*((const void* volatile*)(OTGBASE + 0x954)))
216#define DIEPCTL3 (*((uint32_t volatile*)(OTGBASE + 0x960)))
217#define DIEPINT3 (*((uint32_t volatile*)(OTGBASE + 0x968)))
218#define DIEPTSIZ3 (*((uint32_t volatile*)(OTGBASE + 0x970)))
219#define DIEPDMA3 (*((const void* volatile*)(OTGBASE + 0x974)))
220#define DIEPCTL4 (*((uint32_t volatile*)(OTGBASE + 0x980)))
221#define DIEPINT4 (*((uint32_t volatile*)(OTGBASE + 0x988)))
222#define DIEPTSIZ4 (*((uint32_t volatile*)(OTGBASE + 0x990)))
223#define DIEPDMA4 (*((const void* volatile*)(OTGBASE + 0x994)))
224#define DIEPCTL5 (*((uint32_t volatile*)(OTGBASE + 0x9A0)))
225#define DIEPINT5 (*((uint32_t volatile*)(OTGBASE + 0x9A8)))
226#define DIEPTSIZ5 (*((uint32_t volatile*)(OTGBASE + 0x9B0)))
227#define DIEPDMA5 (*((const void* volatile*)(OTGBASE + 0x9B4)))
228#define DIEPCTL6 (*((uint32_t volatile*)(OTGBASE + 0x9C0)))
229#define DIEPINT6 (*((uint32_t volatile*)(OTGBASE + 0x9C8)))
230#define DIEPTSIZ6 (*((uint32_t volatile*)(OTGBASE + 0x9D0)))
231#define DIEPDMA6 (*((const void* volatile*)(OTGBASE + 0x9D4)))
232#define DIEPCTL7 (*((uint32_t volatile*)(OTGBASE + 0x9E0)))
233#define DIEPINT7 (*((uint32_t volatile*)(OTGBASE + 0x9E8)))
234#define DIEPTSIZ7 (*((uint32_t volatile*)(OTGBASE + 0x9F0)))
235#define DIEPDMA7 (*((const void* volatile*)(OTGBASE + 0x9F4)))
236#define DIEPCTL8 (*((uint32_t volatile*)(OTGBASE + 0xA00)))
237#define DIEPINT8 (*((uint32_t volatile*)(OTGBASE + 0xA08)))
238#define DIEPTSIZ8 (*((uint32_t volatile*)(OTGBASE + 0xA10)))
239#define DIEPDMA8 (*((const void* volatile*)(OTGBASE + 0xA14)))
240#define DIEPCTL9 (*((uint32_t volatile*)(OTGBASE + 0xA20)))
241#define DIEPINT9 (*((uint32_t volatile*)(OTGBASE + 0xA28)))
242#define DIEPTSIZ9 (*((uint32_t volatile*)(OTGBASE + 0xA30)))
243#define DIEPDMA9 (*((const void* volatile*)(OTGBASE + 0xA34)))
244#define DIEPCTL10 (*((uint32_t volatile*)(OTGBASE + 0xA40)))
245#define DIEPINT10 (*((uint32_t volatile*)(OTGBASE + 0xA48)))
246#define DIEPTSIZ10 (*((uint32_t volatile*)(OTGBASE + 0xA50)))
247#define DIEPDMA10 (*((const void* volatile*)(OTGBASE + 0xA54)))
248#define DIEPCTL11 (*((uint32_t volatile*)(OTGBASE + 0xA60)))
249#define DIEPINT11 (*((uint32_t volatile*)(OTGBASE + 0xA68)))
250#define DIEPTSIZ11 (*((uint32_t volatile*)(OTGBASE + 0xA70)))
251#define DIEPDMA11 (*((const void* volatile*)(OTGBASE + 0xA74)))
252#define DIEPCTL12 (*((uint32_t volatile*)(OTGBASE + 0xA80)))
253#define DIEPINT12 (*((uint32_t volatile*)(OTGBASE + 0xA88)))
254#define DIEPTSIZ12 (*((uint32_t volatile*)(OTGBASE + 0xA90)))
255#define DIEPDMA12 (*((const void* volatile*)(OTGBASE + 0xA94)))
256#define DIEPCTL13 (*((uint32_t volatile*)(OTGBASE + 0xAA0)))
257#define DIEPINT13 (*((uint32_t volatile*)(OTGBASE + 0xAA8)))
258#define DIEPTSIZ13 (*((uint32_t volatile*)(OTGBASE + 0xAB0)))
259#define DIEPDMA13 (*((const void* volatile*)(OTGBASE + 0xAB4)))
260#define DIEPCTL14 (*((uint32_t volatile*)(OTGBASE + 0xAC0)))
261#define DIEPINT14 (*((uint32_t volatile*)(OTGBASE + 0xAC8)))
262#define DIEPTSIZ14 (*((uint32_t volatile*)(OTGBASE + 0xAD0)))
263#define DIEPDMA14 (*((const void* volatile*)(OTGBASE + 0xAD4)))
264#define DIEPCTL15 (*((uint32_t volatile*)(OTGBASE + 0xAE0)))
265#define DIEPINT15 (*((uint32_t volatile*)(OTGBASE + 0xAE8)))
266#define DIEPTSIZ15 (*((uint32_t volatile*)(OTGBASE + 0xAF0)))
267#define DIEPDMA15 (*((const void* volatile*)(OTGBASE + 0xAF4)))
268
269/* Device Logical OUT Endpoint-Specific Registers */ 389/* Device Logical OUT Endpoint-Specific Registers */
270#define DOEPCTL(x) (*((uint32_t volatile*)(OTGBASE + 0xB00 + 0x20 * (x)))) 390#define DOEPCTL(x) (*((uint32_t volatile*)(OTGBASE + 0xB00 + 0x20 * (x))))
271#define DOEPINT(x) (*((uint32_t volatile*)(OTGBASE + 0xB08 + 0x20 * (x)))) 391/** Maximum Packet Size
392 * IN/OUT EPn
393 * IN/OUT EP0 - 2 bits
394 * 2'b00: 64 Bytes
395 * 2'b01: 32
396 * 2'b10: 16
397 * 2'b11: 8 */
398#define DEPCTL_mps_bitp 0
399#define DEPCTL_mps_bits 0x7ff
400#define DEPCTL_MPS_64 0
401#define DEPCTL_MPS_32 1
402#define DEPCTL_MPS_16 2
403#define DEPCTL_MPS_8 3
404/** Next Endpoint
405 * IN EPn/IN EP0
406 * OUT EPn/OUT EP0 - reserved */
407#define DEPCTL_nextep_bitp 11
408#define DEPCTL_nextep_bits 0xf
409#define DEPCTL_usbactep (1 << 15) /** USB Active Endpoint */
410/** Endpoint DPID (INTR/Bulk IN and OUT endpoints)
411 * This field contains the PID of the packet going to
412 * be received or transmitted on this endpoint. The
413 * application should program the PID of the first
414 * packet going to be received or transmitted on this
415 * endpoint , after the endpoint is
416 * activated. Application use the SetD1PID and
417 * SetD0PID fields of this register to program either
418 * D0 or D1 PID.
419 *
420 * The encoding for this field is
421 * - 0: D0
422 * - 1: D1
423 */
424#define DEPCTL_dpid (1 << 16)
425#define DEPCTL_naksts (1 << 17) /** NAK Status */
426/** Endpoint Type
427 * 2'b00: Control
428 * 2'b01: Isochronous
429 * 2'b10: Bulk
430 * 2'b11: Interrupt */
431#define DEPCTL_eptype_bitp 18
432#define DEPCTL_eptype_bits 0x3
433/** Snoop Mode
434 * OUT EPn/OUT EP0
435 * IN EPn/IN EP0 - reserved */
436#define DEPCTL_snp (1 << 20)
437#define DEPCTL_stall (1 << 21) /** Stall Handshake */
438/** Tx Fifo Number
439 * IN EPn/IN EP0
440 * OUT EPn/OUT EP0 - reserved */
441#define DEPCTL_txfnum_bitp 22
442#define DEPCTL_txfnum_bits 0xf
443#define DEPCTL_cnak (1 << 26) /** Clear NAK */
444#define DEPCTL_snak (1 << 27) /** Set NAK */
445/** Set DATA0 PID (INTR/Bulk IN and OUT endpoints)
446 * Writing to this field sets the Endpoint DPID (DPID)
447 * field in this register to DATA0. Set Even
448 * (micro)frame (SetEvenFr) (ISO IN and OUT Endpoints)
449 * Writing to this field sets the Even/Odd
450 * (micro)frame (EO_FrNum) field to even (micro)
451 * frame.
452 */
453#define DEPCTL_setd0pid (1 << 28)
454/** Set DATA1 PID (INTR/Bulk IN and OUT endpoints)
455 * Writing to this field sets the Endpoint DPID (DPID)
456 * field in this register to DATA1 Set Odd
457 * (micro)frame (SetOddFr) (ISO IN and OUT Endpoints)
458 * Writing to this field sets the Even/Odd
459 * (micro)frame (EO_FrNum) field to odd (micro) frame.
460 */
461#define DEPCTL_setd1pid (1 << 29)
462#define DEPCTL_epdis (1 << 30) /** Endpoint disable */
463#define DEPCTL_epena (1 << 31) /** Endpoint enable */
464
465/** Device IN Endpoint (ep) Transfer Size Register */
466#define DIEPTSIZ(x) (*((uint32_t volatile*)(OTGBASE + 0x910 + 0x20 * (x))))
467/** Device OUT Endpoint (ep) Transfer Size Register */
272#define DOEPTSIZ(x) (*((uint32_t volatile*)(OTGBASE + 0xB10 + 0x20 * (x)))) 468#define DOEPTSIZ(x) (*((uint32_t volatile*)(OTGBASE + 0xB10 + 0x20 * (x))))
273#define DOEPDMA(x) (*((void* volatile*)(OTGBASE + 0xB14 + 0x20 * (x)))) 469/* valid for any D{I,O}EPTSIZi with 1<=i<=15, NOT for i=0 ! */
274#define DOEPCTL0 (*((uint32_t volatile*)(OTGBASE + 0xB00))) 470#define DEPTSIZ_xfersize_bitp 0 /** Transfer Size */
275#define DOEPINT0 (*((uint32_t volatile*)(OTGBASE + 0xB08))) 471#define DEPTSIZ_xfersize_bits 0x7ffff
276#define DOEPTSIZ0 (*((uint32_t volatile*)(OTGBASE + 0xB10))) 472#define DEPTSIZ_pkcnt_bitp 19 /** Packet Count */
277#define DOEPDMA0 (*((void* volatile*)(OTGBASE + 0xB14))) 473#define DEPTSIZ_pkcnt_bits 0x3ff
278#define DOEPCTL1 (*((uint32_t volatile*)(OTGBASE + 0xB20))) 474#define DEPTSIZ_mc_bitp 29 /** Multi Count - Periodic IN endpoints */
279#define DOEPINT1 (*((uint32_t volatile*)(OTGBASE + 0xB28))) 475#define DEPTSIZ_mc_bits 0x3
280#define DOEPTSIZ1 (*((uint32_t volatile*)(OTGBASE + 0xB30))) 476/* idem but for i=0 */
281#define DOEPDMA1 (*((void* volatile*)(OTGBASE + 0xB34))) 477#define DEPTSIZ0_xfersize_bitp 0 /** Transfer Size */
282#define DOEPCTL2 (*((uint32_t volatile*)(OTGBASE + 0xB40))) 478#define DEPTSIZ0_xfersize_bits 0x7f
283#define DOEPINT2 (*((uint32_t volatile*)(OTGBASE + 0xB48))) 479#define DEPTSIZ0_pkcnt_bitp 19 /** Packet Count */
284#define DOEPTSIZ2 (*((uint32_t volatile*)(OTGBASE + 0xB50))) 480#define DEPTSIZ0_pkcnt_bits 0x3
285#define DOEPDMA2 (*((void* volatile*)(OTGBASE + 0xB54))) 481#define DEPTSIZ0_supcnt_bitp 29 /** Setup Packet Count (DOEPTSIZ0 Only) */
286#define DOEPCTL3 (*((uint32_t volatile*)(OTGBASE + 0xB60))) 482#define DEPTSIZ0_supcnt_bits 0x3
287#define DOEPINT3 (*((uint32_t volatile*)(OTGBASE + 0xB68))) 483
288#define DOEPTSIZ3 (*((uint32_t volatile*)(OTGBASE + 0xB70))) 484
289#define DOEPDMA3 (*((void* volatile*)(OTGBASE + 0xB74))) 485/** Device Endpoint (ep) Control Register */
290#define DOEPCTL4 (*((uint32_t volatile*)(OTGBASE + 0xB80))) 486#define DIEPINT(x) (*((uint32_t volatile*)(OTGBASE + 0x908 + 0x20 * (x))))
291#define DOEPINT4 (*((uint32_t volatile*)(OTGBASE + 0xB88))) 487#define DOEPINT(x) (*((uint32_t volatile*)(OTGBASE + 0xB08 + 0x20 * (x))))
292#define DOEPTSIZ4 (*((uint32_t volatile*)(OTGBASE + 0xB90))) 488
293#define DOEPDMA4 (*((void* volatile*)(OTGBASE + 0xB94))) 489/** Device Endpoint (ep) DMA Address Register */
294#define DOEPCTL5 (*((uint32_t volatile*)(OTGBASE + 0xBA0))) 490#define DIEPDMA(x) (*((const void* volatile*)(OTGBASE + 0x914 + 0x20 * (x))))
295#define DOEPINT5 (*((uint32_t volatile*)(OTGBASE + 0xBA8))) 491#define DOEPDMA(x) (*((const void* volatile*)(OTGBASE + 0xB14 + 0x20 * (x))))
296#define DOEPTSIZ5 (*((uint32_t volatile*)(OTGBASE + 0xBB0)))
297#define DOEPDMA5 (*((void* volatile*)(OTGBASE + 0xBB4)))
298#define DOEPCTL6 (*((uint32_t volatile*)(OTGBASE + 0xBC0)))
299#define DOEPINT6 (*((uint32_t volatile*)(OTGBASE + 0xBC8)))
300#define DOEPTSIZ6 (*((uint32_t volatile*)(OTGBASE + 0xBD0)))
301#define DOEPDMA6 (*((void* volatile*)(OTGBASE + 0xBD4)))
302#define DOEPCTL7 (*((uint32_t volatile*)(OTGBASE + 0xBE0)))
303#define DOEPINT7 (*((uint32_t volatile*)(OTGBASE + 0xBE8)))
304#define DOEPTSIZ7 (*((uint32_t volatile*)(OTGBASE + 0xBF0)))
305#define DOEPDMA7 (*((void* volatile*)(OTGBASE + 0xBF4)))
306#define DOEPCTL8 (*((uint32_t volatile*)(OTGBASE + 0xC00)))
307#define DOEPINT8 (*((uint32_t volatile*)(OTGBASE + 0xC08)))
308#define DOEPTSIZ8 (*((uint32_t volatile*)(OTGBASE + 0xC10)))
309#define DOEPDMA8 (*((void* volatile*)(OTGBASE + 0xC14)))
310#define DOEPCTL9 (*((uint32_t volatile*)(OTGBASE + 0xC20)))
311#define DOEPINT9 (*((uint32_t volatile*)(OTGBASE + 0xC28)))
312#define DOEPTSIZ9 (*((uint32_t volatile*)(OTGBASE + 0xC30)))
313#define DOEPDMA9 (*((void* volatile*)(OTGBASE + 0xC34)))
314#define DOEPCTL10 (*((uint32_t volatile*)(OTGBASE + 0xC40)))
315#define DOEPINT10 (*((uint32_t volatile*)(OTGBASE + 0xC48)))
316#define DOEPTSIZ10 (*((uint32_t volatile*)(OTGBASE + 0xC50)))
317#define DOEPDMA10 (*((void* volatile*)(OTGBASE + 0xC54)))
318#define DOEPCTL11 (*((uint32_t volatile*)(OTGBASE + 0xC60)))
319#define DOEPINT11 (*((uint32_t volatile*)(OTGBASE + 0xC68)))
320#define DOEPTSIZ11 (*((uint32_t volatile*)(OTGBASE + 0xC70)))
321#define DOEPDMA11 (*((void* volatile*)(OTGBASE + 0xC74)))
322#define DOEPCTL12 (*((uint32_t volatile*)(OTGBASE + 0xC80)))
323#define DOEPINT12 (*((uint32_t volatile*)(OTGBASE + 0xC88)))
324#define DOEPTSIZ12 (*((uint32_t volatile*)(OTGBASE + 0xC90)))
325#define DOEPDMA12 (*((void* volatile*)(OTGBASE + 0xC94)))
326#define DOEPCTL13 (*((uint32_t volatile*)(OTGBASE + 0xCA0)))
327#define DOEPINT13 (*((uint32_t volatile*)(OTGBASE + 0xCA8)))
328#define DOEPTSIZ13 (*((uint32_t volatile*)(OTGBASE + 0xCB0)))
329#define DOEPDMA13 (*((void* volatile*)(OTGBASE + 0xCB4)))
330#define DOEPCTL14 (*((uint32_t volatile*)(OTGBASE + 0xCC0)))
331#define DOEPINT14 (*((uint32_t volatile*)(OTGBASE + 0xCC8)))
332#define DOEPTSIZ14 (*((uint32_t volatile*)(OTGBASE + 0xCD0)))
333#define DOEPDMA14 (*((void* volatile*)(OTGBASE + 0xCD4)))
334#define DOEPCTL15 (*((uint32_t volatile*)(OTGBASE + 0xCE0)))
335#define DOEPINT15 (*((uint32_t volatile*)(OTGBASE + 0xCE8)))
336#define DOEPTSIZ15 (*((uint32_t volatile*)(OTGBASE + 0xCF0)))
337#define DOEPDMA15 (*((void* volatile*)(OTGBASE + 0xCF4)))
338 492
339/* Power and Clock Gating Register */ 493/* Power and Clock Gating Register */
340#define PCGCCTL (*((uint32_t volatile*)(OTGBASE + 0xE00))) 494#define PCGCCTL (*((uint32_t volatile*)(OTGBASE + 0xE00)))
341 495
342
343#endif /* USB_S3C6400X_H */ 496#endif /* USB_S3C6400X_H */