wl12xx: Modify memory configuration for 128x/AP
[deliverable/linux.git] / drivers / net / wireless / wl12xx / acx.c
index a3db755ceedace20d394e95175d461fd0e32d685..b1b5139139e719892c42c88b3ee75daedbf2f5f5 100644 (file)
@@ -954,6 +954,7 @@ out:
 int wl1271_acx_ap_mem_cfg(struct wl1271 *wl)
 {
        struct wl1271_acx_ap_config_memory *mem_conf;
+       struct conf_memory_settings *mem;
        int ret;
 
        wl1271_debug(DEBUG_ACX, "wl1271 mem cfg");
@@ -964,11 +965,21 @@ int wl1271_acx_ap_mem_cfg(struct wl1271 *wl)
                goto out;
        }
 
+       if (wl->chip.id == CHIP_ID_1283_PG20)
+               /*
+                * FIXME: The 128x AP FW does not yet support dynamic memory.
+                * Use the base memory configuration for 128x for now. This
+                * should be fine tuned in the future.
+                */
+               mem = &wl->conf.mem_wl128x;
+       else
+               mem = &wl->conf.mem_wl127x;
+
        /* memory config */
-       mem_conf->num_stations = wl->conf.mem.num_stations;
-       mem_conf->rx_mem_block_num = wl->conf.mem.rx_block_num;
-       mem_conf->tx_min_mem_block_num = wl->conf.mem.tx_min_block_num;
-       mem_conf->num_ssid_profiles = wl->conf.mem.ssid_profiles;
+       mem_conf->num_stations = mem->num_stations;
+       mem_conf->rx_mem_block_num = mem->rx_block_num;
+       mem_conf->tx_min_mem_block_num = mem->tx_min_block_num;
+       mem_conf->num_ssid_profiles = mem->ssid_profiles;
        mem_conf->total_tx_descriptors = cpu_to_le32(ACX_TX_DESCRIPTORS);
 
        ret = wl1271_cmd_configure(wl, ACX_MEM_CFG, mem_conf,
@@ -986,6 +997,7 @@ out:
 int wl1271_acx_sta_mem_cfg(struct wl1271 *wl)
 {
        struct wl1271_acx_sta_config_memory *mem_conf;
+       struct conf_memory_settings *mem;
        int ret;
 
        wl1271_debug(DEBUG_ACX, "wl1271 mem cfg");
@@ -996,16 +1008,21 @@ int wl1271_acx_sta_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;
+
        /* memory config */
-       mem_conf->num_stations = wl->conf.mem.num_stations;
-       mem_conf->rx_mem_block_num = wl->conf.mem.rx_block_num;
-       mem_conf->tx_min_mem_block_num = wl->conf.mem.tx_min_block_num;
-       mem_conf->num_ssid_profiles = wl->conf.mem.ssid_profiles;
+       mem_conf->num_stations = mem->num_stations;
+       mem_conf->rx_mem_block_num = mem->rx_block_num;
+       mem_conf->tx_min_mem_block_num = mem->tx_min_block_num;
+       mem_conf->num_ssid_profiles = mem->ssid_profiles;
        mem_conf->total_tx_descriptors = cpu_to_le32(ACX_TX_DESCRIPTORS);
-       mem_conf->dyn_mem_enable = wl->conf.mem.dynamic_memory;
-       mem_conf->tx_free_req = wl->conf.mem.min_req_tx_blocks;
-       mem_conf->rx_free_req = wl->conf.mem.min_req_rx_blocks;
-       mem_conf->tx_min = wl->conf.mem.tx_min;
+       mem_conf->dyn_mem_enable = mem->dynamic_memory;
+       mem_conf->tx_free_req = mem->min_req_tx_blocks;
+       mem_conf->rx_free_req = mem->min_req_rx_blocks;
+       mem_conf->tx_min = mem->tx_min;
 
        ret = wl1271_cmd_configure(wl, ACX_MEM_CFG, mem_conf,
                                   sizeof(*mem_conf));
@@ -1019,6 +1036,32 @@ out:
        return ret;
 }
 
+int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap)
+{
+       struct wl1271_acx_host_config_bitmap *bitmap_conf;
+       int ret;
+
+       bitmap_conf = kzalloc(sizeof(*bitmap_conf), GFP_KERNEL);
+       if (!bitmap_conf) {
+               ret = -ENOMEM;
+               goto out;
+       }
+
+       bitmap_conf->host_cfg_bitmap = cpu_to_le32(host_cfg_bitmap);
+
+       ret = wl1271_cmd_configure(wl, ACX_HOST_IF_CFG_BITMAP,
+                                  bitmap_conf, sizeof(*bitmap_conf));
+       if (ret < 0) {
+               wl1271_warning("wl1271 bitmap config opt failed: %d", ret);
+               goto out;
+       }
+
+out:
+       kfree(bitmap_conf);
+
+       return ret;
+}
+
 int wl1271_acx_init_mem_config(struct wl1271 *wl)
 {
        int ret;
@@ -1489,22 +1532,46 @@ out:
        return ret;
 }
 
-int wl1271_acx_max_tx_retry(struct wl1271 *wl)
+int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl)
 {
-       struct wl1271_acx_max_tx_retry *acx = NULL;
+       struct wl1271_acx_ap_max_tx_retry *acx = NULL;
        int ret;
 
-       wl1271_debug(DEBUG_ACX, "acx max tx retry");
+       wl1271_debug(DEBUG_ACX, "acx ap max tx retry");
 
        acx = kzalloc(sizeof(*acx), GFP_KERNEL);
        if (!acx)
                return -ENOMEM;
 
-       acx->max_tx_retry = cpu_to_le16(wl->conf.tx.ap_max_tx_retries);
+       acx->max_tx_retry = cpu_to_le16(wl->conf.tx.max_tx_retries);
 
        ret = wl1271_cmd_configure(wl, ACX_MAX_TX_FAILURE, acx, sizeof(*acx));
        if (ret < 0) {
-               wl1271_warning("acx max tx retry failed: %d", ret);
+               wl1271_warning("acx ap max tx retry failed: %d", ret);
+               goto out;
+       }
+
+out:
+       kfree(acx);
+       return ret;
+}
+
+int wl1271_acx_sta_max_tx_retry(struct wl1271 *wl)
+{
+       struct wl1271_acx_sta_max_tx_retry *acx = NULL;
+       int ret;
+
+       wl1271_debug(DEBUG_ACX, "acx sta max tx retry");
+
+       acx = kzalloc(sizeof(*acx), GFP_KERNEL);
+       if (!acx)
+               return -ENOMEM;
+
+       acx->max_tx_retry = wl->conf.tx.max_tx_retries;
+
+       ret = wl1271_cmd_configure(wl, ACX_CONS_TX_FAILURE, acx, sizeof(*acx));
+       if (ret < 0) {
+               wl1271_warning("acx sta max tx retry failed: %d", ret);
                goto out;
        }
 
@@ -1567,3 +1634,43 @@ out:
        kfree(acx);
        return ret;
 }
+
+int wl1271_acx_fm_coex(struct wl1271 *wl)
+{
+       struct wl1271_acx_fm_coex *acx;
+       int ret;
+
+       wl1271_debug(DEBUG_ACX, "acx fm coex setting");
+
+       acx = kzalloc(sizeof(*acx), GFP_KERNEL);
+       if (!acx) {
+               ret = -ENOMEM;
+               goto out;
+       }
+
+       acx->enable = wl->conf.fm_coex.enable;
+       acx->swallow_period = wl->conf.fm_coex.swallow_period;
+       acx->n_divider_fref_set_1 = wl->conf.fm_coex.n_divider_fref_set_1;
+       acx->n_divider_fref_set_2 = wl->conf.fm_coex.n_divider_fref_set_2;
+       acx->m_divider_fref_set_1 =
+               cpu_to_le16(wl->conf.fm_coex.m_divider_fref_set_1);
+       acx->m_divider_fref_set_2 =
+               cpu_to_le16(wl->conf.fm_coex.m_divider_fref_set_2);
+       acx->coex_pll_stabilization_time =
+               cpu_to_le32(wl->conf.fm_coex.coex_pll_stabilization_time);
+       acx->ldo_stabilization_time =
+               cpu_to_le16(wl->conf.fm_coex.ldo_stabilization_time);
+       acx->fm_disturbed_band_margin =
+               wl->conf.fm_coex.fm_disturbed_band_margin;
+       acx->swallow_clk_diff = wl->conf.fm_coex.swallow_clk_diff;
+
+       ret = wl1271_cmd_configure(wl, ACX_FM_COEX_CFG, acx, sizeof(*acx));
+       if (ret < 0) {
+               wl1271_warning("acx fm coex setting failed: %d", ret);
+               goto out;
+       }
+
+out:
+       kfree(acx);
+       return ret;
+}
This page took 0.035268 seconds and 5 git commands to generate.