dev.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /**
  2. * This file contains definitions and data structures specific
  3. * to Marvell 802.11 NIC. It contains the Device Information
  4. * structure struct lbs_private..
  5. */
  6. #ifndef _LBS_DEV_H_
  7. #define _LBS_DEV_H_
  8. #include "mesh.h"
  9. #include "defs.h"
  10. #include "host.h"
  11. #include <linux/kfifo.h>
  12. /** sleep_params */
  13. struct sleep_params {
  14. uint16_t sp_error;
  15. uint16_t sp_offset;
  16. uint16_t sp_stabletime;
  17. uint8_t sp_calcontrol;
  18. uint8_t sp_extsleepclk;
  19. uint16_t sp_reserved;
  20. };
  21. /** Private structure for the MV device */
  22. struct lbs_private {
  23. /* Basic networking */
  24. struct net_device *dev;
  25. u32 connect_status;
  26. struct work_struct mcast_work;
  27. u32 nr_of_multicastmacaddr;
  28. u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
  29. /* CFG80211 */
  30. struct wireless_dev *wdev;
  31. bool wiphy_registered;
  32. struct cfg80211_scan_request *scan_req;
  33. u8 assoc_bss[ETH_ALEN];
  34. u8 disassoc_reason;
  35. /* Mesh */
  36. struct net_device *mesh_dev; /* Virtual device */
  37. #ifdef CONFIG_LIBERTAS_MESH
  38. u32 mesh_connect_status;
  39. struct lbs_mesh_stats mstats;
  40. int mesh_open;
  41. uint16_t mesh_tlv;
  42. u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
  43. u8 mesh_ssid_len;
  44. #endif
  45. /* Debugfs */
  46. struct dentry *debugfs_dir;
  47. struct dentry *debugfs_debug;
  48. struct dentry *debugfs_files[6];
  49. struct dentry *events_dir;
  50. struct dentry *debugfs_events_files[6];
  51. struct dentry *regs_dir;
  52. struct dentry *debugfs_regs_files[6];
  53. /* Hardware debugging */
  54. u32 mac_offset;
  55. u32 bbp_offset;
  56. u32 rf_offset;
  57. /* Power management */
  58. u16 psmode;
  59. u32 psstate;
  60. u8 needtowakeup;
  61. /* Deep sleep */
  62. int is_deep_sleep;
  63. int deep_sleep_required;
  64. int is_auto_deep_sleep_enabled;
  65. int wakeup_dev_required;
  66. int is_activity_detected;
  67. int auto_deep_sleep_timeout; /* in ms */
  68. wait_queue_head_t ds_awake_q;
  69. struct timer_list auto_deepsleep_timer;
  70. /* Host sleep*/
  71. int is_host_sleep_configured;
  72. int is_host_sleep_activated;
  73. wait_queue_head_t host_sleep_q;
  74. /* Hardware access */
  75. void *card;
  76. u8 fw_ready;
  77. u8 surpriseremoved;
  78. int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
  79. void (*reset_card) (struct lbs_private *priv);
  80. int (*enter_deep_sleep) (struct lbs_private *priv);
  81. int (*exit_deep_sleep) (struct lbs_private *priv);
  82. int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
  83. /* Adapter info (from EEPROM) */
  84. u32 fwrelease;
  85. u32 fwcapinfo;
  86. u16 regioncode;
  87. u8 current_addr[ETH_ALEN];
  88. /* Command download */
  89. u8 dnld_sent;
  90. /* bit0 1/0=data_sent/data_tx_done,
  91. bit1 1/0=cmd_sent/cmd_tx_done,
  92. all other bits reserved 0 */
  93. u16 seqnum;
  94. struct cmd_ctrl_node *cmd_array;
  95. struct cmd_ctrl_node *cur_cmd;
  96. struct list_head cmdfreeq; /* free command buffers */
  97. struct list_head cmdpendingq; /* pending command buffers */
  98. struct timer_list command_timer;
  99. int cmd_timed_out;
  100. /* Command responses sent from the hardware to the driver */
  101. u8 resp_idx;
  102. u8 resp_buf[2][LBS_UPLD_SIZE];
  103. u32 resp_len[2];
  104. /* Events sent from hardware to driver */
  105. struct kfifo event_fifo;
  106. /** thread to service interrupts */
  107. struct task_struct *main_thread;
  108. wait_queue_head_t waitq;
  109. struct workqueue_struct *work_thread;
  110. /** Encryption stuff */
  111. u8 authtype_auto;
  112. u8 wep_tx_key;
  113. u8 wep_key[4][WLAN_KEY_LEN_WEP104];
  114. u8 wep_key_len[4];
  115. /* Wake On LAN */
  116. uint32_t wol_criteria;
  117. uint8_t wol_gpio;
  118. uint8_t wol_gap;
  119. /* Transmitting */
  120. int tx_pending_len; /* -1 while building packet */
  121. u8 tx_pending_buf[LBS_UPLD_SIZE];
  122. /* protected by hard_start_xmit serialization */
  123. u8 txretrycount;
  124. struct sk_buff *currenttxskb;
  125. /* Locks */
  126. struct mutex lock;
  127. spinlock_t driver_lock;
  128. /* NIC/link operation characteristics */
  129. u16 mac_control;
  130. u8 radio_on;
  131. u8 cur_rate;
  132. u8 channel;
  133. s16 txpower_cur;
  134. s16 txpower_min;
  135. s16 txpower_max;
  136. /** Scanning */
  137. struct delayed_work scan_work;
  138. int scan_channel;
  139. /* Queue of things waiting for scan completion */
  140. wait_queue_head_t scan_q;
  141. /* Whether the scan was initiated internally and not by cfg80211 */
  142. bool internal_scan;
  143. unsigned long last_scan;
  144. };
  145. extern struct cmd_confirm_sleep confirm_sleep;
  146. #endif