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