wlcore/wl12xx: use a single memory config and reset if using wl127x
authorLuciano Coelho <coelho@ti.com>
Mon, 5 Dec 2011 17:52:22 +0000 (19:52 +0200)
committerLuciano Coelho <coelho@ti.com>
Thu, 12 Apr 2012 05:44:01 +0000 (08:44 +0300)
Instead of having two memory configuration sets, one for wl127x and
one for wl128x, we can use only one which should be correctly set by
the lower driver.

The wl12xx driver now uses the wl128x memory config by default but
changes it when if it identifies the wl127x chips.

Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/ti/wl12xx/conf.h
drivers/net/wireless/ti/wl12xx/main.c
drivers/net/wireless/ti/wlcore/acx.c
drivers/net/wireless/ti/wlcore/conf.h

index cb618b9e1bb823d4c8e2a23bc9da35dcb9367dcc..75e29897a0f58f85619e26403db10c4b73245022 100644 (file)
@@ -44,6 +44,7 @@ struct wl12xx_conf_rf {
 
 struct wl12xx_priv_conf {
        struct wl12xx_conf_rf rf;
+       struct conf_memory_settings mem_wl127x;
 };
 
 #endif /* __WL12XX_CONF_H__ */
index d9057f86c57faad112176074c3247f8b1dcdc36f..c90333aece276e98f523978ff511373a9db0f6e5 100644 (file)
@@ -285,17 +285,12 @@ static struct wlcore_conf wl12xx_conf = {
                .inactivity_timeout = 10000,
                .tx_ba_tid_bitmap = CONF_TX_BA_ENABLED_TID_BITMAP,
        },
-       .mem_wl127x = {
-               .num_stations                 = 1,
-               .ssid_profiles                = 1,
-               .rx_block_num                 = 70,
-               .tx_min_block_num             = 40,
-               .dynamic_memory               = 1,
-               .min_req_tx_blocks            = 100,
-               .min_req_rx_blocks            = 22,
-               .tx_min                       = 27,
-       },
-       .mem_wl128x = {
+       /*
+        * Memory config for wl127x chips is given in the
+        * wl12xx_default_priv_conf struct. The below configuration is
+        * for wl128x chips.
+        */
+       .mem = {
                .num_stations                 = 1,
                .ssid_profiles                = 1,
                .rx_block_num                 = 40,
@@ -367,6 +362,29 @@ static struct wlcore_conf wl12xx_conf = {
        },
 };
 
+static struct wl12xx_priv_conf wl12xx_default_priv_conf = {
+       .rf = {
+               .tx_per_channel_power_compensation_2 = {
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+               },
+               .tx_per_channel_power_compensation_5 = {
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+               },
+       },
+       .mem_wl127x = {
+               .num_stations                 = 1,
+               .ssid_profiles                = 1,
+               .rx_block_num                 = 70,
+               .tx_min_block_num             = 40,
+               .dynamic_memory               = 1,
+               .min_req_tx_blocks            = 100,
+               .min_req_rx_blocks            = 22,
+               .tx_min                       = 27,
+       },
+
+};
 
 #define WL12XX_TX_HW_BLOCK_SPARE_DEFAULT        1
 #define WL12XX_TX_HW_BLOCK_GEM_SPARE            2
@@ -609,6 +627,8 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
                wl->quirks |= WLCORE_QUIRK_LEGACY_NVS;
                wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
                wl->mr_fw_name = WL127X_FW_NAME_MULTI;
+               memcpy(&wl->conf.mem, &wl12xx_default_priv_conf.mem_wl127x,
+                      sizeof(wl->conf.mem));
 
                /* read data preparation is only needed by wl127x */
                wl->ops->prepare_read = wl127x_prepare_read;
@@ -626,6 +646,8 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
                wl->plt_fw_name = WL127X_PLT_FW_NAME;
                wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
                wl->mr_fw_name = WL127X_FW_NAME_MULTI;
+               memcpy(&wl->conf.mem, &wl12xx_default_priv_conf.mem_wl127x,
+                      sizeof(wl->conf.mem));
 
                /* read data preparation is only needed by wl127x */
                wl->ops->prepare_read = wl127x_prepare_read;
@@ -1172,8 +1194,13 @@ out:
 
 static void wl12xx_conf_init(struct wl1271 *wl)
 {
+       struct wl12xx_priv *priv = wl->priv;
+
        /* apply driver default configuration */
        memcpy(&wl->conf, &wl12xx_conf, sizeof(wl12xx_conf));
+
+       /* apply default private configuration */
+       memcpy(&priv->conf, &wl12xx_default_priv_conf, sizeof(priv->conf));
 }
 
 static bool wl12xx_mac_in_fuse(struct wl1271 *wl)
index 01dba462e5219c9034210d399db5c725b75b910c..9ad8fd5847b604405638e3a2d1f8c5934de5efce 100644 (file)
@@ -968,10 +968,7 @@ int wl12xx_acx_mem_cfg(struct wl1271 *wl)
                goto out;
        }
 
-       if (wl->chip.id == CHIP_ID_1283_PG20)
-               mem = &wl->conf.mem_wl128x;
-       else
-               mem = &wl->conf.mem_wl127x;
+       mem = &wl->conf.mem;
 
        /* memory config */
        mem_conf->num_stations = mem->num_stations;
index aa2da451b9880064e0a3401200e28a70f23dbd8b..fef0db4213bc4c83d3cf51b5092d8fbe004bfe0e 100644 (file)
@@ -1263,8 +1263,7 @@ struct wlcore_conf {
        struct conf_scan_settings scan;
        struct conf_sched_scan_settings sched_scan;
        struct conf_ht_setting ht;
-       struct conf_memory_settings mem_wl127x;
-       struct conf_memory_settings mem_wl128x;
+       struct conf_memory_settings mem;
        struct conf_fm_coex fm_coex;
        struct conf_rx_streaming_settings rx_streaming;
        struct conf_fwlog fwlog;