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.c63
1 files changed, 33 insertions, 30 deletions
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c
index 95fcd361322b..761c389586d4 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -64,7 +64,7 @@ static void _wil6210_disconnect(struct wil6210_priv *wil, void *bssid)
64 struct net_device *ndev = wil_to_ndev(wil); 64 struct net_device *ndev = wil_to_ndev(wil);
65 struct wireless_dev *wdev = wil->wdev; 65 struct wireless_dev *wdev = wil->wdev;
66 66
67 wil_dbg(wil, "%s()\n", __func__); 67 wil_dbg_misc(wil, "%s()\n", __func__);
68 68
69 wil_link_off(wil); 69 wil_link_off(wil);
70 clear_bit(wil_status_fwconnected, &wil->status); 70 clear_bit(wil_status_fwconnected, &wil->status);
@@ -80,11 +80,13 @@ static void _wil6210_disconnect(struct wil6210_priv *wil, void *bssid)
80 GFP_KERNEL); 80 GFP_KERNEL);
81 break; 81 break;
82 default: 82 default:
83 ; 83 break;
84 } 84 }
85 85
86 for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) 86 for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++)
87 wil_vring_fini_tx(wil, i); 87 wil_vring_fini_tx(wil, i);
88
89 clear_bit(wil_status_dontscan, &wil->status);
88} 90}
89 91
90static void wil_disconnect_worker(struct work_struct *work) 92static void wil_disconnect_worker(struct work_struct *work)
@@ -99,7 +101,7 @@ static void wil_connect_timer_fn(ulong x)
99{ 101{
100 struct wil6210_priv *wil = (void *)x; 102 struct wil6210_priv *wil = (void *)x;
101 103
102 wil_dbg(wil, "Connect timeout\n"); 104 wil_dbg_misc(wil, "Connect timeout\n");
103 105
104 /* reschedule to thread context - disconnect won't 106 /* reschedule to thread context - disconnect won't
105 * run from atomic context 107 * run from atomic context
@@ -107,9 +109,18 @@ static void wil_connect_timer_fn(ulong x)
107 schedule_work(&wil->disconnect_worker); 109 schedule_work(&wil->disconnect_worker);
108} 110}
109 111
112static void wil_cache_mbox_regs(struct wil6210_priv *wil)
113{
114 /* make shadow copy of registers that should not change on run time */
115 wil_memcpy_fromio_32(&wil->mbox_ctl, wil->csr + HOST_MBOX,
116 sizeof(struct wil6210_mbox_ctl));
117 wil_mbox_ring_le2cpus(&wil->mbox_ctl.rx);
118 wil_mbox_ring_le2cpus(&wil->mbox_ctl.tx);
119}
120
110int wil_priv_init(struct wil6210_priv *wil) 121int wil_priv_init(struct wil6210_priv *wil)
111{ 122{
112 wil_dbg(wil, "%s()\n", __func__); 123 wil_dbg_misc(wil, "%s()\n", __func__);
113 124
114 mutex_init(&wil->mutex); 125 mutex_init(&wil->mutex);
115 mutex_init(&wil->wmi_mutex); 126 mutex_init(&wil->wmi_mutex);
@@ -136,11 +147,7 @@ int wil_priv_init(struct wil6210_priv *wil)
136 return -EAGAIN; 147 return -EAGAIN;
137 } 148 }
138 149
139 /* make shadow copy of registers that should not change on run time */ 150 wil_cache_mbox_regs(wil);
140 wil_memcpy_fromio_32(&wil->mbox_ctl, wil->csr + HOST_MBOX,
141 sizeof(struct wil6210_mbox_ctl));
142 wil_mbox_ring_le2cpus(&wil->mbox_ctl.rx);
143 wil_mbox_ring_le2cpus(&wil->mbox_ctl.tx);
144 151
145 return 0; 152 return 0;
146} 153}
@@ -162,7 +169,7 @@ void wil_priv_deinit(struct wil6210_priv *wil)
162 169
163static void wil_target_reset(struct wil6210_priv *wil) 170static void wil_target_reset(struct wil6210_priv *wil)
164{ 171{
165 wil_dbg(wil, "Resetting...\n"); 172 wil_dbg_misc(wil, "Resetting...\n");
166 173
167 /* register write */ 174 /* register write */
168#define W(a, v) iowrite32(v, wil->csr + HOSTADDR(a)) 175#define W(a, v) iowrite32(v, wil->csr + HOSTADDR(a))
@@ -202,7 +209,7 @@ static void wil_target_reset(struct wil6210_priv *wil)
202 209
203 msleep(2000); 210 msleep(2000);
204 211
205 wil_dbg(wil, "Reset completed\n"); 212 wil_dbg_misc(wil, "Reset completed\n");
206 213
207#undef W 214#undef W
208#undef S 215#undef S
@@ -225,8 +232,8 @@ static int wil_wait_for_fw_ready(struct wil6210_priv *wil)
225 wil_err(wil, "Firmware not ready\n"); 232 wil_err(wil, "Firmware not ready\n");
226 return -ETIME; 233 return -ETIME;
227 } else { 234 } else {
228 wil_dbg(wil, "FW ready after %d ms\n", 235 wil_dbg_misc(wil, "FW ready after %d ms\n",
229 jiffies_to_msecs(to-left)); 236 jiffies_to_msecs(to-left));
230 } 237 }
231 return 0; 238 return 0;
232} 239}
@@ -243,13 +250,13 @@ int wil_reset(struct wil6210_priv *wil)
243 cancel_work_sync(&wil->disconnect_worker); 250 cancel_work_sync(&wil->disconnect_worker);
244 wil6210_disconnect(wil, NULL); 251 wil6210_disconnect(wil, NULL);
245 252
253 wil6210_disable_irq(wil);
254 wil->status = 0;
255
246 wmi_event_flush(wil); 256 wmi_event_flush(wil);
247 257
248 flush_workqueue(wil->wmi_wq);
249 flush_workqueue(wil->wmi_wq_conn); 258 flush_workqueue(wil->wmi_wq_conn);
250 259 flush_workqueue(wil->wmi_wq);
251 wil6210_disable_irq(wil);
252 wil->status = 0;
253 260
254 /* TODO: put MAC in reset */ 261 /* TODO: put MAC in reset */
255 wil_target_reset(wil); 262 wil_target_reset(wil);
@@ -258,11 +265,7 @@ int wil_reset(struct wil6210_priv *wil)
258 wil->pending_connect_cid = -1; 265 wil->pending_connect_cid = -1;
259 INIT_COMPLETION(wil->wmi_ready); 266 INIT_COMPLETION(wil->wmi_ready);
260 267
261 /* make shadow copy of registers that should not change on run time */ 268 wil_cache_mbox_regs(wil);
262 wil_memcpy_fromio_32(&wil->mbox_ctl, wil->csr + HOST_MBOX,
263 sizeof(struct wil6210_mbox_ctl));
264 wil_mbox_ring_le2cpus(&wil->mbox_ctl.rx);
265 wil_mbox_ring_le2cpus(&wil->mbox_ctl.tx);
266 269
267 /* TODO: release MAC reset */ 270 /* TODO: release MAC reset */
268 wil6210_enable_irq(wil); 271 wil6210_enable_irq(wil);
@@ -278,7 +281,7 @@ void wil_link_on(struct wil6210_priv *wil)
278{ 281{
279 struct net_device *ndev = wil_to_ndev(wil); 282 struct net_device *ndev = wil_to_ndev(wil);
280 283
281 wil_dbg(wil, "%s()\n", __func__); 284 wil_dbg_misc(wil, "%s()\n", __func__);
282 285
283 netif_carrier_on(ndev); 286 netif_carrier_on(ndev);
284 netif_tx_wake_all_queues(ndev); 287 netif_tx_wake_all_queues(ndev);
@@ -288,7 +291,7 @@ void wil_link_off(struct wil6210_priv *wil)
288{ 291{
289 struct net_device *ndev = wil_to_ndev(wil); 292 struct net_device *ndev = wil_to_ndev(wil);
290 293
291 wil_dbg(wil, "%s()\n", __func__); 294 wil_dbg_misc(wil, "%s()\n", __func__);
292 295
293 netif_tx_stop_all_queues(ndev); 296 netif_tx_stop_all_queues(ndev);
294 netif_carrier_off(ndev); 297 netif_carrier_off(ndev);
@@ -311,27 +314,27 @@ static int __wil_up(struct wil6210_priv *wil)
311 wmi_nettype = wil_iftype_nl2wmi(NL80211_IFTYPE_ADHOC); 314 wmi_nettype = wil_iftype_nl2wmi(NL80211_IFTYPE_ADHOC);
312 switch (wdev->iftype) { 315 switch (wdev->iftype) {
313 case NL80211_IFTYPE_STATION: 316 case NL80211_IFTYPE_STATION:
314 wil_dbg(wil, "type: STATION\n"); 317 wil_dbg_misc(wil, "type: STATION\n");
315 bi = 0; 318 bi = 0;
316 ndev->type = ARPHRD_ETHER; 319 ndev->type = ARPHRD_ETHER;
317 break; 320 break;
318 case NL80211_IFTYPE_AP: 321 case NL80211_IFTYPE_AP:
319 wil_dbg(wil, "type: AP\n"); 322 wil_dbg_misc(wil, "type: AP\n");
320 bi = 100; 323 bi = 100;
321 ndev->type = ARPHRD_ETHER; 324 ndev->type = ARPHRD_ETHER;
322 break; 325 break;
323 case NL80211_IFTYPE_P2P_CLIENT: 326 case NL80211_IFTYPE_P2P_CLIENT:
324 wil_dbg(wil, "type: P2P_CLIENT\n"); 327 wil_dbg_misc(wil, "type: P2P_CLIENT\n");
325 bi = 0; 328 bi = 0;
326 ndev->type = ARPHRD_ETHER; 329 ndev->type = ARPHRD_ETHER;
327 break; 330 break;
328 case NL80211_IFTYPE_P2P_GO: 331 case NL80211_IFTYPE_P2P_GO:
329 wil_dbg(wil, "type: P2P_GO\n"); 332 wil_dbg_misc(wil, "type: P2P_GO\n");
330 bi = 100; 333 bi = 100;
331 ndev->type = ARPHRD_ETHER; 334 ndev->type = ARPHRD_ETHER;
332 break; 335 break;
333 case NL80211_IFTYPE_MONITOR: 336 case NL80211_IFTYPE_MONITOR:
334 wil_dbg(wil, "type: Monitor\n"); 337 wil_dbg_misc(wil, "type: Monitor\n");
335 bi = 0; 338 bi = 0;
336 ndev->type = ARPHRD_IEEE80211_RADIOTAP; 339 ndev->type = ARPHRD_IEEE80211_RADIOTAP;
337 /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_RADIOTAP ? */ 340 /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_RADIOTAP ? */
@@ -354,7 +357,7 @@ static int __wil_up(struct wil6210_priv *wil)
354 wmi_set_channel(wil, channel->hw_value); 357 wmi_set_channel(wil, channel->hw_value);
355 break; 358 break;
356 default: 359 default:
357 ; 360 break;
358 } 361 }
359 362
360 /* MAC address - pre-requisite for other commands */ 363 /* MAC address - pre-requisite for other commands */