Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 1 | /* |
| 2 | * URB OHCI HCD (Host Controller Driver) for USB. |
| 3 | * |
| 4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> |
| 5 | * (C) Copyright 2000-2001 David Brownell <dbrownell@users.sourceforge.net> |
| 6 | * |
| 7 | * usb-ohci.h |
| 8 | */ |
| 9 | |
Becky Bruce | a5496a1 | 2010-06-30 13:05:44 -0500 | [diff] [blame] | 10 | /* |
| 11 | * e.g. PCI controllers need this |
| 12 | */ |
Andre Przywara | 57faca1 | 2016-10-21 02:24:29 +0100 | [diff] [blame] | 13 | |
Simon Glass | 72be237 | 2020-05-30 10:29:03 -0600 | [diff] [blame] | 14 | #include <asm/cache.h> |
Andre Przywara | 57faca1 | 2016-10-21 02:24:29 +0100 | [diff] [blame] | 15 | #include <asm/io.h> |
| 16 | |
Becky Bruce | a5496a1 | 2010-06-30 13:05:44 -0500 | [diff] [blame] | 17 | #ifdef CONFIG_SYS_OHCI_SWAP_REG_ACCESS |
Heiko Schocher | a5a7486 | 2019-07-16 10:49:04 +0200 | [diff] [blame] | 18 | # define ohci_readl(a) __swap_32(in_be32((u32 *)a)) |
| 19 | # define ohci_writel(a, b) out_be32((u32 *)b, __swap_32(a)) |
Becky Bruce | a5496a1 | 2010-06-30 13:05:44 -0500 | [diff] [blame] | 20 | #else |
Andre Przywara | 57faca1 | 2016-10-21 02:24:29 +0100 | [diff] [blame] | 21 | # define ohci_readl(a) readl(a) |
| 22 | # define ohci_writel(v, a) writel(v, a) |
Becky Bruce | a5496a1 | 2010-06-30 13:05:44 -0500 | [diff] [blame] | 23 | #endif /* CONFIG_SYS_OHCI_SWAP_REG_ACCESS */ |
| 24 | |
Wu, Josh | e0266f4 | 2015-07-27 11:40:18 +0800 | [diff] [blame] | 25 | #if ARCH_DMA_MINALIGN > 16 |
Hans de Goede | 8d005ef | 2015-05-05 23:56:13 +0200 | [diff] [blame] | 26 | #define ED_ALIGNMENT ARCH_DMA_MINALIGN |
| 27 | #else |
| 28 | #define ED_ALIGNMENT 16 |
| 29 | #endif |
| 30 | |
Sven Schwermer | fd09c20 | 2018-11-21 08:43:56 +0100 | [diff] [blame] | 31 | #if CONFIG_IS_ENABLED(DM_USB) && ARCH_DMA_MINALIGN > 32 |
Hans de Goede | 8d005ef | 2015-05-05 23:56:13 +0200 | [diff] [blame] | 32 | #define TD_ALIGNMENT ARCH_DMA_MINALIGN |
| 33 | #else |
| 34 | #define TD_ALIGNMENT 32 |
| 35 | #endif |
| 36 | |
Wolfgang Denk | 99d70e3 | 2006-06-26 11:06:00 +0200 | [diff] [blame] | 37 | /* functions for doing board or CPU specific setup/cleanup */ |
Mateusz Zalega | 16297cf | 2013-10-04 19:22:26 +0200 | [diff] [blame] | 38 | int usb_board_stop(void); |
Markus Klotzbuecher | 24e3764 | 2006-05-23 10:33:11 +0200 | [diff] [blame] | 39 | |
Mateusz Zalega | 16297cf | 2013-10-04 19:22:26 +0200 | [diff] [blame] | 40 | int usb_cpu_init(void); |
| 41 | int usb_cpu_stop(void); |
| 42 | int usb_cpu_init_fail(void); |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 43 | |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 44 | /* ED States */ |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 45 | #define ED_NEW 0x00 |
| 46 | #define ED_UNLINK 0x01 |
| 47 | #define ED_OPER 0x02 |
| 48 | #define ED_DEL 0x04 |
| 49 | #define ED_URB_DEL 0x08 |
| 50 | |
| 51 | /* usb_ohci_ed */ |
| 52 | struct ed { |
| 53 | __u32 hwINFO; |
| 54 | __u32 hwTailP; |
| 55 | __u32 hwHeadP; |
| 56 | __u32 hwNextED; |
| 57 | |
| 58 | struct ed *ed_prev; |
| 59 | __u8 int_period; |
| 60 | __u8 int_branch; |
| 61 | __u8 int_load; |
| 62 | __u8 int_interval; |
| 63 | __u8 state; |
| 64 | __u8 type; |
| 65 | __u16 last_iso; |
| 66 | struct ed *ed_rm_list; |
| 67 | |
| 68 | struct usb_device *usb_dev; |
Zhang Wei | 4dae14c | 2007-06-06 10:08:14 +0200 | [diff] [blame] | 69 | void *purb; |
| 70 | __u32 unused[2]; |
Hans de Goede | 8d005ef | 2015-05-05 23:56:13 +0200 | [diff] [blame] | 71 | } __attribute__((aligned(ED_ALIGNMENT))); |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 72 | typedef struct ed ed_t; |
| 73 | |
| 74 | |
| 75 | /* TD info field */ |
| 76 | #define TD_CC 0xf0000000 |
| 77 | #define TD_CC_GET(td_p) ((td_p >>28) & 0x0f) |
| 78 | #define TD_CC_SET(td_p, cc) (td_p) = ((td_p) & 0x0fffffff) | (((cc) & 0x0f) << 28) |
| 79 | #define TD_EC 0x0C000000 |
| 80 | #define TD_T 0x03000000 |
| 81 | #define TD_T_DATA0 0x02000000 |
| 82 | #define TD_T_DATA1 0x03000000 |
| 83 | #define TD_T_TOGGLE 0x00000000 |
| 84 | #define TD_R 0x00040000 |
| 85 | #define TD_DI 0x00E00000 |
| 86 | #define TD_DI_SET(X) (((X) & 0x07)<< 21) |
| 87 | #define TD_DP 0x00180000 |
| 88 | #define TD_DP_SETUP 0x00000000 |
| 89 | #define TD_DP_IN 0x00100000 |
| 90 | #define TD_DP_OUT 0x00080000 |
| 91 | |
| 92 | #define TD_ISO 0x00010000 |
| 93 | #define TD_DEL 0x00020000 |
| 94 | |
| 95 | /* CC Codes */ |
| 96 | #define TD_CC_NOERROR 0x00 |
| 97 | #define TD_CC_CRC 0x01 |
| 98 | #define TD_CC_BITSTUFFING 0x02 |
| 99 | #define TD_CC_DATATOGGLEM 0x03 |
| 100 | #define TD_CC_STALL 0x04 |
| 101 | #define TD_DEVNOTRESP 0x05 |
| 102 | #define TD_PIDCHECKFAIL 0x06 |
| 103 | #define TD_UNEXPECTEDPID 0x07 |
| 104 | #define TD_DATAOVERRUN 0x08 |
| 105 | #define TD_DATAUNDERRUN 0x09 |
| 106 | #define TD_BUFFEROVERRUN 0x0C |
| 107 | #define TD_BUFFERUNDERRUN 0x0D |
| 108 | #define TD_NOTACCESSED 0x0F |
| 109 | |
| 110 | |
| 111 | #define MAXPSW 1 |
| 112 | |
| 113 | struct td { |
| 114 | __u32 hwINFO; |
| 115 | __u32 hwCBP; /* Current Buffer Pointer */ |
| 116 | __u32 hwNextTD; /* Next TD Pointer */ |
| 117 | __u32 hwBE; /* Memory Buffer End Pointer */ |
| 118 | |
| 119 | __u16 hwPSW[MAXPSW]; |
| 120 | __u8 unused; |
| 121 | __u8 index; |
| 122 | struct ed *ed; |
| 123 | struct td *next_dl_td; |
| 124 | struct usb_device *usb_dev; |
| 125 | int transfer_len; |
| 126 | __u32 data; |
| 127 | |
| 128 | __u32 unused2[2]; |
Hans de Goede | 8d005ef | 2015-05-05 23:56:13 +0200 | [diff] [blame] | 129 | } __attribute__((aligned(TD_ALIGNMENT))); |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 130 | typedef struct td td_t; |
| 131 | |
| 132 | #define OHCI_ED_SKIP (1 << 14) |
| 133 | |
| 134 | /* |
| 135 | * The HCCA (Host Controller Communications Area) is a 256 byte |
| 136 | * structure defined in the OHCI spec. that the host controller is |
| 137 | * told the base address of. It must be 256-byte aligned. |
| 138 | */ |
| 139 | |
| 140 | #define NUM_INTS 32 /* part of the OHCI standard */ |
| 141 | struct ohci_hcca { |
| 142 | __u32 int_table[NUM_INTS]; /* Interrupt ED table */ |
| 143 | __u16 frame_no; /* current frame number */ |
| 144 | __u16 pad1; /* set to 0 on each frame_no change */ |
| 145 | __u32 done_head; /* info returned for an interrupt */ |
| 146 | u8 reserved_for_hc[116]; |
Peter Tyser | f9a109b | 2009-04-20 11:08:46 -0500 | [diff] [blame] | 147 | } __attribute__((aligned(256))); |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 148 | |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 149 | /* |
| 150 | * This is the structure of the OHCI controller's memory mapped I/O |
Becky Bruce | a5496a1 | 2010-06-30 13:05:44 -0500 | [diff] [blame] | 151 | * region. This is Memory Mapped I/O. You must use the ohci_readl() and |
| 152 | * ohci_writel() macros defined in this file to access these!! |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 153 | */ |
| 154 | struct ohci_regs { |
| 155 | /* control and status registers */ |
| 156 | __u32 revision; |
| 157 | __u32 control; |
| 158 | __u32 cmdstatus; |
| 159 | __u32 intrstatus; |
| 160 | __u32 intrenable; |
| 161 | __u32 intrdisable; |
| 162 | /* memory pointers */ |
| 163 | __u32 hcca; |
| 164 | __u32 ed_periodcurrent; |
| 165 | __u32 ed_controlhead; |
| 166 | __u32 ed_controlcurrent; |
| 167 | __u32 ed_bulkhead; |
| 168 | __u32 ed_bulkcurrent; |
| 169 | __u32 donehead; |
| 170 | /* frame counters */ |
| 171 | __u32 fminterval; |
| 172 | __u32 fmremaining; |
| 173 | __u32 fmnumber; |
| 174 | __u32 periodicstart; |
| 175 | __u32 lsthresh; |
| 176 | /* Root hub ports */ |
| 177 | struct ohci_roothub_regs { |
| 178 | __u32 a; |
| 179 | __u32 b; |
| 180 | __u32 status; |
Samuel Holland | f4917b4 | 2022-10-30 23:15:12 -0500 | [diff] [blame] | 181 | __u32 portstatus[]; |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 182 | } roothub; |
Peter Tyser | f9a109b | 2009-04-20 11:08:46 -0500 | [diff] [blame] | 183 | } __attribute__((aligned(32))); |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 184 | |
Yuri Tikhonov | e90fb6a | 2008-09-04 11:19:05 +0200 | [diff] [blame] | 185 | /* Some EHCI controls */ |
| 186 | #define EHCI_USBCMD_OFF 0x20 |
| 187 | #define EHCI_USBCMD_HCRESET (1 << 1) |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 188 | |
| 189 | /* OHCI CONTROL AND STATUS REGISTER MASKS */ |
| 190 | |
| 191 | /* |
| 192 | * HcControl (control) register masks |
| 193 | */ |
| 194 | #define OHCI_CTRL_CBSR (3 << 0) /* control/bulk service ratio */ |
| 195 | #define OHCI_CTRL_PLE (1 << 2) /* periodic list enable */ |
| 196 | #define OHCI_CTRL_IE (1 << 3) /* isochronous enable */ |
| 197 | #define OHCI_CTRL_CLE (1 << 4) /* control list enable */ |
| 198 | #define OHCI_CTRL_BLE (1 << 5) /* bulk list enable */ |
| 199 | #define OHCI_CTRL_HCFS (3 << 6) /* host controller functional state */ |
| 200 | #define OHCI_CTRL_IR (1 << 8) /* interrupt routing */ |
| 201 | #define OHCI_CTRL_RWC (1 << 9) /* remote wakeup connected */ |
| 202 | #define OHCI_CTRL_RWE (1 << 10) /* remote wakeup enable */ |
| 203 | |
| 204 | /* pre-shifted values for HCFS */ |
| 205 | # define OHCI_USB_RESET (0 << 6) |
| 206 | # define OHCI_USB_RESUME (1 << 6) |
| 207 | # define OHCI_USB_OPER (2 << 6) |
| 208 | # define OHCI_USB_SUSPEND (3 << 6) |
| 209 | |
| 210 | /* |
| 211 | * HcCommandStatus (cmdstatus) register masks |
| 212 | */ |
| 213 | #define OHCI_HCR (1 << 0) /* host controller reset */ |
| 214 | #define OHCI_CLF (1 << 1) /* control list filled */ |
| 215 | #define OHCI_BLF (1 << 2) /* bulk list filled */ |
| 216 | #define OHCI_OCR (1 << 3) /* ownership change request */ |
| 217 | #define OHCI_SOC (3 << 16) /* scheduling overrun count */ |
| 218 | |
| 219 | /* |
| 220 | * masks used with interrupt registers: |
| 221 | * HcInterruptStatus (intrstatus) |
| 222 | * HcInterruptEnable (intrenable) |
| 223 | * HcInterruptDisable (intrdisable) |
| 224 | */ |
| 225 | #define OHCI_INTR_SO (1 << 0) /* scheduling overrun */ |
| 226 | #define OHCI_INTR_WDH (1 << 1) /* writeback of done_head */ |
| 227 | #define OHCI_INTR_SF (1 << 2) /* start frame */ |
| 228 | #define OHCI_INTR_RD (1 << 3) /* resume detect */ |
| 229 | #define OHCI_INTR_UE (1 << 4) /* unrecoverable error */ |
| 230 | #define OHCI_INTR_FNO (1 << 5) /* frame number overflow */ |
| 231 | #define OHCI_INTR_RHSC (1 << 6) /* root hub status change */ |
| 232 | #define OHCI_INTR_OC (1 << 30) /* ownership change */ |
| 233 | #define OHCI_INTR_MIE (1 << 31) /* master interrupt enable */ |
| 234 | |
| 235 | |
| 236 | /* Virtual Root HUB */ |
| 237 | struct virt_root_hub { |
| 238 | int devnum; /* Address of Root Hub endpoint */ |
| 239 | void *dev; /* was urb */ |
| 240 | void *int_addr; |
| 241 | int send; |
| 242 | int interval; |
| 243 | }; |
| 244 | |
| 245 | /* USB HUB CONSTANTS (not OHCI-specific; see hub.h) */ |
| 246 | |
| 247 | /* destination of request */ |
| 248 | #define RH_INTERFACE 0x01 |
| 249 | #define RH_ENDPOINT 0x02 |
| 250 | #define RH_OTHER 0x03 |
| 251 | |
| 252 | #define RH_CLASS 0x20 |
| 253 | #define RH_VENDOR 0x40 |
| 254 | |
| 255 | /* Requests: bRequest << 8 | bmRequestType */ |
| 256 | #define RH_GET_STATUS 0x0080 |
| 257 | #define RH_CLEAR_FEATURE 0x0100 |
| 258 | #define RH_SET_FEATURE 0x0300 |
| 259 | #define RH_SET_ADDRESS 0x0500 |
| 260 | #define RH_GET_DESCRIPTOR 0x0680 |
| 261 | #define RH_SET_DESCRIPTOR 0x0700 |
| 262 | #define RH_GET_CONFIGURATION 0x0880 |
| 263 | #define RH_SET_CONFIGURATION 0x0900 |
| 264 | #define RH_GET_STATE 0x0280 |
| 265 | #define RH_GET_INTERFACE 0x0A80 |
| 266 | #define RH_SET_INTERFACE 0x0B00 |
| 267 | #define RH_SYNC_FRAME 0x0C80 |
| 268 | /* Our Vendor Specific Request */ |
| 269 | #define RH_SET_EP 0x2000 |
| 270 | |
| 271 | |
| 272 | /* Hub port features */ |
| 273 | #define RH_PORT_CONNECTION 0x00 |
| 274 | #define RH_PORT_ENABLE 0x01 |
| 275 | #define RH_PORT_SUSPEND 0x02 |
| 276 | #define RH_PORT_OVER_CURRENT 0x03 |
| 277 | #define RH_PORT_RESET 0x04 |
| 278 | #define RH_PORT_POWER 0x08 |
| 279 | #define RH_PORT_LOW_SPEED 0x09 |
| 280 | |
| 281 | #define RH_C_PORT_CONNECTION 0x10 |
| 282 | #define RH_C_PORT_ENABLE 0x11 |
| 283 | #define RH_C_PORT_SUSPEND 0x12 |
| 284 | #define RH_C_PORT_OVER_CURRENT 0x13 |
| 285 | #define RH_C_PORT_RESET 0x14 |
| 286 | |
| 287 | /* Hub features */ |
| 288 | #define RH_C_HUB_LOCAL_POWER 0x00 |
| 289 | #define RH_C_HUB_OVER_CURRENT 0x01 |
| 290 | |
| 291 | #define RH_DEVICE_REMOTE_WAKEUP 0x00 |
| 292 | #define RH_ENDPOINT_STALL 0x01 |
| 293 | |
| 294 | #define RH_ACK 0x01 |
| 295 | #define RH_REQ_ERR -1 |
| 296 | #define RH_NACK 0x00 |
| 297 | |
| 298 | |
| 299 | /* OHCI ROOT HUB REGISTER MASKS */ |
| 300 | |
| 301 | /* roothub.portstatus [i] bits */ |
| 302 | #define RH_PS_CCS 0x00000001 /* current connect status */ |
| 303 | #define RH_PS_PES 0x00000002 /* port enable status*/ |
| 304 | #define RH_PS_PSS 0x00000004 /* port suspend status */ |
| 305 | #define RH_PS_POCI 0x00000008 /* port over current indicator */ |
| 306 | #define RH_PS_PRS 0x00000010 /* port reset status */ |
| 307 | #define RH_PS_PPS 0x00000100 /* port power status */ |
| 308 | #define RH_PS_LSDA 0x00000200 /* low speed device attached */ |
| 309 | #define RH_PS_CSC 0x00010000 /* connect status change */ |
| 310 | #define RH_PS_PESC 0x00020000 /* port enable status change */ |
| 311 | #define RH_PS_PSSC 0x00040000 /* port suspend status change */ |
| 312 | #define RH_PS_OCIC 0x00080000 /* over current indicator change */ |
| 313 | #define RH_PS_PRSC 0x00100000 /* port reset status change */ |
| 314 | |
| 315 | /* roothub.status bits */ |
| 316 | #define RH_HS_LPS 0x00000001 /* local power status */ |
| 317 | #define RH_HS_OCI 0x00000002 /* over current indicator */ |
| 318 | #define RH_HS_DRWE 0x00008000 /* device remote wakeup enable */ |
| 319 | #define RH_HS_LPSC 0x00010000 /* local power status change */ |
| 320 | #define RH_HS_OCIC 0x00020000 /* over current indicator change */ |
| 321 | #define RH_HS_CRWE 0x80000000 /* clear remote wakeup enable */ |
| 322 | |
| 323 | /* roothub.b masks */ |
| 324 | #define RH_B_DR 0x0000ffff /* device removable flags */ |
| 325 | #define RH_B_PPCM 0xffff0000 /* port power control mask */ |
| 326 | |
| 327 | /* roothub.a masks */ |
| 328 | #define RH_A_NDP (0xff << 0) /* number of downstream ports */ |
| 329 | #define RH_A_PSM (1 << 8) /* power switching mode */ |
| 330 | #define RH_A_NPS (1 << 9) /* no power switching */ |
| 331 | #define RH_A_DT (1 << 10) /* device type (mbz) */ |
| 332 | #define RH_A_OCPM (1 << 11) /* over current protection mode */ |
| 333 | #define RH_A_NOCP (1 << 12) /* no over current protection */ |
| 334 | #define RH_A_POTPGT (0xff << 24) /* power on to power good time */ |
| 335 | |
| 336 | /* urb */ |
| 337 | #define N_URB_TD 48 |
| 338 | typedef struct |
| 339 | { |
| 340 | ed_t *ed; |
| 341 | __u16 length; /* number of tds associated with this request */ |
| 342 | __u16 td_cnt; /* number of tds already serviced */ |
Zhang Wei | 4dae14c | 2007-06-06 10:08:14 +0200 | [diff] [blame] | 343 | struct usb_device *dev; |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 344 | int state; |
| 345 | unsigned long pipe; |
Zhang Wei | 4dae14c | 2007-06-06 10:08:14 +0200 | [diff] [blame] | 346 | void *transfer_buffer; |
| 347 | int transfer_buffer_length; |
| 348 | int interval; |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 349 | int actual_length; |
Zhang Wei | 4dae14c | 2007-06-06 10:08:14 +0200 | [diff] [blame] | 350 | int finished; |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 351 | td_t *td[N_URB_TD]; /* list pointer to all corresponding TDs associated with this request */ |
| 352 | } urb_priv_t; |
| 353 | #define URB_DEL 1 |
| 354 | |
Zeng Tao | 11080bf | 2018-06-29 01:54:19 +0800 | [diff] [blame] | 355 | #define NUM_EDS 32 /* num of preallocated endpoint descriptors */ |
Hans de Goede | 19d95d5 | 2015-05-05 23:56:08 +0200 | [diff] [blame] | 356 | |
Hans de Goede | 3c5497d | 2015-05-05 23:56:09 +0200 | [diff] [blame] | 357 | #define NUM_TD 64 /* we need more TDs than EDs */ |
| 358 | |
Hans de Goede | 44dbc33 | 2015-05-13 14:42:15 +0200 | [diff] [blame] | 359 | #define NUM_INT_DEVS 8 /* num of ohci_dev structs for int endpoints */ |
| 360 | |
Hans de Goede | 19d95d5 | 2015-05-05 23:56:08 +0200 | [diff] [blame] | 361 | typedef struct ohci_device { |
Hans de Goede | 8d005ef | 2015-05-05 23:56:13 +0200 | [diff] [blame] | 362 | ed_t ed[NUM_EDS] __aligned(ED_ALIGNMENT); |
| 363 | td_t tds[NUM_TD] __aligned(TD_ALIGNMENT); |
Hans de Goede | 19d95d5 | 2015-05-05 23:56:08 +0200 | [diff] [blame] | 364 | int ed_cnt; |
Hans de Goede | 44dbc33 | 2015-05-13 14:42:15 +0200 | [diff] [blame] | 365 | int devnum; |
Hans de Goede | 19d95d5 | 2015-05-05 23:56:08 +0200 | [diff] [blame] | 366 | } ohci_dev_t; |
| 367 | |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 368 | /* |
| 369 | * This is the full ohci controller description |
| 370 | * |
| 371 | * Note how the "proper" USB information is just |
| 372 | * a subset of what the full implementation needs. (Linus) |
| 373 | */ |
| 374 | |
| 375 | |
| 376 | typedef struct ohci { |
Hans de Goede | 19d95d5 | 2015-05-05 23:56:08 +0200 | [diff] [blame] | 377 | /* this allocates EDs for all possible endpoints */ |
Hans de Goede | 8d005ef | 2015-05-05 23:56:13 +0200 | [diff] [blame] | 378 | struct ohci_device ohci_dev __aligned(TD_ALIGNMENT); |
Hans de Goede | 44dbc33 | 2015-05-13 14:42:15 +0200 | [diff] [blame] | 379 | struct ohci_device int_dev[NUM_INT_DEVS] __aligned(TD_ALIGNMENT); |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 380 | struct ohci_hcca *hcca; /* hcca */ |
| 381 | /*dma_addr_t hcca_dma;*/ |
| 382 | |
| 383 | int irq; |
| 384 | int disabled; /* e.g. got a UE, we're hung */ |
| 385 | int sleeping; |
| 386 | unsigned long flags; /* for HC bugs */ |
| 387 | |
| 388 | struct ohci_regs *regs; /* OHCI controller's memory */ |
| 389 | |
Zhang Wei | 4dae14c | 2007-06-06 10:08:14 +0200 | [diff] [blame] | 390 | int ohci_int_load[32]; /* load of the 32 Interrupt Chains (for load balancing)*/ |
Markus Klotzbuecher | 3e326ec | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 391 | ed_t *ed_rm_list[2]; /* lists of all endpoints to be removed */ |
| 392 | ed_t *ed_bulktail; /* last endpoint of bulk list */ |
| 393 | ed_t *ed_controltail; /* last endpoint of control list */ |
| 394 | int intrstatus; |
| 395 | __u32 hc_control; /* copy of the hc control reg */ |
| 396 | struct usb_device *dev[32]; |
| 397 | struct virt_root_hub rh; |
| 398 | |
| 399 | const char *slot_name; |
| 400 | } ohci_t; |
Hans de Goede | 58b4048 | 2015-05-10 14:10:25 +0200 | [diff] [blame] | 401 | |
Sven Schwermer | fd09c20 | 2018-11-21 08:43:56 +0100 | [diff] [blame] | 402 | #if CONFIG_IS_ENABLED(DM_USB) |
Hans de Goede | 58b4048 | 2015-05-10 14:10:25 +0200 | [diff] [blame] | 403 | extern struct dm_usb_ops ohci_usb_ops; |
| 404 | |
| 405 | int ohci_register(struct udevice *dev, struct ohci_regs *regs); |
| 406 | int ohci_deregister(struct udevice *dev); |
| 407 | #endif |