diff options
Diffstat (limited to 'firmware/target/arm/as3525/usb-drv-as3525v2.h')
-rw-r--r-- | firmware/target/arm/as3525/usb-drv-as3525v2.h | 109 |
1 files changed, 107 insertions, 2 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.h b/firmware/target/arm/as3525/usb-drv-as3525v2.h index 4abbdb7dc2..ce132ad7b5 100644 --- a/firmware/target/arm/as3525/usb-drv-as3525v2.h +++ b/firmware/target/arm/as3525/usb-drv-as3525v2.h | |||
@@ -50,19 +50,47 @@ | |||
50 | #define USB_GHWCFG3 (*(volatile unsigned long *)(USB_BASE + 0x04C)) /** User HW Config3 Register */ | 50 | #define USB_GHWCFG3 (*(volatile unsigned long *)(USB_BASE + 0x04C)) /** User HW Config3 Register */ |
51 | #define USB_GHWCFG4 (*(volatile unsigned long *)(USB_BASE + 0x050)) /** User HW Config4 Register */ | 51 | #define USB_GHWCFG4 (*(volatile unsigned long *)(USB_BASE + 0x050)) /** User HW Config4 Register */ |
52 | 52 | ||
53 | /* 1<=ep<=15, don't use ep=0 !!! */ | ||
54 | /** Device IN Endpoint Transmit FIFO (ep) Size Register */ | ||
55 | #define USB_DIEPTXFSIZ(ep) (*(volatile unsigned long *)(USB_BASE + 0x100 + 4 * (ep))) | ||
56 | |||
57 | #define USB_MAKE_FIFOSIZE_DATA(startadr, depth) \ | ||
58 | (((startadr) & 0xffff) | ((depth) << 16)) | ||
59 | |||
60 | #define USB_GET_FIFOSIZE_DEPTH(data) \ | ||
61 | ((data) >> 16) | ||
62 | |||
63 | #define USB_GET_FIFOSIZE_START_ADR(data) \ | ||
64 | ((data) & 0xffff) | ||
65 | |||
53 | #define USB_GRSTCTL_csftrst (1 << 0) /** Core soft reset */ | 66 | #define USB_GRSTCTL_csftrst (1 << 0) /** Core soft reset */ |
54 | #define USB_GRSTCTL_hsftrst (1 << 1) /** Hclk soft reset */ | 67 | #define USB_GRSTCTL_hsftrst (1 << 1) /** Hclk soft reset */ |
68 | #define USB_GRSTCTL_intknqflsh (1 << 3) /** In Token Sequence Learning Queue Flush */ | ||
69 | #define USB_GRSTCTL_txfnum_bit_pos 6 /** TxFIFO Number */ | ||
70 | #define USB_GRSTCTL_txfnum_bits (0x1f << 6) | ||
71 | #define USB_GRSTCTL_txfflsh_flush (1 << 5) /** TxFIFO Flush */ | ||
72 | #define USB_GRSTCTL_rxfflsh_flush (1 << 4) /** RxFIFO Flush */ | ||
55 | #define USB_GRSTCTL_ahbidle (1 << 31) /** AHB idle state*/ | 73 | #define USB_GRSTCTL_ahbidle (1 << 31) /** AHB idle state*/ |
56 | 74 | ||
57 | #define USB_GHWCFG1_IN_EP(ep) ((USB_GHWCFG1 >> ((ep) *2)) & 0x1) /** 1 if EP(ep) has in cap */ | 75 | #define USB_GHWCFG1_IN_EP(ep) ((USB_GHWCFG1 >> ((ep) *2)) & 0x1) /** 1 if EP(ep) has in cap */ |
58 | #define USB_GHWCFG1_OUT_EP(ep) ((USB_GHWCFG1 >> ((ep) *2 + 1)) & 0x1)/** 1 if EP(ep) has out cap */ | 76 | #define USB_GHWCFG1_OUT_EP(ep) ((USB_GHWCFG1 >> ((ep) *2 + 1)) & 0x1)/** 1 if EP(ep) has out cap */ |
59 | 77 | ||
78 | #define USB_GHWCFG2_ARCH ((USB_GHWCFG2 >> 3) & 0x3) /** Architecture */ | ||
79 | #define USB_GHWCFG2_HS_PHY_TYPE ((USB_GHWCFG2 >> 6) & 0x3) /** High speed PHY type */ | ||
80 | #define USB_GHWCFG2_FS_PHY_TYPE ((USB_GHWCFG2 >> 8) & 0x3) /** Full speed PHY type */ | ||
81 | #define USB_GHWCFG2_NUM_EP ((USB_GHWCFG2 >> 10) & 0xf) /** Number of endpoints */ | ||
82 | #define USB_GHWCFG2_DYN_FIFO ((USB_GHWCFG2 >> 19) & 0x1) /** Dynamic FIFO */ | ||
83 | |||
84 | #define USB_PHY_TYPE_UNSUPPORTED 0 | ||
85 | #define USB_PHY_TYPE_UTMI 1 | ||
86 | #define USB_INT_DMA_ARCH 2 | ||
87 | |||
60 | #define USB_GHWCFG3_DFIFO_LEN (USB_GHWCFG3 >> 16) /** Total fifo size */ | 88 | #define USB_GHWCFG3_DFIFO_LEN (USB_GHWCFG3 >> 16) /** Total fifo size */ |
61 | 89 | ||
90 | #define USB_GHWCFG4_UTMI_PHY_DATA_WIDTH ((USB_GHWCFG4 >> 14) & 0x3) | ||
91 | #define USB_GHWCFG4_DED_FIFO_EN ((USB_GHWCFG4 >> 25) & 0x1) | ||
62 | #define USB_GHWCFG4_NUM_IN_EP ((USB_GHWCFG4 >> 26) & 0xf) /** Number of IN endpoints */ | 92 | #define USB_GHWCFG4_NUM_IN_EP ((USB_GHWCFG4 >> 26) & 0xf) /** Number of IN endpoints */ |
63 | 93 | ||
64 | #define USB_GHWCFG2_NUM_EP ((USB_GHWCFG2 >> 10) & 0xf) /** Number of endpoints */ | ||
65 | |||
66 | #define USB_GUSBCFG_ulpi_utmi_sel (1 << 4) /** select ulpi:1 or utmi:0 */ | 94 | #define USB_GUSBCFG_ulpi_utmi_sel (1 << 4) /** select ulpi:1 or utmi:0 */ |
67 | #define USB_GUSBCFG_phy_if (1 << 3) /** select utmi bus width ? */ | 95 | #define USB_GUSBCFG_phy_if (1 << 3) /** select utmi bus width ? */ |
68 | #define USB_GUSBCFG_SRP_cap 0x100 | 96 | #define USB_GUSBCFG_SRP_cap 0x100 |
@@ -72,6 +100,40 @@ | |||
72 | #define USB_GAHBCFG_INT_DMA_BURST_INCR 1 /** note: the linux patch has several other value, this is one picked for internal dma */ | 100 | #define USB_GAHBCFG_INT_DMA_BURST_INCR 1 /** note: the linux patch has several other value, this is one picked for internal dma */ |
73 | #define USB_GAHBCFG_dma_enable (1 << 5) | 101 | #define USB_GAHBCFG_dma_enable (1 << 5) |
74 | 102 | ||
103 | #define USB_GINTMSK_usb_rst 0x00001000 /*!< USB Reset Mask */ | ||
104 | #define USB_GINTMSK_EnumDone 0x00000200 /*!< Enumeration Done Mask */ | ||
105 | #define USB_GINTMSK_ErlySusp 0x00000400 /*!< Early Suspend Mask */ | ||
106 | #define USB_GINTMSK_USBSusp 0x00000800 /*!< USB Suspend Mask */ | ||
107 | #define USB_GINTMSK_SOF 0x00000008 /*!< Start of (micro)Frame Mask */ | ||
108 | #define USB_GINTMSK_NPTxFEmp 0x00000020 /*!< Non-periodic TxFIFO Empty Mask */ | ||
109 | |||
110 | #define USB_GINTMSK_wkupintr (1 << 31) | ||
111 | #define USB_GINTMSK_sessreqintr (1 << 30) | ||
112 | #define USB_GINTMSK_disconnect (1 << 29) | ||
113 | #define USB_GINTMSK_conidstschng (1 << 28) | ||
114 | #define USB_GINTMSK_ptxfempty (1 << 26) | ||
115 | #define USB_GINTMSK_hcintr (1 << 25) | ||
116 | #define USB_GINTMSK_portintr (1 << 24) | ||
117 | #define USB_GINTMSK_incomplisoout (1 << 21) | ||
118 | #define USB_GINTMSK_incomplisoin (1 << 20) | ||
119 | #define USB_GINTMSK_outepintr (1 << 19) | ||
120 | #define USB_GINTMSK_inepintr (1 << 18) | ||
121 | #define USB_GINTMSK_epmismatch (1 << 17) | ||
122 | #define USB_GINTMSK_eopframe (1 << 15) | ||
123 | #define USB_GINTMSK_isooutdrop (1 << 14) | ||
124 | #define USB_GINTMSK_enumdone (1 << 13) | ||
125 | #define USB_GINTMSK_usbreset (1 << 12) | ||
126 | #define USB_GINTMSK_usbsuspend (1 << 11) | ||
127 | #define USB_GINTMSK_erlysuspend (1 << 10) | ||
128 | #define USB_GINTMSK_i2cintr (1 << 9) | ||
129 | #define USB_GINTMSK_goutnakeff (1 << 7) | ||
130 | #define USB_GINTMSK_ginnakeff (1 << 6) | ||
131 | #define USB_GINTMSK_nptxfempty (1 << 5) | ||
132 | #define USB_GINTMSK_rxstsqlvl (1 << 4) | ||
133 | #define USB_GINTMSK_sofintr (1 << 3) | ||
134 | #define USB_GINTMSK_otgintr (1 << 2) | ||
135 | #define USB_GINTMSK_modemismatch (1 << 1) | ||
136 | |||
75 | /** | 137 | /** |
76 | * Device Registers Base Addresses | 138 | * Device Registers Base Addresses |
77 | */ | 139 | */ |
@@ -86,6 +148,49 @@ | |||
86 | #define USB_DTKNQR2 (*(volatile unsigned long *)(USB_DEVICE + 0x24)) /** Device IN Token Sequence Learning Queue Register 2 */ | 148 | #define USB_DTKNQR2 (*(volatile unsigned long *)(USB_DEVICE + 0x24)) /** Device IN Token Sequence Learning Queue Register 2 */ |
87 | #define USB_DTKNQP (*(volatile unsigned long *)(USB_DEVICE + 0x28)) /** Device IN Token Queue Pop register */ | 149 | #define USB_DTKNQP (*(volatile unsigned long *)(USB_DEVICE + 0x28)) /** Device IN Token Queue Pop register */ |
88 | 150 | ||
151 | #define USB_DCFG_devspd_bits 0x3 | ||
152 | #define USB_DCFG_devspd_hs_phy_hs 0 /** High speed PHY running at high speed */ | ||
153 | #define USB_DCFG_devspd_hs_phy_fs 1 /** High speed PHY running at full speed */ | ||
154 | #define USB_DCFG_perfrint_bit_pos 11 /** Periodic Frame Interval */ | ||
155 | #define USB_DCFG_perfrint_bits (0x3 << USB_DCFG_perfrint_bit_pos) | ||
156 | #define USB_DCFG_FRAME_INTERVAL_80 0 | ||
157 | #define USB_DCFG_FRAME_INTERVAL_85 1 | ||
158 | #define USB_DCFG_FRAME_INTERVAL_90 2 | ||
159 | #define USB_DCFG_FRAME_INTERVAL_95 3 | ||
160 | |||
161 | /* 0<=ep<=15, you can use ep=0 */ | ||
162 | /** Device IN Endpoint (ep) Control Register */ | ||
163 | #define USB_DIEPCTL(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20)) | ||
164 | /** Device IN Endpoint (ep) Interrupt Register */ | ||
165 | #define USB_DIEPINT(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20 + 0x8)) | ||
166 | /** Device IN Endpoint (ep) Transfer Size Register */ | ||
167 | #define USB_DIEPTSIZ(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20 + 0x10)) | ||
168 | /** Device IN Endpoint (ep) DMA Address Register */ | ||
169 | #define USB_DIEPDMA(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20 + 0x14)) | ||
170 | /** Device IN Endpoint (ep) Transmit FIFO Status Register */ | ||
171 | #define USB_DTXFSTS(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20 + 0x18)) | ||
172 | |||
173 | /** Device OUT Endpoint (ep) Control Register */ | ||
174 | #define USB_DOEPCTL(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x300 + (ep) * 0x20)) | ||
175 | /** Device OUT Endpoint (ep) Frame number Register */ | ||
176 | #define USB_DOEPFN(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x300 + (ep) * 0x20 + 0x4)) | ||
177 | /** Device Endpoint (ep) Interrupt Register */ | ||
178 | #define USB_DOEPINT(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x300 + (ep) * 0x20 + 0x8)) | ||
179 | /** Device OUT Endpoint (ep) Transfer Size Register */ | ||
180 | #define USB_DOEPTSIZ(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x300 + (ep) * 0x20 + 0x10)) | ||
181 | /** Device Endpoint (ep) DMA Address Register */ | ||
182 | #define USB_DOEPDMA(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x300 + (ep) * 0x20 + 0x14)) | ||
183 | |||
89 | #define USB_PCGCCTL (*(volatile unsigned long *)(USB_BASE + 0xE00)) /** Power and Clock Gating Control Register */ | 184 | #define USB_PCGCCTL (*(volatile unsigned long *)(USB_BASE + 0xE00)) /** Power and Clock Gating Control Register */ |
90 | 185 | ||
186 | #define USB_DEPCTL_epena (1 << 31) /** Endpoint enable */ | ||
187 | #define USB_DEPCTL_epdis (1 << 30) /** Endpoint disable */ | ||
188 | #define USB_DEPCTL_snak (1 << 27) /** Set NAK */ | ||
189 | #define USB_DEPCTL_cnak (1 << 28) /** Clear NAK */ | ||
190 | |||
191 | /** | ||
192 | * Parameters | ||
193 | */ | ||
194 | |||
195 | |||
91 | #endif /* __USB_DRV_AS3525v2_H__ */ | 196 | #endif /* __USB_DRV_AS3525v2_H__ */ |