]> git.karo-electronics.de Git - linux-beck.git/commitdiff
wlcore/wl12xx: add plt_init op and move the code to wl12xx
authorLuciano Coelho <coelho@ti.com>
Thu, 10 May 2012 09:13:49 +0000 (12:13 +0300)
committerLuciano Coelho <coelho@ti.com>
Tue, 5 Jun 2012 12:56:33 +0000 (15:56 +0300)
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>
drivers/net/wireless/ti/wl12xx/main.c
drivers/net/wireless/ti/wlcore/acx.c
drivers/net/wireless/ti/wlcore/cmd.c
drivers/net/wireless/ti/wlcore/main.c
drivers/net/wireless/ti/wlcore/wlcore.h

index 02668557fef0fb9ec4a473392a9a580e41faec86..1d097c1bcace4fae853a613d6e9f7c98f46d6072 100644 (file)
@@ -1302,10 +1302,67 @@ static void wl12xx_set_tx_desc_csum(struct wl1271 *wl,
        desc->wl12xx_reserved = 0;
 }
 
+static int wl12xx_plt_init(struct wl1271 *wl)
+{
+       int ret;
+
+       ret = wl->ops->boot(wl);
+       if (ret < 0)
+               goto out;
+
+       ret = wl->ops->hw_init(wl);
+       if (ret < 0)
+               goto out_irq_disable;
+
+       ret = wl1271_acx_init_mem_config(wl);
+       if (ret < 0)
+               goto out_irq_disable;
+
+       ret = wl12xx_acx_mem_cfg(wl);
+       if (ret < 0)
+               goto out_free_memmap;
+
+       /* Enable data path */
+       ret = wl1271_cmd_data_path(wl, 1);
+       if (ret < 0)
+               goto out_free_memmap;
+
+       /* Configure for CAM power saving (ie. always active) */
+       ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM);
+       if (ret < 0)
+               goto out_free_memmap;
+
+       /* configure PM */
+       ret = wl1271_acx_pm_config(wl);
+       if (ret < 0)
+               goto out_free_memmap;
+
+       goto out;
+
+out_free_memmap:
+       kfree(wl->target_mem_map);
+       wl->target_mem_map = NULL;
+
+out_irq_disable:
+       mutex_unlock(&wl->mutex);
+       /* Unlocking the mutex in the middle of handling is
+          inherently unsafe. In this case we deem it safe to do,
+          because we need to let any possibly pending IRQ out of
+          the system (and while we are WL1271_STATE_OFF the IRQ
+          work function will not do anything.) Also, any other
+          possible concurrent operations will fail due to the
+          current state, hence the wl1271 struct should be safe. */
+       wlcore_disable_interrupts(wl);
+       mutex_lock(&wl->mutex);
+out:
+       return ret;
+}
+
 static struct wlcore_ops wl12xx_ops = {
        .identify_chip          = wl12xx_identify_chip,
        .identify_fw            = wl12xx_identify_fw,
        .boot                   = wl12xx_boot,
+       .plt_init               = wl12xx_plt_init,
        .trigger_cmd            = wl12xx_trigger_cmd,
        .ack_event              = wl12xx_ack_event,
        .calc_tx_blocks         = wl12xx_calc_tx_blocks,
index f3d6fa5082696c145b30b453fd027ce4cdd88a11..fd33be7d5c9451aa70018c5f592c661cfad9f701 100644 (file)
@@ -86,6 +86,7 @@ out:
        kfree(auth);
        return ret;
 }
+EXPORT_SYMBOL_GPL(wl1271_acx_sleep_auth);
 
 int wl1271_acx_tx_power(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                        int power)
@@ -997,6 +998,7 @@ out:
        kfree(mem_conf);
        return ret;
 }
+EXPORT_SYMBOL_GPL(wl12xx_acx_mem_cfg);
 
 int wl1271_acx_init_mem_config(struct wl1271 *wl)
 {
@@ -1027,6 +1029,7 @@ int wl1271_acx_init_mem_config(struct wl1271 *wl)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(wl1271_acx_init_mem_config);
 
 int wl1271_acx_init_rx_interrupt(struct wl1271 *wl)
 {
@@ -1150,6 +1153,7 @@ out:
        kfree(acx);
        return ret;
 }
+EXPORT_SYMBOL_GPL(wl1271_acx_pm_config);
 
 int wl1271_acx_keep_alive_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                               bool enable)
index 0dec46586ad59ed135df5a6c2d35d5cd08c2ef32..5c4756047098234f3afa567071a866ca437ef20f 100644 (file)
@@ -816,6 +816,7 @@ out:
        kfree(cmd);
        return ret;
 }
+EXPORT_SYMBOL_GPL(wl1271_cmd_data_path);
 
 int wl1271_cmd_ps_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                       u8 ps_mode, u16 auto_ps_timeout)
index cd73dfe42448640cb2bf8e1ad622083640935334..373be7f667edc402f008349890185600cbe30be6 100644 (file)
@@ -320,46 +320,6 @@ static void wlcore_adjust_conf(struct wl1271 *wl)
        }
 }
 
-static int wl1271_plt_init(struct wl1271 *wl)
-{
-       int ret;
-
-       ret = wl->ops->hw_init(wl);
-       if (ret < 0)
-               return ret;
-
-       ret = wl1271_acx_init_mem_config(wl);
-       if (ret < 0)
-               return ret;
-
-       ret = wl12xx_acx_mem_cfg(wl);
-       if (ret < 0)
-               goto out_free_memmap;
-
-       /* Enable data path */
-       ret = wl1271_cmd_data_path(wl, 1);
-       if (ret < 0)
-               goto out_free_memmap;
-
-       /* Configure for CAM power saving (ie. always active) */
-       ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM);
-       if (ret < 0)
-               goto out_free_memmap;
-
-       /* configure PM */
-       ret = wl1271_acx_pm_config(wl);
-       if (ret < 0)
-               goto out_free_memmap;
-
-       return 0;
-
- out_free_memmap:
-       kfree(wl->target_mem_map);
-       wl->target_mem_map = NULL;
-
-       return ret;
-}
-
 static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl,
                                        struct wl12xx_vif *wlvif,
                                        u8 hlid, u8 tx_pkts)
@@ -1042,14 +1002,10 @@ int wl1271_plt_start(struct wl1271 *wl)
                if (ret < 0)
                        goto power_off;
 
-               ret = wl->ops->boot(wl);
+               ret = wl->ops->plt_init(wl);
                if (ret < 0)
                        goto power_off;
 
-               ret = wl1271_plt_init(wl);
-               if (ret < 0)
-                       goto irq_disable;
-
                wl->plt = true;
                wl->state = WL1271_STATE_ON;
                wl1271_notice("firmware booted in PLT mode (%s)",
@@ -1062,19 +1018,6 @@ int wl1271_plt_start(struct wl1271 *wl)
 
                goto out;
 
-irq_disable:
-               mutex_unlock(&wl->mutex);
-               /* Unlocking the mutex in the middle of handling is
-                  inherently unsafe. In this case we deem it safe to do,
-                  because we need to let any possibly pending IRQ out of
-                  the system (and while we are WL1271_STATE_OFF the IRQ
-                  work function will not do anything.) Also, any other
-                  possible concurrent operations will fail due to the
-                  current state, hence the wl1271 struct should be safe. */
-               wlcore_disable_interrupts(wl);
-               wl1271_flush_deferred_work(wl);
-               cancel_work_sync(&wl->netstack_work);
-               mutex_lock(&wl->mutex);
 power_off:
                wl1271_power_off(wl);
        }
index f62152e35f3cd46407ed28507679eb1c1d45a007..1fc3c77c10a33fa81809fdb7d7e48a26bd9f8b83 100644 (file)
@@ -39,6 +39,7 @@ struct wlcore_ops {
        int (*identify_chip)(struct wl1271 *wl);
        int (*identify_fw)(struct wl1271 *wl);
        int (*boot)(struct wl1271 *wl);
+       int (*plt_init)(struct wl1271 *wl);
        void (*trigger_cmd)(struct wl1271 *wl, int cmd_box_addr,
                            void *buf, size_t len);
        void (*ack_event)(struct wl1271 *wl);