rsi_usb.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * @section LICENSE
  3. * Copyright (c) 2014 Redpine Signals Inc.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #ifndef __RSI_USB_INTF__
  18. #define __RSI_USB_INTF__
  19. #include <linux/usb.h>
  20. #include "rsi_main.h"
  21. #include "rsi_common.h"
  22. #define USB_INTERNAL_REG_1 0x25000
  23. #define RSI_USB_READY_MAGIC_NUM 0xab
  24. #define FW_STATUS_REG 0x41050012
  25. #define USB_VENDOR_REGISTER_READ 0x15
  26. #define USB_VENDOR_REGISTER_WRITE 0x16
  27. #define RSI_USB_TX_HEAD_ROOM 128
  28. #define MAX_RX_URBS 1
  29. #define MAX_BULK_EP 8
  30. #define MGMT_EP 1
  31. #define DATA_EP 2
  32. struct rsi_91x_usbdev {
  33. struct rsi_thread rx_thread;
  34. u8 endpoint;
  35. struct usb_device *usbdev;
  36. struct usb_interface *pfunction;
  37. struct urb *rx_usb_urb[MAX_RX_URBS];
  38. u8 *tx_buffer;
  39. __le16 bulkin_size;
  40. u8 bulkin_endpoint_addr;
  41. __le16 bulkout_size[MAX_BULK_EP];
  42. u8 bulkout_endpoint_addr[MAX_BULK_EP];
  43. u32 tx_blk_size;
  44. u8 write_fail;
  45. };
  46. static inline int rsi_usb_check_queue_status(struct rsi_hw *adapter, u8 q_num)
  47. {
  48. /* In USB, there isn't any need to check the queue status */
  49. return QUEUE_NOT_FULL;
  50. }
  51. static inline int rsi_usb_event_timeout(struct rsi_hw *adapter)
  52. {
  53. return EVENT_WAIT_FOREVER;
  54. }
  55. int rsi_usb_device_init(struct rsi_common *common);
  56. int rsi_usb_write_register_multiple(struct rsi_hw *adapter, u32 addr,
  57. u8 *data, u32 count);
  58. void rsi_usb_rx_thread(struct rsi_common *common);
  59. #endif