1 /* 2 * Dongle BUS interface Abstraction layer 3 * target serial buses like USB, SDIO, SPI, etc. 4 * 5 * Portions of this code are copyright (c) 2021 Cypress Semiconductor Corporation 6 * 7 * Copyright (C) 1999-2017, Broadcom Corporation 8 * 9 * Unless you and Broadcom execute a separate written software license 10 * agreement governing use of this software, this software is licensed to you 11 * under the terms of the GNU General Public License version 2 (the "GPL"), 12 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 13 * following added to such license: 14 * 15 * As a special exception, the copyright holders of this software give you 16 * permission to link this software with independent modules, and to copy and 17 * distribute the resulting executable under terms of your choice, provided that 18 * you also meet, for each linked independent module, the terms and conditions of 19 * the license of that module. An independent module is a module which is not 20 * derived from this software. The special exception does not apply to any 21 * modifications of the software. 22 * 23 * Notwithstanding the above, under no circumstances may you combine this 24 * software in any way with any other Broadcom software provided under a license 25 * other than the GPL, without Broadcom's express prior written consent. 26 * 27 * 28 * <<Broadcom-WL-IPTag/Open:>> 29 * 30 * $Id: dbus.h 686618 2017-02-23 07:20:43Z $ 31 */ 32 33 #ifndef __DBUS_H__ 34 #define __DBUS_H__ 35 36 #include "typedefs.h" 37 38 #define DBUSTRACE(args) 39 #define DBUSERR(args) 40 #define DBUSINFO(args) 41 #define DBUSDBGLOCK(args) 42 43 enum { 44 DBUS_OK = 0, 45 DBUS_ERR = -200, 46 DBUS_ERR_TIMEOUT, 47 DBUS_ERR_DISCONNECT, 48 DBUS_ERR_NODEVICE, 49 DBUS_ERR_UNSUPPORTED, 50 DBUS_ERR_PENDING, 51 DBUS_ERR_NOMEM, 52 DBUS_ERR_TXFAIL, 53 DBUS_ERR_TXTIMEOUT, 54 DBUS_ERR_TXDROP, 55 DBUS_ERR_RXFAIL, 56 DBUS_ERR_RXDROP, 57 DBUS_ERR_TXCTLFAIL, 58 DBUS_ERR_RXCTLFAIL, 59 DBUS_ERR_REG_PARAM, 60 DBUS_STATUS_CANCELLED, 61 DBUS_ERR_NVRAM, 62 DBUS_JUMBO_NOMATCH, 63 DBUS_JUMBO_BAD_FORMAT, 64 DBUS_NVRAM_NONTXT, 65 DBUS_ERR_RXZLP 66 }; 67 68 #define BCM_OTP_SIZE_43236 84 /* number of 16 bit values */ 69 #define BCM_OTP_SW_RGN_43236 24 /* start offset of SW config region */ 70 #define BCM_OTP_ADDR_43236 0x18000800 /* address of otp base */ 71 72 #define ERR_CBMASK_TXFAIL 0x00000001 73 #define ERR_CBMASK_RXFAIL 0x00000002 74 #define ERR_CBMASK_ALL 0xFFFFFFFF 75 76 #define DBUS_CBCTL_WRITE 0 77 #define DBUS_CBCTL_READ 1 78 #if defined(INTR_EP_ENABLE) 79 #define DBUS_CBINTR_POLL 2 80 #endif /* defined(INTR_EP_ENABLE) */ 81 82 #define DBUS_TX_RETRY_LIMIT 3 /* retries for failed txirb */ 83 #define DBUS_TX_TIMEOUT_INTERVAL 250 /* timeout for txirb complete, in ms */ 84 85 #define DBUS_BUFFER_SIZE_TX 32000 86 #define DBUS_BUFFER_SIZE_RX 24000 87 88 #define DBUS_BUFFER_SIZE_TX_NOAGG 2048 89 #define DBUS_BUFFER_SIZE_RX_NOAGG 2048 90 91 /** DBUS types */ 92 enum { 93 DBUS_USB, 94 DBUS_SDIO, 95 DBUS_SPI, 96 DBUS_UNKNOWN 97 }; 98 99 enum dbus_state { 100 DBUS_STATE_DL_PENDING, 101 DBUS_STATE_DL_DONE, 102 DBUS_STATE_UP, 103 DBUS_STATE_DOWN, 104 DBUS_STATE_PNP_FWDL, 105 DBUS_STATE_DISCONNECT, 106 DBUS_STATE_SLEEP, 107 DBUS_STATE_DL_NEEDED 108 }; 109 110 enum dbus_pnp_state { 111 DBUS_PNP_DISCONNECT, 112 DBUS_PNP_SLEEP, 113 DBUS_PNP_RESUME 114 }; 115 116 enum dbus_file { 117 DBUS_FIRMWARE, 118 DBUS_NVFILE 119 }; 120 121 typedef enum _DEVICE_SPEED { 122 INVALID_SPEED = -1, 123 LOW_SPEED = 1, /**< USB 1.1: 1.5 Mbps */ 124 FULL_SPEED, /**< USB 1.1: 12 Mbps */ 125 HIGH_SPEED, /**< USB 2.0: 480 Mbps */ 126 SUPER_SPEED, /**< USB 3.0: 4.8 Gbps */ 127 } DEVICE_SPEED; 128 129 typedef struct { 130 int bustype; 131 int vid; 132 int pid; 133 int devid; 134 int chiprev; /**< chip revsion number */ 135 int mtu; 136 int nchan; /**< Data Channels */ 137 int has_2nd_bulk_in_ep; 138 } dbus_attrib_t; 139 140 /* FIX: Account for errors related to DBUS; 141 * Let upper layer account for packets/bytes 142 */ 143 typedef struct { 144 uint32 rx_errors; 145 uint32 tx_errors; 146 uint32 rx_dropped; 147 uint32 tx_dropped; 148 } dbus_stats_t; 149 150 /** 151 * Configurable BUS parameters 152 */ 153 enum { 154 DBUS_CONFIG_ID_RXCTL_DEFERRES = 1, 155 DBUS_CONFIG_ID_AGGR_LIMIT, 156 DBUS_CONFIG_ID_KEEPIF_ON_DEVRESET 157 }; 158 159 typedef struct { 160 uint32 config_id; 161 union { 162 uint32 general_param; 163 bool rxctl_deferrespok; 164 struct { 165 int maxrxsf; 166 int maxrxsize; 167 int maxtxsf; 168 int maxtxsize; 169 } aggr_param; 170 }; 171 } dbus_config_t; 172 173 /** 174 * External Download Info 175 */ 176 typedef struct dbus_extdl { 177 uint8 *fw; 178 int fwlen; 179 uint8 *vars; 180 int varslen; 181 } dbus_extdl_t; 182 183 struct dbus_callbacks; 184 struct exec_parms; 185 186 typedef void *(*probe_cb_t)(void *arg, const char *desc, uint32 bustype, uint32 hdrlen); 187 typedef void (*disconnect_cb_t)(void *arg); 188 typedef void *(*exec_cb_t)(struct exec_parms *args); 189 190 /** Client callbacks registered during dbus_attach() */ 191 typedef struct dbus_callbacks { 192 void (*send_complete)(void *cbarg, void *info, int status); 193 void (*recv_buf)(void *cbarg, uint8 *buf, int len); 194 void (*recv_pkt)(void *cbarg, void *pkt); 195 void (*txflowcontrol)(void *cbarg, bool onoff); 196 void (*errhandler)(void *cbarg, int err); 197 void (*ctl_complete)(void *cbarg, int type, int status); 198 void (*state_change)(void *cbarg, int state); 199 void *(*pktget)(void *cbarg, uint len, bool send); 200 void (*pktfree)(void *cbarg, void *p, bool send); 201 } dbus_callbacks_t; 202 203 struct dbus_pub; 204 struct bcmstrbuf; 205 struct dbus_irb; 206 struct dbus_irb_rx; 207 struct dbus_irb_tx; 208 struct dbus_intf_callbacks; 209 210 typedef struct { 211 void* (*attach)(struct dbus_pub *pub, void *cbarg, struct dbus_intf_callbacks *cbs); 212 void (*detach)(struct dbus_pub *pub, void *bus); 213 214 int (*up)(void *bus); 215 int (*down)(void *bus); 216 int (*send_irb)(void *bus, struct dbus_irb_tx *txirb); 217 int (*recv_irb)(void *bus, struct dbus_irb_rx *rxirb); 218 int (*cancel_irb)(void *bus, struct dbus_irb_tx *txirb); 219 int (*send_ctl)(void *bus, uint8 *buf, int len); 220 int (*recv_ctl)(void *bus, uint8 *buf, int len); 221 int (*get_stats)(void *bus, dbus_stats_t *stats); 222 int (*get_attrib)(void *bus, dbus_attrib_t *attrib); 223 224 int (*pnp)(void *bus, int evnt); 225 int (*remove)(void *bus); 226 int (*resume)(void *bus); 227 int (*suspend)(void *bus); 228 int (*stop)(void *bus); 229 int (*reset)(void *bus); 230 231 /* Access to bus buffers directly */ 232 void *(*pktget)(void *bus, int len); 233 void (*pktfree)(void *bus, void *pkt); 234 235 int (*iovar_op)(void *bus, const char *name, void *params, int plen, void *arg, int len, 236 bool set); 237 void (*dump)(void *bus, struct bcmstrbuf *strbuf); 238 int (*set_config)(void *bus, dbus_config_t *config); 239 int (*get_config)(void *bus, dbus_config_t *config); 240 241 bool (*device_exists)(void *bus); 242 bool (*dlneeded)(void *bus); 243 int (*dlstart)(void *bus, uint8 *fw, int len); 244 int (*dlrun)(void *bus); 245 bool (*recv_needed)(void *bus); 246 247 void *(*exec_rxlock)(void *bus, exec_cb_t func, struct exec_parms *args); 248 void *(*exec_txlock)(void *bus, exec_cb_t func, struct exec_parms *args); 249 250 int (*tx_timer_init)(void *bus); 251 int (*tx_timer_start)(void *bus, uint timeout); 252 int (*tx_timer_stop)(void *bus); 253 254 int (*sched_dpc)(void *bus); 255 int (*lock)(void *bus); 256 int (*unlock)(void *bus); 257 int (*sched_probe_cb)(void *bus); 258 259 int (*shutdown)(void *bus); 260 261 int (*recv_stop)(void *bus); 262 int (*recv_resume)(void *bus); 263 264 int (*recv_irb_from_ep)(void *bus, struct dbus_irb_rx *rxirb, uint ep_idx); 265 266 int (*readreg)(void *bus, uint32 regaddr, int datalen, uint32 *value); 267 268 /* Add from the bottom */ 269 } dbus_intf_t; 270 271 typedef struct dbus_pub { 272 struct osl_info *osh; 273 dbus_stats_t stats; 274 dbus_attrib_t attrib; 275 enum dbus_state busstate; 276 DEVICE_SPEED device_speed; 277 int ntxq, nrxq, rxsize; 278 void *bus; 279 struct shared_info *sh; 280 void *dev_info; 281 } dbus_pub_t; 282 283 #define BUS_INFO(bus, type) (((type *) bus)->pub->bus) 284 285 #define ALIGNED_LOCAL_VARIABLE(var, align) \ 286 uint8 buffer[SDALIGN+64]; \ 287 uint8 *var = (uint8 *)(((uintptr)&buffer[0]) & ~(align-1)) + align; 288 289 /* 290 * Public Bus Function Interface 291 */ 292 293 /* 294 * FIX: Is there better way to pass OS/Host handles to DBUS but still 295 * maintain common interface for all OS?? 296 * Under NDIS, param1 needs to be MiniportHandle 297 * For NDIS60, param2 is WdfDevice 298 * Under Linux, param1 and param2 are NULL; 299 */ 300 extern int dbus_register(int vid, int pid, probe_cb_t prcb, disconnect_cb_t discb, void *prarg, 301 void *param1, void *param2); 302 extern int dbus_deregister(void); 303 304 extern dbus_pub_t *dbus_attach(struct osl_info *osh, int rxsize, int nrxq, int ntxq, 305 void *cbarg, dbus_callbacks_t *cbs, dbus_extdl_t *extdl, struct shared_info *sh); 306 extern void dbus_detach(dbus_pub_t *pub); 307 308 extern int dbus_download_firmware(dbus_pub_t *pub); 309 extern int dbus_up(dbus_pub_t *pub); 310 extern int dbus_down(dbus_pub_t *pub); 311 extern int dbus_stop(dbus_pub_t *pub); 312 extern int dbus_shutdown(dbus_pub_t *pub); 313 extern void dbus_flowctrl_rx(dbus_pub_t *pub, bool on); 314 315 extern int dbus_send_txdata(dbus_pub_t *dbus, void *pktbuf); 316 extern int dbus_send_buf(dbus_pub_t *pub, uint8 *buf, int len, void *info); 317 extern int dbus_send_pkt(dbus_pub_t *pub, void *pkt, void *info); 318 extern int dbus_send_ctl(dbus_pub_t *pub, uint8 *buf, int len); 319 extern int dbus_recv_ctl(dbus_pub_t *pub, uint8 *buf, int len); 320 extern int dbus_recv_bulk(dbus_pub_t *pub, uint32 ep_idx); 321 extern int dbus_poll_intr(dbus_pub_t *pub); 322 extern int dbus_get_stats(dbus_pub_t *pub, dbus_stats_t *stats); 323 extern int dbus_get_attrib(dbus_pub_t *pub, dbus_attrib_t *attrib); 324 extern int dbus_get_device_speed(dbus_pub_t *pub); 325 extern int dbus_set_config(dbus_pub_t *pub, dbus_config_t *config); 326 extern int dbus_get_config(dbus_pub_t *pub, dbus_config_t *config); 327 extern void * dbus_get_devinfo(dbus_pub_t *pub); 328 329 extern void *dbus_pktget(dbus_pub_t *pub, int len); 330 extern void dbus_pktfree(dbus_pub_t *pub, void* pkt); 331 332 extern int dbus_set_errmask(dbus_pub_t *pub, uint32 mask); 333 extern int dbus_pnp_sleep(dbus_pub_t *pub); 334 extern int dbus_pnp_resume(dbus_pub_t *pub, int *fw_reload); 335 extern int dbus_pnp_disconnect(dbus_pub_t *pub); 336 337 extern int dbus_iovar_op(dbus_pub_t *pub, const char *name, 338 void *params, int plen, void *arg, int len, bool set); 339 340 extern void *dhd_dbus_txq(const dbus_pub_t *pub); 341 extern uint dhd_dbus_hdrlen(const dbus_pub_t *pub); 342 343 /* 344 * Private Common Bus Interface 345 */ 346 347 /** IO Request Block (IRB) */ 348 typedef struct dbus_irb { 349 struct dbus_irb *next; /**< it's casted from dbus_irb_tx or dbus_irb_rx struct */ 350 } dbus_irb_t; 351 352 typedef struct dbus_irb_rx { 353 struct dbus_irb irb; /* Must be first */ 354 uint8 *buf; 355 int buf_len; 356 int actual_len; 357 void *pkt; 358 void *info; 359 void *arg; 360 } dbus_irb_rx_t; 361 362 typedef struct dbus_irb_tx { 363 struct dbus_irb irb; /** Must be first */ 364 uint8 *buf; /** mutually exclusive with struct member 'pkt' */ 365 int len; /** length of field 'buf' */ 366 void *pkt; /** mutually exclusive with struct member 'buf' */ 367 int retry_count; 368 void *info; 369 void *arg; 370 void *send_buf; /**< linear bufffer for LINUX when aggreagtion is enabled */ 371 } dbus_irb_tx_t; 372 373 /** 374 * DBUS interface callbacks are different from user callbacks 375 * so, internally, different info can be passed to upper layer 376 */ 377 typedef struct dbus_intf_callbacks { 378 void (*send_irb_timeout)(void *cbarg, dbus_irb_tx_t *txirb); 379 void (*send_irb_complete)(void *cbarg, dbus_irb_tx_t *txirb, int status); 380 void (*recv_irb_complete)(void *cbarg, dbus_irb_rx_t *rxirb, int status); 381 void (*errhandler)(void *cbarg, int err); 382 void (*ctl_complete)(void *cbarg, int type, int status); 383 void (*state_change)(void *cbarg, int state); 384 bool (*isr)(void *cbarg, bool *wantdpc); 385 bool (*dpc)(void *cbarg, bool bounded); 386 void (*watchdog)(void *cbarg); 387 void *(*pktget)(void *cbarg, uint len, bool send); 388 void (*pktfree)(void *cbarg, void *p, bool send); 389 struct dbus_irb* (*getirb)(void *cbarg, bool send); 390 void (*rxerr_indicate)(void *cbarg, bool on); 391 } dbus_intf_callbacks_t; 392 393 /* 394 * Porting: To support new bus, port these functions below 395 */ 396 397 /* 398 * Bus specific Interface 399 * Implemented by dbus_usb.c/dbus_sdio.c 400 */ 401 extern int dbus_bus_register(int vid, int pid, probe_cb_t prcb, disconnect_cb_t discb, void *prarg, 402 dbus_intf_t **intf, void *param1, void *param2); 403 extern int dbus_bus_deregister(void); 404 extern void dbus_bus_fw_get(void *bus, uint8 **fw, int *fwlen, int *decomp); 405 406 /* 407 * Bus-specific and OS-specific Interface 408 * Implemented by dbus_usb_[linux/ndis].c/dbus_sdio_[linux/ndis].c 409 */ 410 extern int dbus_bus_osl_register(int vid, int pid, probe_cb_t prcb, disconnect_cb_t discb, 411 void *prarg, dbus_intf_t **intf, void *param1, void *param2); 412 extern int dbus_bus_osl_deregister(void); 413 414 /* 415 * Bus-specific, OS-specific, HW-specific Interface 416 * Mainly for SDIO Host HW controller 417 */ 418 extern int dbus_bus_osl_hw_register(int vid, int pid, probe_cb_t prcb, disconnect_cb_t discb, 419 void *prarg, dbus_intf_t **intf); 420 extern int dbus_bus_osl_hw_deregister(void); 421 422 extern uint usbdev_bulkin_eps(void); 423 #if defined(BCM_REQUEST_FW) 424 extern void *dbus_get_fw_nvfile(int devid, int chiprev, uint8 **fw, int *fwlen, int type, 425 uint16 boardtype, uint16 boardrev); 426 extern void dbus_release_fw_nvfile(void *firmware); 427 #endif /* #if defined(BCM_REQUEST_FW) */ 428 429 #if defined(EHCI_FASTPATH_TX) || defined(EHCI_FASTPATH_RX) 430 431 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) 432 /* Backward compatibility */ 433 typedef unsigned int gfp_t; 434 435 #define dma_pool pci_pool 436 #define dma_pool_create(name, dev, size, align, alloc) \ 437 pci_pool_create(name, dev, size, align, alloc, GFP_DMA | GFP_ATOMIC) 438 #define dma_pool_destroy(pool) pci_pool_destroy(pool) 439 #define dma_pool_alloc(pool, flags, handle) pci_pool_alloc(pool, flags, handle) 440 #define dma_pool_free(pool, vaddr, addr) pci_pool_free(pool, vaddr, addr) 441 442 #define dma_map_single(dev, addr, size, dir) pci_map_single(dev, addr, size, dir) 443 #define dma_unmap_single(dev, hnd, size, dir) pci_unmap_single(dev, hnd, size, dir) 444 #define DMA_FROM_DEVICE PCI_DMA_FROMDEVICE 445 #define DMA_TO_DEVICE PCI_DMA_TODEVICE 446 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) */ 447 448 /* Availability of these functions varies (when present, they have two arguments) */ 449 #ifndef hc32_to_cpu 450 #define hc32_to_cpu(x) le32_to_cpu(x) 451 #define cpu_to_hc32(x) cpu_to_le32(x) 452 typedef unsigned int __hc32; 453 #else 454 #error Two-argument functions needed 455 #endif // endif 456 457 /* Private USB opcode base */ 458 #define EHCI_FASTPATH 0x31 459 #define EHCI_SET_EP_BYPASS EHCI_FASTPATH 460 #define EHCI_SET_BYPASS_CB (EHCI_FASTPATH + 1) 461 #define EHCI_SET_BYPASS_DEV (EHCI_FASTPATH + 2) 462 #define EHCI_DUMP_STATE (EHCI_FASTPATH + 3) 463 #define EHCI_SET_BYPASS_POOL (EHCI_FASTPATH + 4) 464 #define EHCI_CLR_EP_BYPASS (EHCI_FASTPATH + 5) 465 466 /* 467 * EHCI QTD structure (hardware and extension) 468 * NOTE that is does not need to (and does not) match its kernel counterpart 469 */ 470 #define EHCI_QTD_NBUFFERS 5 471 #define EHCI_QTD_ALIGN 32 472 #define EHCI_BULK_PACKET_SIZE 512 473 #define EHCI_QTD_XACTERR_MAX 32 474 475 struct ehci_qtd { 476 /* Hardware map */ 477 volatile uint32_t qtd_next; 478 volatile uint32_t qtd_altnext; 479 volatile uint32_t qtd_status; 480 #define EHCI_QTD_GET_BYTES(x) (((x)>>16) & 0x7fff) 481 #define EHCI_QTD_IOC 0x00008000 482 #define EHCI_QTD_GET_CERR(x) (((x)>>10) & 0x3) 483 #define EHCI_QTD_SET_CERR(x) ((x) << 10) 484 #define EHCI_QTD_GET_PID(x) (((x)>>8) & 0x3) 485 #define EHCI_QTD_SET_PID(x) ((x) << 8) 486 #define EHCI_QTD_ACTIVE 0x80 487 #define EHCI_QTD_HALTED 0x40 488 #define EHCI_QTD_BUFERR 0x20 489 #define EHCI_QTD_BABBLE 0x10 490 #define EHCI_QTD_XACTERR 0x08 491 #define EHCI_QTD_MISSEDMICRO 0x04 492 volatile uint32_t qtd_buffer[EHCI_QTD_NBUFFERS]; 493 volatile uint32_t qtd_buffer_hi[EHCI_QTD_NBUFFERS]; 494 495 /* Implementation extension */ 496 dma_addr_t qtd_self; /**< own hardware address */ 497 struct ehci_qtd *obj_next; /**< software link to the next QTD */ 498 void *rpc; /**< pointer to the rpc buffer */ 499 size_t length; /**< length of the data in the buffer */ 500 void *buff; /**< pointer to the reassembly buffer */ 501 int xacterrs; /**< retry counter for qtd xact error */ 502 } __attribute__ ((aligned(EHCI_QTD_ALIGN))); 503 504 #define EHCI_NULL __constant_cpu_to_le32(1) /* HW null pointer shall be odd */ 505 506 #define SHORT_READ_Q(token) (EHCI_QTD_GET_BYTES(token) != 0 && EHCI_QTD_GET_PID(token) == 1) 507 508 /** 509 * Queue Head 510 * NOTE This structure is slightly different from the one in the kernel; but needs to stay 511 * compatible. 512 */ 513 struct ehci_qh { 514 /* Hardware map */ 515 volatile uint32_t qh_link; 516 volatile uint32_t qh_endp; 517 volatile uint32_t qh_endphub; 518 volatile uint32_t qh_curqtd; 519 520 /* QTD overlay */ 521 volatile uint32_t ow_next; 522 volatile uint32_t ow_altnext; 523 volatile uint32_t ow_status; 524 volatile uint32_t ow_buffer [EHCI_QTD_NBUFFERS]; 525 volatile uint32_t ow_buffer_hi [EHCI_QTD_NBUFFERS]; 526 527 /* Extension (should match the kernel layout) */ 528 dma_addr_t unused0; 529 void *unused1; 530 struct list_head unused2; 531 struct ehci_qtd *dummy; 532 struct ehci_qh *unused3; 533 534 struct ehci_hcd *unused4; 535 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) 536 struct kref unused5; 537 unsigned unused6; 538 539 uint8_t unused7; 540 541 /* periodic schedule info */ 542 uint8_t unused8; 543 uint8_t unused9; 544 uint8_t unused10; 545 uint16_t unused11; 546 uint16_t unused12; 547 uint16_t unused13; 548 struct usb_device *unused14; 549 #else 550 unsigned unused5; 551 552 u8 unused6; 553 554 /* periodic schedule info */ 555 u8 unused7; 556 u8 unused8; 557 u8 unused9; 558 unsigned short unused10; 559 unsigned short unused11; 560 #define NO_FRAME ((unsigned short)~0) 561 #ifdef EHCI_QUIRK_FIX 562 struct usb_device *unused12; 563 #endif /* EHCI_QUIRK_FIX */ 564 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) */ 565 struct ehci_qtd *first_qtd; 566 /* Link to the first QTD; this is an optimized equivalent of the qtd_list field */ 567 /* NOTE that ehci_qh in ehci.h shall reserve this word */ 568 } __attribute__ ((aligned(EHCI_QTD_ALIGN))); 569 570 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) 571 /** The corresponding structure in the kernel is used to get the QH */ 572 struct hcd_dev { /* usb_device.hcpriv points to this */ 573 struct list_head unused0; 574 struct list_head unused1; 575 576 /* array of QH pointers */ 577 void *ep[32]; 578 }; 579 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) */ 580 581 int optimize_qtd_fill_with_rpc(const dbus_pub_t *pub, int epn, struct ehci_qtd *qtd, void *rpc, 582 int token, int len); 583 int optimize_qtd_fill_with_data(const dbus_pub_t *pub, int epn, struct ehci_qtd *qtd, void *data, 584 int token, int len); 585 int optimize_submit_async(struct ehci_qtd *qtd, int epn); 586 void inline optimize_ehci_qtd_init(struct ehci_qtd *qtd, dma_addr_t dma); 587 struct ehci_qtd *optimize_ehci_qtd_alloc(gfp_t flags); 588 void optimize_ehci_qtd_free(struct ehci_qtd *qtd); 589 void optimize_submit_rx_request(const dbus_pub_t *pub, int epn, struct ehci_qtd *qtd_in, void *buf); 590 #endif /* EHCI_FASTPATH_TX || EHCI_FASTPATH_RX */ 591 592 void dbus_flowctrl_tx(void *dbi, bool on); 593 #endif /* __DBUS_H__ */ 594