Vishal Bhoj | 82c8071 | 2015-12-15 21:13:33 +0530 | [diff] [blame^] | 1 | /** @file |
| 2 | |
| 3 | Copyright (c) 2015, Linaro Limited. All rights reserved. |
| 4 | Copyright (c) 2015, Hisilicon Limited. All rights reserved. |
| 5 | |
| 6 | This program and the accompanying materials |
| 7 | are licensed and made available under the terms and conditions of the BSD License |
| 8 | which accompanies this distribution. The full text of the license may be found at |
| 9 | http://opensource.org/licenses/bsd-license.php |
| 10 | |
| 11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. |
| 13 | |
| 14 | **/ |
| 15 | |
| 16 | #ifndef __DW_USB_DXE_H__ |
| 17 | #define __DW_USB_DXE_H__ |
| 18 | |
| 19 | #define DW_USB_BASE FixedPcdGet32 (PcdDwUsbBaseAddress) |
| 20 | #define USB_PHY_BASE FixedPcdGet32 (PcdSysCtrlBaseAddress) |
| 21 | |
| 22 | #define SC_PERIPH_CTRL4 0x00c |
| 23 | |
| 24 | #define CTRL4_PICO_SIDDQ BIT6 |
| 25 | #define CTRL4_PICO_OGDISABLE BIT8 |
| 26 | #define CTRL4_PICO_VBUSVLDEXT BIT10 |
| 27 | #define CTRL4_PICO_VBUSVLDEXTSEL BIT11 |
| 28 | #define CTRL4_OTG_PHY_SEL BIT21 |
| 29 | |
| 30 | #define SC_PERIPH_CTRL5 0x010 |
| 31 | |
| 32 | #define CTRL5_USBOTG_RES_SEL BIT3 |
| 33 | #define CTRL5_PICOPHY_ACAENB BIT4 |
| 34 | #define CTRL5_PICOPHY_BC_MODE BIT5 |
| 35 | #define CTRL5_PICOPHY_CHRGSEL BIT6 |
| 36 | #define CTRL5_PICOPHY_VDATSRCEND BIT7 |
| 37 | #define CTRL5_PICOPHY_VDATDETENB BIT8 |
| 38 | #define CTRL5_PICOPHY_DCDENB BIT9 |
| 39 | #define CTRL5_PICOPHY_IDDIG BIT10 |
| 40 | |
| 41 | #define SC_PERIPH_CTRL8 0x018 |
| 42 | #define SC_PERIPH_RSTEN0 0x300 |
| 43 | #define SC_PERIPH_RSTDIS0 0x304 |
| 44 | |
| 45 | #define RST0_USBOTG_BUS BIT4 |
| 46 | #define RST0_POR_PICOPHY BIT5 |
| 47 | #define RST0_USBOTG BIT6 |
| 48 | #define RST0_USBOTG_32K BIT7 |
| 49 | |
| 50 | #define EYE_PATTERN_PARA 0x7053348c |
| 51 | |
| 52 | #define PHY_READ_REG32(Offset) MmioRead32 (USB_PHY_BASE + Offset) |
| 53 | #define PHY_WRITE_REG32(Offset, Val) MmioWrite32 (USB_PHY_BASE + Offset, Val) |
| 54 | |
| 55 | |
| 56 | #define READ_REG32(Offset) MmioRead32 (DW_USB_BASE + Offset) |
| 57 | #define READ_REG16(Offset) (UINT16) READ_REG32 (Offset) |
| 58 | #define WRITE_REG32(Offset, Val) MmioWrite32 (DW_USB_BASE + Offset, Val) |
| 59 | #define WRITE_REG16(Offset, Val) MmioWrite32 (DW_USB_BASE + Offset, (UINT32) Val) |
| 60 | #define WRITE_REG8(Offset, Val) MmioWrite32 (DW_USB_BASE + Offset, (UINT32) Val) |
| 61 | |
| 62 | // Max packet size in bytes (For Full Speed USB 64 is the only valid value) |
| 63 | #define MAX_PACKET_SIZE_CONTROL 64 |
| 64 | |
| 65 | #define MAX_PACKET_SIZE_BULK 512 |
| 66 | |
| 67 | // 8 Endpoints, in and out. Don't count the Endpoint 0 setup buffer |
| 68 | #define DW_NUM_ENDPOINTS 16 |
| 69 | |
| 70 | // Endpoint Indexes |
| 71 | #define DW_EP0SETUP 0x20 |
| 72 | #define DW_EP0RX 0x00 |
| 73 | #define DW_EP0TX 0x01 |
| 74 | #define DW_EP1RX 0x02 |
| 75 | #define DW_EP1TX 0x03 |
| 76 | |
| 77 | // DcInterrupt bits |
| 78 | #define DW_DC_INTERRUPT_BRESET BIT0 |
| 79 | #define DW_DC_INTERRUPT_SOF BIT1 |
| 80 | #define DW_DC_INTERRUPT_PSOF BIT2 |
| 81 | #define DW_DC_INTERRUPT_SUSP BIT3 |
| 82 | #define DW_DC_INTERRUPT_RESUME BIT4 |
| 83 | #define DW_DC_INTERRUPT_HS_STAT BIT5 |
| 84 | #define DW_DC_INTERRUPT_DMA BIT6 |
| 85 | #define DW_DC_INTERRUPT_VBUS BIT7 |
| 86 | #define DW_DC_INTERRUPT_EP0SETUP BIT8 |
| 87 | #define DW_DC_INTERRUPT_EP0RX BIT10 |
| 88 | #define DW_DC_INTERRUPT_EP0TX BIT11 |
| 89 | #define DW_DC_INTERRUPT_EP1RX BIT12 |
| 90 | #define DW_DC_INTERRUPT_EP1TX BIT13 |
| 91 | // All valid peripheral controller interrupts |
| 92 | #define DW_DC_INTERRUPT_MASK 0x003FFFDFF |
| 93 | |
| 94 | #define DW_ADDRESS 0x200 |
| 95 | #define DW_ADDRESS_DEVEN BIT7 |
| 96 | |
| 97 | #define DW_MODE 0x20C |
| 98 | #define DW_MODE_DATA_BUS_WIDTH BIT8 |
| 99 | #define DW_MODE_CLKAON BIT7 |
| 100 | #define DW_MODE_SFRESET BIT4 |
| 101 | #define DW_MODE_WKUPCS BIT2 |
| 102 | |
| 103 | #define DW_ENDPOINT_MAX_PACKET_SIZE 0x204 |
| 104 | |
| 105 | #define DW_ENDPOINT_TYPE 0x208 |
| 106 | #define DW_ENDPOINT_TYPE_NOEMPKT BIT4 |
| 107 | #define DW_ENDPOINT_TYPE_ENABLE BIT3 |
| 108 | |
| 109 | #define DW_INTERRUPT_CONFIG 0x210 |
| 110 | // Interrupt config value to only interrupt on ACK of IN and OUT tokens |
| 111 | #define DW_INTERRUPT_CONFIG_ACK_ONLY BIT2 | BIT5 | BIT6 |
| 112 | |
| 113 | #define DW_DC_INTERRUPT 0x218 |
| 114 | #define DW_DC_INTERRUPT_ENABLE 0x214 |
| 115 | |
| 116 | #define DW_CTRL_FUNCTION 0x228 |
| 117 | #define DW_CTRL_FUNCTION_VENDP BIT3 |
| 118 | #define DW_CTRL_FUNCTION_DSEN BIT2 |
| 119 | #define DW_CTRL_FUNCTION_STATUS BIT1 |
| 120 | |
| 121 | #define DW_DEVICE_UNLOCK 0x27C |
| 122 | #define DW_DEVICE_UNLOCK_MAGIC 0xAA37 |
| 123 | |
| 124 | #define DW_SW_RESET_REG 0x30C |
| 125 | #define DW_SW_RESET_ALL BIT0 |
| 126 | |
| 127 | #define DW_DEVICE_ID 0x370 |
| 128 | |
| 129 | #define DW_OTG_CTRL_SET 0x374 |
| 130 | #define DW_OTG_CTRL_CLR OTG_CTRL_SET + 2 |
| 131 | #define DW_OTG_CTRL_OTG_DISABLE BIT10 |
| 132 | #define DW_OTG_CTRL_VBUS_CHRG BIT6 |
| 133 | #define DW_OTG_CTRL_VBUS_DISCHRG BIT5 |
| 134 | #define DW_OTG_CTRL_DM_PULLDOWN BIT2 |
| 135 | #define DW_OTG_CTRL_DP_PULLDOWN BIT1 |
| 136 | #define DW_OTG_CTRL_DP_PULLUP BIT0 |
| 137 | |
| 138 | #define DW_OTG_STATUS 0x378 |
| 139 | #define DW_OTG_STATUS_B_SESS_END BIT7 |
| 140 | #define DW_OTG_STATUS_A_B_SESS_VLD BIT1 |
| 141 | |
| 142 | #define DW_OTG_INTERRUPT_LATCH_SET 0x37C |
| 143 | #define DW_OTG_INTERRUPT_LATCH_CLR 0x37E |
| 144 | #define DW_OTG_INTERRUPT_ENABLE_RISE 0x384 |
| 145 | |
| 146 | #define DW_DMA_ENDPOINT_INDEX 0x258 |
| 147 | |
| 148 | #define DW_ENDPOINT_INDEX 0x22c |
| 149 | #define DW_DATA_PORT 0x220 |
| 150 | #define DW_BUFFER_LENGTH 0x21c |
| 151 | |
| 152 | // Device ID Values |
| 153 | #define PHILLIPS_VENDOR_ID_VAL 0x04cc |
| 154 | #define DW_PRODUCT_ID_VAL 0x1761 |
| 155 | #define DW_DEVICE_ID_VAL ((ISP1761_PRODUCT_ID_VAL << 16) |\ |
| 156 | PHILLIPS_VENDOR_ID_VAL) |
| 157 | |
| 158 | #define DWC_OTG_BASE DW_USB_BASE |
| 159 | |
| 160 | #define USB_NUM_ENDPOINTS 2 |
| 161 | #define MAX_EPS_CHANNELS 16 |
| 162 | |
| 163 | #define BULK_OUT_EP 1 |
| 164 | #define BULK_IN_EP 1 |
| 165 | |
| 166 | #define RX_REQ_LEN 512 |
| 167 | #define MAX_PACKET_LEN 512 |
| 168 | |
| 169 | #define DATA_FIFO_CONFIG 0x0F801000 |
| 170 | /* RX FIFO: 2048 bytes */ |
| 171 | #define RX_SIZE 0x00000200 |
| 172 | /* Non-periodic TX FIFO: 128 bytes. start address: 0x200 * 4. */ |
| 173 | #define ENDPOINT_TX_SIZE 0x01000200 |
| 174 | |
| 175 | /* EP1 TX FIFO: 1024 bytes. start address: 0x300 * 4. */ |
| 176 | /* EP2 TX FIFO: 1024 bytes. start address: 0x400 * 4. */ |
| 177 | /* EP3 TX FIFO: 1024 bytes. start address: 0x500 * 4. */ |
| 178 | /* EP4 TX FIFO: 1024 bytes. start address: 0x600 * 4. */ |
| 179 | /* EP5 TX FIFO: 1024 bytes. start address: 0x700 * 4. */ |
| 180 | /* EP6 TX FIFO: 1024 bytes. start address: 0x800 * 4. */ |
| 181 | /* EP7 TX FIFO: 1024 bytes. start address: 0x900 * 4. */ |
| 182 | /* EP8 TX FIFO: 1024 bytes. start address: 0xA00 * 4. */ |
| 183 | /* EP9 TX FIFO: 1024 bytes. start address: 0xB00 * 4. */ |
| 184 | /* EP10 TX FIFO: 1024 bytes. start address: 0xC00 * 4. */ |
| 185 | /* EP11 TX FIFO: 512 bytes. start address: 0xD00 * 4. */ |
| 186 | /* EP12 TX FIFO: 512 bytes. start address: 0xD80 * 4. */ |
| 187 | /* EP13 TX FIFO: 512 bytes. start address: 0xE00 * 4. */ |
| 188 | /* EP14 TX FIFO: 512 bytes. start address: 0xE80 * 4. */ |
| 189 | /* EP15 TX FIFO: 512 bytes. start address: 0xF00 * 4. */ |
| 190 | |
| 191 | #define DATA_IN_ENDPOINT_TX_FIFO1 0x01000300 |
| 192 | #define DATA_IN_ENDPOINT_TX_FIFO2 0x01000400 |
| 193 | #define DATA_IN_ENDPOINT_TX_FIFO3 0x01000500 |
| 194 | #define DATA_IN_ENDPOINT_TX_FIFO4 0x01000600 |
| 195 | #define DATA_IN_ENDPOINT_TX_FIFO5 0x01000700 |
| 196 | #define DATA_IN_ENDPOINT_TX_FIFO6 0x01000800 |
| 197 | #define DATA_IN_ENDPOINT_TX_FIFO7 0x01000900 |
| 198 | #define DATA_IN_ENDPOINT_TX_FIFO8 0x01000A00 |
| 199 | #define DATA_IN_ENDPOINT_TX_FIFO9 0x01000B00 |
| 200 | #define DATA_IN_ENDPOINT_TX_FIFO10 0x01000C00 |
| 201 | #define DATA_IN_ENDPOINT_TX_FIFO11 0x00800D00 |
| 202 | #define DATA_IN_ENDPOINT_TX_FIFO12 0x00800D80 |
| 203 | #define DATA_IN_ENDPOINT_TX_FIFO13 0x00800E00 |
| 204 | #define DATA_IN_ENDPOINT_TX_FIFO14 0x00800E80 |
| 205 | #define DATA_IN_ENDPOINT_TX_FIFO15 0x00800F00 |
| 206 | |
| 207 | /*DWC_OTG regsiter descriptor*/ |
| 208 | /*Device mode CSR MAP*/ |
| 209 | #define DEVICE_CSR_BASE (0x800) |
| 210 | /*Device mode CSR MAP*/ |
| 211 | #define DEVICE_INEP_BASE (0x900) |
| 212 | /*Device mode CSR MAP*/ |
| 213 | #define DEVICE_OUTEP_BASE (0xB00) |
| 214 | |
| 215 | /*** OTG LINK CORE REGISTERS ***/ |
| 216 | /* Core Global Registers */ |
| 217 | #define GOTGCTL (0x000) |
| 218 | #define GOTGINT (0x004) |
| 219 | #define GAHBCFG (0x008) |
| 220 | #define GUSBCFG (0x00C) |
| 221 | #define GRSTCTL (0x010) |
| 222 | #define GINTSTS (0x014) |
| 223 | #define GINTMSK (0x018) |
| 224 | #define GRXSTSR (0x01C) |
| 225 | #define GRXSTSP (0x020) |
| 226 | #define GRXFSIZ (0x024) |
| 227 | #define GNPTXFSIZ (0x028) |
| 228 | #define GNPTXSTS (0x02C) |
| 229 | |
| 230 | #define GHWCFG1 (0x044) |
| 231 | #define GHWCFG2 (0x048) |
| 232 | #define GHWCFG3 (0x04c) |
| 233 | #define GHWCFG4 (0x050) |
| 234 | #define GLPMCFG (0x054) |
| 235 | |
| 236 | #define GDFIFOCFG (0x05c) |
| 237 | |
| 238 | #define HPTXFSIZ (0x100) |
| 239 | #define DIEPTXF(x) (0x100 + 4 * (x)) |
| 240 | #define DIEPTXF1 (0x104) |
| 241 | #define DIEPTXF2 (0x108) |
| 242 | #define DIEPTXF3 (0x10C) |
| 243 | #define DIEPTXF4 (0x110) |
| 244 | #define DIEPTXF5 (0x114) |
| 245 | #define DIEPTXF6 (0x118) |
| 246 | #define DIEPTXF7 (0x11C) |
| 247 | #define DIEPTXF8 (0x120) |
| 248 | #define DIEPTXF9 (0x124) |
| 249 | #define DIEPTXF10 (0x128) |
| 250 | #define DIEPTXF11 (0x12C) |
| 251 | #define DIEPTXF12 (0x130) |
| 252 | #define DIEPTXF13 (0x134) |
| 253 | #define DIEPTXF14 (0x138) |
| 254 | #define DIEPTXF15 (0x13C) |
| 255 | |
| 256 | /*** HOST MODE REGISTERS ***/ |
| 257 | /* Host Global Registers */ |
| 258 | #define HCFG (0x400) |
| 259 | #define HFIR (0x404) |
| 260 | #define HFNUM (0x408) |
| 261 | #define HPTXSTS (0x410) |
| 262 | #define HAINT (0x414) |
| 263 | #define HAINTMSK (0x418) |
| 264 | |
| 265 | /* Host Port Control and Status Registers */ |
| 266 | #define HPRT (0x440) |
| 267 | |
| 268 | /* Host Channel-Specific Registers */ |
| 269 | #define HCCHAR(x) (0x500 + 0x20 * (x)) |
| 270 | #define HCSPLT(x) (0x504 + 0x20 * (x)) |
| 271 | #define HCINT(x) (0x508 + 0x20 * (x)) |
| 272 | #define HCINTMSK(x) (0x50C + 0x20 * (x)) |
| 273 | #define HCTSIZ(x) (0x510 + 0x20 * (x)) |
| 274 | #define HCDMA(x) (0x514 + 0x20 * (x)) |
| 275 | #define HCCHAR0 (0x500) |
| 276 | #define HCSPLT0 (0x504) |
| 277 | #define HCINT0 (0x508) |
| 278 | #define HCINTMSK0 (0x50C) |
| 279 | #define HCTSIZ0 (0x510) |
| 280 | #define HCDMA0 (0x514) |
| 281 | #define HCCHAR1 (0x520) |
| 282 | #define HCSPLT1 (0x524) |
| 283 | #define HCINT1 (0x528) |
| 284 | #define HCINTMSK1 (0x52C) |
| 285 | #define HCTSIZ1 (0x530) |
| 286 | #define HCDMA1 (0x534) |
| 287 | #define HCCHAR2 (0x540) |
| 288 | #define HCSPLT2 (0x544) |
| 289 | #define HCINT2 (0x548) |
| 290 | #define HCINTMSK2 (0x54C) |
| 291 | #define HCTSIZ2 (0x550) |
| 292 | #define HCDMA2 (0x554) |
| 293 | #define HCCHAR3 (0x560) |
| 294 | #define HCSPLT3 (0x564) |
| 295 | #define HCINT3 (0x568) |
| 296 | #define HCINTMSK3 (0x56C) |
| 297 | #define HCTSIZ3 (0x570) |
| 298 | #define HCDMA3 (0x574) |
| 299 | #define HCCHAR4 (0x580) |
| 300 | #define HCSPLT4 (0x584) |
| 301 | #define HCINT4 (0x588) |
| 302 | #define HCINTMSK4 (0x58C) |
| 303 | #define HCTSIZ4 (0x590) |
| 304 | #define HCDMA4 (0x594) |
| 305 | #define HCCHAR5 (0x5A0) |
| 306 | #define HCSPLT5 (0x5A4) |
| 307 | #define HCINT5 (0x5A8) |
| 308 | #define HCINTMSK5 (0x5AC) |
| 309 | #define HCTSIZ5 (0x5B0) |
| 310 | #define HCDMA5 (0x5B4) |
| 311 | #define HCCHAR6 (0x5C0) |
| 312 | #define HCSPLT6 (0x5C4) |
| 313 | #define HCINT6 (0x5C8) |
| 314 | #define HCINTMSK6 (0x5CC) |
| 315 | #define HCTSIZ6 (0x5D0) |
| 316 | #define HCDMA6 (0x5D4) |
| 317 | #define HCCHAR7 (0x5E0) |
| 318 | #define HCSPLT7 (0x5E4) |
| 319 | #define HCINT7 (0x5E8) |
| 320 | #define HCINTMSK7 (0x5EC) |
| 321 | #define HCTSIZ7 (0x5F0) |
| 322 | #define HCDMA7 (0x5F4) |
| 323 | #define HCCHAR8 (0x600) |
| 324 | #define HCSPLT8 (0x604) |
| 325 | #define HCINT8 (0x608) |
| 326 | #define HCINTMSK8 (0x60C) |
| 327 | #define HCTSIZ8 (0x610) |
| 328 | #define HCDMA8 (0x614) |
| 329 | #define HCCHAR9 (0x620) |
| 330 | #define HCSPLT9 (0x624) |
| 331 | #define HCINT9 (0x628) |
| 332 | #define HCINTMSK9 (0x62C) |
| 333 | #define HCTSIZ9 (0x630) |
| 334 | #define HCDMA9 (0x634) |
| 335 | #define HCCHAR10 (0x640) |
| 336 | #define HCSPLT10 (0x644) |
| 337 | #define HCINT10 (0x648) |
| 338 | #define HCINTMSK10 (0x64C) |
| 339 | #define HCTSIZ10 (0x650) |
| 340 | #define HCDMA10 (0x654) |
| 341 | #define HCCHAR11 (0x660) |
| 342 | #define HCSPLT11 (0x664) |
| 343 | #define HCINT11 (0x668) |
| 344 | #define HCINTMSK11 (0x66C) |
| 345 | #define HCTSIZ11 (0x670) |
| 346 | #define HCDMA11 (0x674) |
| 347 | #define HCCHAR12 (0x680) |
| 348 | #define HCSPLT12 (0x684) |
| 349 | #define HCINT12 (0x688) |
| 350 | #define HCINTMSK12 (0x68C) |
| 351 | #define HCTSIZ12 (0x690) |
| 352 | #define HCDMA12 (0x694) |
| 353 | #define HCCHAR13 (0x6A0) |
| 354 | #define HCSPLT13 (0x6A4) |
| 355 | #define HCINT13 (0x6A8) |
| 356 | #define HCINTMSK13 (0x6AC) |
| 357 | #define HCTSIZ13 (0x6B0) |
| 358 | #define HCDMA13 (0x6B4) |
| 359 | #define HCCHAR14 (0x6C0) |
| 360 | #define HCSPLT14 (0x6C4) |
| 361 | #define HCINT14 (0x6C8) |
| 362 | #define HCINTMSK14 (0x6CC) |
| 363 | #define HCTSIZ14 (0x6D0) |
| 364 | #define HCDMA14 (0x6D4) |
| 365 | #define HCCHAR15 (0x6E0) |
| 366 | #define HCSPLT15 (0x6E4) |
| 367 | #define HCINT15 (0x6E8) |
| 368 | #define HCINTMSK15 (0x6EC) |
| 369 | #define HCTSIZ15 (0x6F0) |
| 370 | #define HCDMA15 (0x6F4) |
| 371 | |
| 372 | /*** DEVICE MODE REGISTERS ***/ |
| 373 | /* Device Global Registers */ |
| 374 | #define DCFG (0x800) |
| 375 | #define DCTL (0x804) |
| 376 | #define DSTS (0x808) |
| 377 | #define DIEPMSK (0x810) |
| 378 | #define DOEPMSK (0x814) |
| 379 | #define DAINT (0x818) |
| 380 | #define DAINTMSK (0x81C) |
| 381 | #define DTKNQR1 (0x820) |
| 382 | #define DTKNQR2 (0x824) |
| 383 | #define DVBUSDIS (0x828) |
| 384 | #define DVBUSPULSE (0x82C) |
| 385 | #define DTHRCTL (0x830) |
| 386 | |
| 387 | /* Device Logical IN Endpoint-Specific Registers */ |
| 388 | #define DIEPCTL(x) (0x900 + 0x20 * (x)) |
| 389 | #define DIEPINT(x) (0x908 + 0x20 * (x)) |
| 390 | #define DIEPTSIZ(x) (0x910 + 0x20 * (x)) |
| 391 | #define DIEPDMA(x) (0x914 + 0x20 * (x)) |
| 392 | #define DTXFSTS(x) (0x918 + 0x20 * (x)) |
| 393 | |
| 394 | #define DIEPCTL0 (0x900) |
| 395 | #define DIEPINT0 (0x908) |
| 396 | #define DIEPTSIZ0 (0x910) |
| 397 | #define DIEPDMA0 (0x914) |
| 398 | #define DIEPCTL1 (0x920) |
| 399 | #define DIEPINT1 (0x928) |
| 400 | #define DIEPTSIZ1 (0x930) |
| 401 | #define DIEPDMA1 (0x934) |
| 402 | #define DIEPCTL2 (0x940) |
| 403 | #define DIEPINT2 (0x948) |
| 404 | #define DIEPTSIZ2 (0x950) |
| 405 | #define DIEPDMA2 (0x954) |
| 406 | #define DIEPCTL3 (0x960) |
| 407 | #define DIEPINT3 (0x968) |
| 408 | #define DIEPTSIZ3 (0x970) |
| 409 | #define DIEPDMA3 (0x974) |
| 410 | #define DIEPCTL4 (0x980) |
| 411 | #define DIEPINT4 (0x988) |
| 412 | #define DIEPTSIZ4 (0x990) |
| 413 | #define DIEPDMA4 (0x994) |
| 414 | #define DIEPCTL5 (0x9A0) |
| 415 | #define DIEPINT5 (0x9A8) |
| 416 | #define DIEPTSIZ5 (0x9B0) |
| 417 | #define DIEPDMA5 (0x9B4) |
| 418 | #define DIEPCTL6 (0x9C0) |
| 419 | #define DIEPINT6 (0x9C8) |
| 420 | #define DIEPTSIZ6 (0x9D0) |
| 421 | #define DIEPDMA6 (0x9D4) |
| 422 | #define DIEPCTL7 (0x9E0) |
| 423 | #define DIEPINT7 (0x9E8) |
| 424 | #define DIEPTSIZ7 (0x9F0) |
| 425 | #define DIEPDMA7 (0x9F4) |
| 426 | #define DIEPCTL8 (0xA00) |
| 427 | #define DIEPINT8 (0xA08) |
| 428 | #define DIEPTSIZ8 (0xA10) |
| 429 | #define DIEPDMA8 (0xA14) |
| 430 | #define DIEPCTL9 (0xA20) |
| 431 | #define DIEPINT9 (0xA28) |
| 432 | #define DIEPTSIZ9 (0xA30) |
| 433 | #define DIEPDMA9 (0xA34) |
| 434 | #define DIEPCTL10 (0xA40) |
| 435 | #define DIEPINT10 (0xA48) |
| 436 | #define DIEPTSIZ10 (0xA50) |
| 437 | #define DIEPDMA10 (0xA54) |
| 438 | #define DIEPCTL11 (0xA60) |
| 439 | #define DIEPINT11 (0xA68) |
| 440 | #define DIEPTSIZ11 (0xA70) |
| 441 | #define DIEPDMA11 (0xA74) |
| 442 | #define DIEPCTL12 (0xA80) |
| 443 | #define DIEPINT12 (0xA88) |
| 444 | #define DIEPTSIZ12 (0xA90) |
| 445 | #define DIEPDMA12 (0xA94) |
| 446 | #define DIEPCTL13 (0xAA0) |
| 447 | #define DIEPINT13 (0xAA8) |
| 448 | #define DIEPTSIZ13 (0xAB0) |
| 449 | #define DIEPDMA13 (0xAB4) |
| 450 | #define DIEPCTL14 (0xAC0) |
| 451 | #define DIEPINT14 (0xAC8) |
| 452 | #define DIEPTSIZ14 (0xAD0) |
| 453 | #define DIEPDMA14 (0xAD4) |
| 454 | #define DIEPCTL15 (0xAE0) |
| 455 | #define DIEPINT15 (0xAE8) |
| 456 | #define DIEPTSIZ15 (0xAF0) |
| 457 | #define DIEPDMA15 (0xAF4) |
| 458 | |
| 459 | /* Device Logical OUT Endpoint-Specific Registers */ |
| 460 | #define DOEPCTL(x) (0xB00 + 0x20 * (x)) |
| 461 | #define DOEPINT(x) (0xB08 + 0x20 * (x)) |
| 462 | #define DOEPTSIZ(x) (0xB10 + 0x20 * (x)) |
| 463 | #define DOEPDMA(x) (0xB14 + 0x20 * (x)) |
| 464 | #define DOEPCTL0 (0xB00) |
| 465 | #define DOEPINT0 (0xB08) |
| 466 | #define DOEPTSIZ0 (0xB10) |
| 467 | #define DOEPDMA0 (0xB14) |
| 468 | #define DOEPCTL1 (0xB20) |
| 469 | #define DOEPINT1 (0xB28) |
| 470 | #define DOEPTSIZ1 (0xB30) |
| 471 | #define DOEPDMA1 (0xB34) |
| 472 | #define DOEPCTL2 (0xB40) |
| 473 | #define DOEPINT2 (0xB48) |
| 474 | #define DOEPTSIZ2 (0xB50) |
| 475 | #define DOEPDMA2 (0xB54) |
| 476 | #define DOEPCTL3 (0xB60) |
| 477 | #define DOEPINT3 (0xB68) |
| 478 | #define DOEPTSIZ3 (0xB70) |
| 479 | #define DOEPDMA3 (0xB74) |
| 480 | #define DOEPCTL4 (0xB80) |
| 481 | #define DOEPINT4 (0xB88) |
| 482 | #define DOEPTSIZ4 (0xB90) |
| 483 | #define DOEPDMA4 (0xB94) |
| 484 | #define DOEPCTL5 (0xBA0) |
| 485 | #define DOEPINT5 (0xBA8) |
| 486 | #define DOEPTSIZ5 (0xBB0) |
| 487 | #define DOEPDMA5 (0xBB4) |
| 488 | #define DOEPCTL6 (0xBC0) |
| 489 | #define DOEPINT6 (0xBC8) |
| 490 | #define DOEPTSIZ6 (0xBD0) |
| 491 | #define DOEPDMA6 (0xBD4) |
| 492 | #define DOEPCTL7 (0xBE0) |
| 493 | #define DOEPINT7 (0xBE8) |
| 494 | #define DOEPTSIZ7 (0xBF0) |
| 495 | #define DOEPDMA7 (0xBF4) |
| 496 | #define DOEPCTL8 (0xC00) |
| 497 | #define DOEPINT8 (0xC08) |
| 498 | #define DOEPTSIZ8 (0xC10) |
| 499 | #define DOEPDMA8 (0xC14) |
| 500 | #define DOEPCTL9 (0xC20) |
| 501 | #define DOEPINT9 (0xC28) |
| 502 | #define DOEPTSIZ9 (0xC30) |
| 503 | #define DOEPDMA9 (0xC34) |
| 504 | #define DOEPCTL10 (0xC40) |
| 505 | #define DOEPINT10 (0xC48) |
| 506 | #define DOEPTSIZ10 (0xC50) |
| 507 | #define DOEPDMA10 (0xC54) |
| 508 | #define DOEPCTL11 (0xC60) |
| 509 | #define DOEPINT11 (0xC68) |
| 510 | #define DOEPTSIZ11 (0xC70) |
| 511 | #define DOEPDMA11 (0xC74) |
| 512 | #define DOEPCTL12 (0xC80) |
| 513 | #define DOEPINT12 (0xC88) |
| 514 | #define DOEPTSIZ12 (0xC90) |
| 515 | #define DOEPDMA12 (0xC94) |
| 516 | #define DOEPCTL13 (0xCA0) |
| 517 | #define DOEPINT13 (0xCA8) |
| 518 | #define DOEPTSIZ13 (0xCB0) |
| 519 | #define DOEPDMA13 (0xCB4) |
| 520 | #define DOEPCTL14 (0xCC0) |
| 521 | #define DOEPINT14 (0xCC8) |
| 522 | #define DOEPTSIZ14 (0xCD0) |
| 523 | #define DOEPDMA14 (0xCD4) |
| 524 | #define DOEPCTL15 (0xCE0) |
| 525 | #define DOEPINT15 (0xCE8) |
| 526 | #define DOEPTSIZ15 (0xCF0) |
| 527 | #define DOEPDMA15 (0xCF4) |
| 528 | |
| 529 | /* Power and Clock Gating Register */ |
| 530 | #define PCGCCTL (0xE00) |
| 531 | |
| 532 | #define EP0FIFO (0x1000) |
| 533 | |
| 534 | /** |
| 535 | * This union represents the bit fields in the DMA Descriptor |
| 536 | * status quadlet. Read the quadlet into the <i>d32</i> member then |
| 537 | * set/clear the bits using the <i>b</i>it, <i>b_iso_out</i> and |
| 538 | * <i>b_iso_in</i> elements. |
| 539 | */ |
| 540 | typedef union dev_dma_desc_sts { |
| 541 | /** raw register data */ |
| 542 | unsigned int d32; |
| 543 | /** quadlet bits */ |
| 544 | struct { |
| 545 | /** Received number of bytes */ |
| 546 | unsigned bytes:16; |
| 547 | /** NAK bit - only for OUT EPs */ |
| 548 | unsigned nak:1; |
| 549 | unsigned reserved17_22:6; |
| 550 | /** Multiple Transfer - only for OUT EPs */ |
| 551 | unsigned mtrf:1; |
| 552 | /** Setup Packet received - only for OUT EPs */ |
| 553 | unsigned sr:1; |
| 554 | /** Interrupt On Complete */ |
| 555 | unsigned ioc:1; |
| 556 | /** Short Packet */ |
| 557 | unsigned sp:1; |
| 558 | /** Last */ |
| 559 | unsigned l:1; |
| 560 | /** Receive Status */ |
| 561 | unsigned sts:2; |
| 562 | /** Buffer Status */ |
| 563 | unsigned bs:2; |
| 564 | } b; |
| 565 | } dev_dma_desc_sts_t; |
| 566 | |
| 567 | /** |
| 568 | * DMA Descriptor structure |
| 569 | * |
| 570 | * DMA Descriptor structure contains two quadlets: |
| 571 | * Status quadlet and Data buffer pointer. |
| 572 | */ |
| 573 | typedef struct dwc_otg_dev_dma_desc { |
| 574 | /** DMA Descriptor status quadlet */ |
| 575 | dev_dma_desc_sts_t status; |
| 576 | /** DMA Descriptor data buffer pointer */ |
| 577 | UINT32 buf; |
| 578 | } dwc_otg_dev_dma_desc_t; |
| 579 | |
| 580 | #endif //ifndef __DW_USB_DXE_H__ |