init.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. * This file is part of wl12xx
  3. *
  4. * Copyright (C) 2009 Nokia Corporation
  5. *
  6. * Contact: Kalle Valo <kalle.valo@nokia.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA
  21. *
  22. */
  23. #include <linux/kernel.h>
  24. #include <linux/module.h>
  25. #include "init.h"
  26. #include "wl12xx_80211.h"
  27. #include "acx.h"
  28. #include "cmd.h"
  29. int wl12xx_hw_init_hwenc_config(struct wl12xx *wl)
  30. {
  31. int ret;
  32. ret = wl12xx_acx_feature_cfg(wl);
  33. if (ret < 0) {
  34. wl12xx_warning("couldn't set feature config");
  35. return ret;
  36. }
  37. ret = wl12xx_acx_default_key(wl, wl->default_key);
  38. if (ret < 0) {
  39. wl12xx_warning("couldn't set default key");
  40. return ret;
  41. }
  42. return 0;
  43. }
  44. int wl12xx_hw_init_templates_config(struct wl12xx *wl)
  45. {
  46. int ret;
  47. u8 partial_vbm[PARTIAL_VBM_MAX];
  48. /* send empty templates for fw memory reservation */
  49. ret = wl12xx_cmd_template_set(wl, CMD_PROBE_REQ, NULL,
  50. sizeof(struct wl12xx_probe_req_template));
  51. if (ret < 0)
  52. return ret;
  53. ret = wl12xx_cmd_template_set(wl, CMD_NULL_DATA, NULL,
  54. sizeof(struct wl12xx_null_data_template));
  55. if (ret < 0)
  56. return ret;
  57. ret = wl12xx_cmd_template_set(wl, CMD_PS_POLL, NULL,
  58. sizeof(struct wl12xx_ps_poll_template));
  59. if (ret < 0)
  60. return ret;
  61. ret = wl12xx_cmd_template_set(wl, CMD_QOS_NULL_DATA, NULL,
  62. sizeof
  63. (struct wl12xx_qos_null_data_template));
  64. if (ret < 0)
  65. return ret;
  66. ret = wl12xx_cmd_template_set(wl, CMD_PROBE_RESP, NULL,
  67. sizeof
  68. (struct wl12xx_probe_resp_template));
  69. if (ret < 0)
  70. return ret;
  71. ret = wl12xx_cmd_template_set(wl, CMD_BEACON, NULL,
  72. sizeof
  73. (struct wl12xx_beacon_template));
  74. if (ret < 0)
  75. return ret;
  76. /* tim templates, first reserve space then allocate an empty one */
  77. memset(partial_vbm, 0, PARTIAL_VBM_MAX);
  78. ret = wl12xx_cmd_vbm(wl, TIM_ELE_ID, partial_vbm, PARTIAL_VBM_MAX, 0);
  79. if (ret < 0)
  80. return ret;
  81. ret = wl12xx_cmd_vbm(wl, TIM_ELE_ID, partial_vbm, 1, 0);
  82. if (ret < 0)
  83. return ret;
  84. return 0;
  85. }
  86. int wl12xx_hw_init_rx_config(struct wl12xx *wl, u32 config, u32 filter)
  87. {
  88. int ret;
  89. ret = wl12xx_acx_rx_msdu_life_time(wl, RX_MSDU_LIFETIME_DEF);
  90. if (ret < 0)
  91. return ret;
  92. ret = wl12xx_acx_rx_config(wl, config, filter);
  93. if (ret < 0)
  94. return ret;
  95. return 0;
  96. }
  97. int wl12xx_hw_init_phy_config(struct wl12xx *wl)
  98. {
  99. int ret;
  100. ret = wl12xx_acx_pd_threshold(wl);
  101. if (ret < 0)
  102. return ret;
  103. ret = wl12xx_acx_slot(wl, DEFAULT_SLOT_TIME);
  104. if (ret < 0)
  105. return ret;
  106. ret = wl12xx_acx_group_address_tbl(wl);
  107. if (ret < 0)
  108. return ret;
  109. ret = wl12xx_acx_service_period_timeout(wl);
  110. if (ret < 0)
  111. return ret;
  112. ret = wl12xx_acx_rts_threshold(wl, RTS_THRESHOLD_DEF);
  113. if (ret < 0)
  114. return ret;
  115. return 0;
  116. }
  117. int wl12xx_hw_init_beacon_filter(struct wl12xx *wl)
  118. {
  119. int ret;
  120. ret = wl12xx_acx_beacon_filter_opt(wl);
  121. if (ret < 0)
  122. return ret;
  123. ret = wl12xx_acx_beacon_filter_table(wl);
  124. if (ret < 0)
  125. return ret;
  126. return 0;
  127. }
  128. int wl12xx_hw_init_pta(struct wl12xx *wl)
  129. {
  130. int ret;
  131. ret = wl12xx_acx_sg_enable(wl);
  132. if (ret < 0)
  133. return ret;
  134. ret = wl12xx_acx_sg_cfg(wl);
  135. if (ret < 0)
  136. return ret;
  137. return 0;
  138. }
  139. int wl12xx_hw_init_energy_detection(struct wl12xx *wl)
  140. {
  141. int ret;
  142. ret = wl12xx_acx_cca_threshold(wl);
  143. if (ret < 0)
  144. return ret;
  145. return 0;
  146. }
  147. int wl12xx_hw_init_beacon_broadcast(struct wl12xx *wl)
  148. {
  149. int ret;
  150. ret = wl12xx_acx_bcn_dtim_options(wl);
  151. if (ret < 0)
  152. return ret;
  153. return 0;
  154. }
  155. int wl12xx_hw_init_power_auth(struct wl12xx *wl)
  156. {
  157. return wl12xx_acx_sleep_auth(wl, WL12XX_PSM_CAM);
  158. }