aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/wil6210/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/wil6210/main.c')
-rw-r--r--drivers/net/wireless/ath/wil6210/main.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c
index 761c389586d4..a0478e2f6868 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -14,12 +14,6 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#include <linux/kernel.h>
18#include <linux/netdevice.h>
19#include <linux/sched.h>
20#include <linux/ieee80211.h>
21#include <linux/wireless.h>
22#include <linux/slab.h>
23#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
24#include <linux/if_arp.h> 18#include <linux/if_arp.h>
25 19
@@ -109,13 +103,24 @@ static void wil_connect_timer_fn(ulong x)
109 schedule_work(&wil->disconnect_worker); 103 schedule_work(&wil->disconnect_worker);
110} 104}
111 105
112static void wil_cache_mbox_regs(struct wil6210_priv *wil) 106static void wil_connect_worker(struct work_struct *work)
113{ 107{
114 /* make shadow copy of registers that should not change on run time */ 108 int rc;
115 wil_memcpy_fromio_32(&wil->mbox_ctl, wil->csr + HOST_MBOX, 109 struct wil6210_priv *wil = container_of(work, struct wil6210_priv,
116 sizeof(struct wil6210_mbox_ctl)); 110 connect_worker);
117 wil_mbox_ring_le2cpus(&wil->mbox_ctl.rx); 111 int cid = wil->pending_connect_cid;
118 wil_mbox_ring_le2cpus(&wil->mbox_ctl.tx); 112
113 if (cid < 0) {
114 wil_err(wil, "No connection pending\n");
115 return;
116 }
117
118 wil_dbg_wmi(wil, "Configure for connection CID %d\n", cid);
119
120 rc = wil_vring_init_tx(wil, 0, WIL6210_TX_RING_SIZE, cid, 0);
121 wil->pending_connect_cid = -1;
122 if (rc == 0)
123 wil_link_on(wil);
119} 124}
120 125
121int wil_priv_init(struct wil6210_priv *wil) 126int wil_priv_init(struct wil6210_priv *wil)
@@ -130,7 +135,7 @@ int wil_priv_init(struct wil6210_priv *wil)
130 wil->pending_connect_cid = -1; 135 wil->pending_connect_cid = -1;
131 setup_timer(&wil->connect_timer, wil_connect_timer_fn, (ulong)wil); 136 setup_timer(&wil->connect_timer, wil_connect_timer_fn, (ulong)wil);
132 137
133 INIT_WORK(&wil->wmi_connect_worker, wmi_connect_worker); 138 INIT_WORK(&wil->connect_worker, wil_connect_worker);
134 INIT_WORK(&wil->disconnect_worker, wil_disconnect_worker); 139 INIT_WORK(&wil->disconnect_worker, wil_disconnect_worker);
135 INIT_WORK(&wil->wmi_event_worker, wmi_event_worker); 140 INIT_WORK(&wil->wmi_event_worker, wmi_event_worker);
136 141
@@ -147,8 +152,6 @@ int wil_priv_init(struct wil6210_priv *wil)
147 return -EAGAIN; 152 return -EAGAIN;
148 } 153 }
149 154
150 wil_cache_mbox_regs(wil);
151
152 return 0; 155 return 0;
153} 156}
154 157
@@ -185,15 +188,11 @@ static void wil_target_reset(struct wil6210_priv *wil)
185 W(RGF_USER_MAC_CPU_0, BIT(1)); /* mac_cpu_man_rst */ 188 W(RGF_USER_MAC_CPU_0, BIT(1)); /* mac_cpu_man_rst */
186 W(RGF_USER_USER_CPU_0, BIT(1)); /* user_cpu_man_rst */ 189 W(RGF_USER_USER_CPU_0, BIT(1)); /* user_cpu_man_rst */
187 190
188 msleep(100);
189
190 W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0xFE000000); 191 W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0xFE000000);
191 W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0x0000003F); 192 W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0x0000003F);
192 W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000170); 193 W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000170);
193 W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0xFFE7FC00); 194 W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0xFFE7FC00);
194 195
195 msleep(100);
196
197 W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0); 196 W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0);
198 W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0); 197 W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0);
199 W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0); 198 W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0);
@@ -203,12 +202,6 @@ static void wil_target_reset(struct wil6210_priv *wil)
203 W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00000080); 202 W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00000080);
204 W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); 203 W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0);
205 204
206 msleep(2000);
207
208 W(RGF_USER_USER_CPU_0, BIT(0)); /* user_cpu_man_de_rst */
209
210 msleep(2000);
211
212 wil_dbg_misc(wil, "Reset completed\n"); 205 wil_dbg_misc(wil, "Reset completed\n");
213 206
214#undef W 207#undef W
@@ -265,8 +258,6 @@ int wil_reset(struct wil6210_priv *wil)
265 wil->pending_connect_cid = -1; 258 wil->pending_connect_cid = -1;
266 INIT_COMPLETION(wil->wmi_ready); 259 INIT_COMPLETION(wil->wmi_ready);
267 260
268 wil_cache_mbox_regs(wil);
269
270 /* TODO: release MAC reset */ 261 /* TODO: release MAC reset */
271 wil6210_enable_irq(wil); 262 wil6210_enable_irq(wil);
272 263
@@ -352,9 +343,9 @@ static int __wil_up(struct wil6210_priv *wil)
352 wil_err(wil, "SSID not set\n"); 343 wil_err(wil, "SSID not set\n");
353 return -EINVAL; 344 return -EINVAL;
354 } 345 }
355 wmi_set_ssid(wil, wdev->ssid_len, wdev->ssid); 346 rc = wmi_set_ssid(wil, wdev->ssid_len, wdev->ssid);
356 if (channel) 347 if (rc)
357 wmi_set_channel(wil, channel->hw_value); 348 return rc;
358 break; 349 break;
359 default: 350 default:
360 break; 351 break;
@@ -364,9 +355,12 @@ static int __wil_up(struct wil6210_priv *wil)
364 wmi_set_mac_address(wil, ndev->dev_addr); 355 wmi_set_mac_address(wil, ndev->dev_addr);
365 356
366 /* Set up beaconing if required. */ 357 /* Set up beaconing if required. */
367 rc = wmi_set_bcon(wil, bi, wmi_nettype); 358 if (bi > 0) {
368 if (rc) 359 rc = wmi_pcp_start(wil, bi, wmi_nettype,
369 return rc; 360 (channel ? channel->hw_value : 0));
361 if (rc)
362 return rc;
363 }
370 364
371 /* Rx VRING. After MAC and beacon */ 365 /* Rx VRING. After MAC and beacon */
372 wil_rx_init(wil); 366 wil_rx_init(wil);