aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2012-05-10 05:13:49 -0400
committerLuciano Coelho <coelho@ti.com>2012-06-05 08:56:33 -0400
commitc331b344d5def33194427b24cb2190ff345f7f55 (patch)
tree50b27e6f37933074d81023c464a3f1e9c54e9b14 /drivers/net
parent05057c0621dea083b617e7c35437faa9db7b7104 (diff)
wlcore/wl12xx: add plt_init op and move the code to wl12xx
PLT mode needs to be initialized differently for each chip. This patch adds an operation to init PLT and moves the existing PLT initialization into the wl12xx driver. Signed-off-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Arik Nemtsov <arik@wizery.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ti/wl12xx/main.c57
-rw-r--r--drivers/net/wireless/ti/wlcore/acx.c4
-rw-r--r--drivers/net/wireless/ti/wlcore/cmd.c1
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c59
-rw-r--r--drivers/net/wireless/ti/wlcore/wlcore.h1
5 files changed, 64 insertions, 58 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
index 02668557fef0..1d097c1bcace 100644
--- a/drivers/net/wireless/ti/wl12xx/main.c
+++ b/drivers/net/wireless/ti/wl12xx/main.c
@@ -1302,10 +1302,67 @@ static void wl12xx_set_tx_desc_csum(struct wl1271 *wl,
1302 desc->wl12xx_reserved = 0; 1302 desc->wl12xx_reserved = 0;
1303} 1303}
1304 1304
1305static int wl12xx_plt_init(struct wl1271 *wl)
1306{
1307 int ret;
1308
1309 ret = wl->ops->boot(wl);
1310 if (ret < 0)
1311 goto out;
1312
1313 ret = wl->ops->hw_init(wl);
1314 if (ret < 0)
1315 goto out_irq_disable;
1316
1317 ret = wl1271_acx_init_mem_config(wl);
1318 if (ret < 0)
1319 goto out_irq_disable;
1320
1321 ret = wl12xx_acx_mem_cfg(wl);
1322 if (ret < 0)
1323 goto out_free_memmap;
1324
1325 /* Enable data path */
1326 ret = wl1271_cmd_data_path(wl, 1);
1327 if (ret < 0)
1328 goto out_free_memmap;
1329
1330 /* Configure for CAM power saving (ie. always active) */
1331 ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM);
1332 if (ret < 0)
1333 goto out_free_memmap;
1334
1335 /* configure PM */
1336 ret = wl1271_acx_pm_config(wl);
1337 if (ret < 0)
1338 goto out_free_memmap;
1339
1340 goto out;
1341
1342out_free_memmap:
1343 kfree(wl->target_mem_map);
1344 wl->target_mem_map = NULL;
1345
1346out_irq_disable:
1347 mutex_unlock(&wl->mutex);
1348 /* Unlocking the mutex in the middle of handling is
1349 inherently unsafe. In this case we deem it safe to do,
1350 because we need to let any possibly pending IRQ out of
1351 the system (and while we are WL1271_STATE_OFF the IRQ
1352 work function will not do anything.) Also, any other
1353 possible concurrent operations will fail due to the
1354 current state, hence the wl1271 struct should be safe. */
1355 wlcore_disable_interrupts(wl);
1356 mutex_lock(&wl->mutex);
1357out:
1358 return ret;
1359}
1360
1305static struct wlcore_ops wl12xx_ops = { 1361static struct wlcore_ops wl12xx_ops = {
1306 .identify_chip = wl12xx_identify_chip, 1362 .identify_chip = wl12xx_identify_chip,
1307 .identify_fw = wl12xx_identify_fw, 1363 .identify_fw = wl12xx_identify_fw,
1308 .boot = wl12xx_boot, 1364 .boot = wl12xx_boot,
1365 .plt_init = wl12xx_plt_init,
1309 .trigger_cmd = wl12xx_trigger_cmd, 1366 .trigger_cmd = wl12xx_trigger_cmd,
1310 .ack_event = wl12xx_ack_event, 1367 .ack_event = wl12xx_ack_event,
1311 .calc_tx_blocks = wl12xx_calc_tx_blocks, 1368 .calc_tx_blocks = wl12xx_calc_tx_blocks,
diff --git a/drivers/net/wireless/ti/wlcore/acx.c b/drivers/net/wireless/ti/wlcore/acx.c
index f3d6fa508269..fd33be7d5c94 100644
--- a/drivers/net/wireless/ti/wlcore/acx.c
+++ b/drivers/net/wireless/ti/wlcore/acx.c
@@ -86,6 +86,7 @@ out:
86 kfree(auth); 86 kfree(auth);
87 return ret; 87 return ret;
88} 88}
89EXPORT_SYMBOL_GPL(wl1271_acx_sleep_auth);
89 90
90int wl1271_acx_tx_power(struct wl1271 *wl, struct wl12xx_vif *wlvif, 91int wl1271_acx_tx_power(struct wl1271 *wl, struct wl12xx_vif *wlvif,
91 int power) 92 int power)
@@ -997,6 +998,7 @@ out:
997 kfree(mem_conf); 998 kfree(mem_conf);
998 return ret; 999 return ret;
999} 1000}
1001EXPORT_SYMBOL_GPL(wl12xx_acx_mem_cfg);
1000 1002
1001int wl1271_acx_init_mem_config(struct wl1271 *wl) 1003int wl1271_acx_init_mem_config(struct wl1271 *wl)
1002{ 1004{
@@ -1027,6 +1029,7 @@ int wl1271_acx_init_mem_config(struct wl1271 *wl)
1027 1029
1028 return 0; 1030 return 0;
1029} 1031}
1032EXPORT_SYMBOL_GPL(wl1271_acx_init_mem_config);
1030 1033
1031int wl1271_acx_init_rx_interrupt(struct wl1271 *wl) 1034int wl1271_acx_init_rx_interrupt(struct wl1271 *wl)
1032{ 1035{
@@ -1150,6 +1153,7 @@ out:
1150 kfree(acx); 1153 kfree(acx);
1151 return ret; 1154 return ret;
1152} 1155}
1156EXPORT_SYMBOL_GPL(wl1271_acx_pm_config);
1153 1157
1154int wl1271_acx_keep_alive_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif, 1158int wl1271_acx_keep_alive_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1155 bool enable) 1159 bool enable)
diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c
index 0dec46586ad5..5c4756047098 100644
--- a/drivers/net/wireless/ti/wlcore/cmd.c
+++ b/drivers/net/wireless/ti/wlcore/cmd.c
@@ -816,6 +816,7 @@ out:
816 kfree(cmd); 816 kfree(cmd);
817 return ret; 817 return ret;
818} 818}
819EXPORT_SYMBOL_GPL(wl1271_cmd_data_path);
819 820
820int wl1271_cmd_ps_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif, 821int wl1271_cmd_ps_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
821 u8 ps_mode, u16 auto_ps_timeout) 822 u8 ps_mode, u16 auto_ps_timeout)
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index cd73dfe42448..373be7f667ed 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -320,46 +320,6 @@ static void wlcore_adjust_conf(struct wl1271 *wl)
320 } 320 }
321} 321}
322 322
323static int wl1271_plt_init(struct wl1271 *wl)
324{
325 int ret;
326
327 ret = wl->ops->hw_init(wl);
328 if (ret < 0)
329 return ret;
330
331 ret = wl1271_acx_init_mem_config(wl);
332 if (ret < 0)
333 return ret;
334
335 ret = wl12xx_acx_mem_cfg(wl);
336 if (ret < 0)
337 goto out_free_memmap;
338
339 /* Enable data path */
340 ret = wl1271_cmd_data_path(wl, 1);
341 if (ret < 0)
342 goto out_free_memmap;
343
344 /* Configure for CAM power saving (ie. always active) */
345 ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM);
346 if (ret < 0)
347 goto out_free_memmap;
348
349 /* configure PM */
350 ret = wl1271_acx_pm_config(wl);
351 if (ret < 0)
352 goto out_free_memmap;
353
354 return 0;
355
356 out_free_memmap:
357 kfree(wl->target_mem_map);
358 wl->target_mem_map = NULL;
359
360 return ret;
361}
362
363static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl, 323static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl,
364 struct wl12xx_vif *wlvif, 324 struct wl12xx_vif *wlvif,
365 u8 hlid, u8 tx_pkts) 325 u8 hlid, u8 tx_pkts)
@@ -1042,14 +1002,10 @@ int wl1271_plt_start(struct wl1271 *wl)
1042 if (ret < 0) 1002 if (ret < 0)
1043 goto power_off; 1003 goto power_off;
1044 1004
1045 ret = wl->ops->boot(wl); 1005 ret = wl->ops->plt_init(wl);
1046 if (ret < 0) 1006 if (ret < 0)
1047 goto power_off; 1007 goto power_off;
1048 1008
1049 ret = wl1271_plt_init(wl);
1050 if (ret < 0)
1051 goto irq_disable;
1052
1053 wl->plt = true; 1009 wl->plt = true;
1054 wl->state = WL1271_STATE_ON; 1010 wl->state = WL1271_STATE_ON;
1055 wl1271_notice("firmware booted in PLT mode (%s)", 1011 wl1271_notice("firmware booted in PLT mode (%s)",
@@ -1062,19 +1018,6 @@ int wl1271_plt_start(struct wl1271 *wl)
1062 1018
1063 goto out; 1019 goto out;
1064 1020
1065irq_disable:
1066 mutex_unlock(&wl->mutex);
1067 /* Unlocking the mutex in the middle of handling is
1068 inherently unsafe. In this case we deem it safe to do,
1069 because we need to let any possibly pending IRQ out of
1070 the system (and while we are WL1271_STATE_OFF the IRQ
1071 work function will not do anything.) Also, any other
1072 possible concurrent operations will fail due to the
1073 current state, hence the wl1271 struct should be safe. */
1074 wlcore_disable_interrupts(wl);
1075 wl1271_flush_deferred_work(wl);
1076 cancel_work_sync(&wl->netstack_work);
1077 mutex_lock(&wl->mutex);
1078power_off: 1021power_off:
1079 wl1271_power_off(wl); 1022 wl1271_power_off(wl);
1080 } 1023 }
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h
index f62152e35f3c..1fc3c77c10a3 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -39,6 +39,7 @@ struct wlcore_ops {
39 int (*identify_chip)(struct wl1271 *wl); 39 int (*identify_chip)(struct wl1271 *wl);
40 int (*identify_fw)(struct wl1271 *wl); 40 int (*identify_fw)(struct wl1271 *wl);
41 int (*boot)(struct wl1271 *wl); 41 int (*boot)(struct wl1271 *wl);
42 int (*plt_init)(struct wl1271 *wl);
42 void (*trigger_cmd)(struct wl1271 *wl, int cmd_box_addr, 43 void (*trigger_cmd)(struct wl1271 *wl, int cmd_box_addr,
43 void *buf, size_t len); 44 void *buf, size_t len);
44 void (*ack_event)(struct wl1271 *wl); 45 void (*ack_event)(struct wl1271 *wl);