Merge commit 'c039c332f23e794deb6d6f37b9f07ff3b27fb2cf' into md
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / ti / wl12xx / main.c
index 3a4ab65db0ec96c3a357bee3ff01e433c673c9ba..f429fc110cb0ac1a09e887564310f04dfe0c72dd 100644 (file)
@@ -242,7 +242,7 @@ static struct wlcore_conf wl12xx_conf = {
                .psm_entry_retries           = 8,
                .psm_exit_retries            = 16,
                .psm_entry_nullfunc_retries  = 3,
-               .dynamic_ps_timeout          = 200,
+               .dynamic_ps_timeout          = 1500,
                .forced_ps                   = false,
                .keep_alive_interval         = 55000,
                .max_listen_interval         = 20,
@@ -590,13 +590,13 @@ static const int wl12xx_rtable[REG_TABLE_LEN] = {
 };
 
 /* TODO: maybe move to a new header file? */
-#define WL127X_FW_NAME_MULTI   "ti-connectivity/wl127x-fw-4-mr.bin"
-#define WL127X_FW_NAME_SINGLE  "ti-connectivity/wl127x-fw-4-sr.bin"
-#define WL127X_PLT_FW_NAME     "ti-connectivity/wl127x-fw-4-plt.bin"
+#define WL127X_FW_NAME_MULTI   "ti-connectivity/wl127x-fw-5-mr.bin"
+#define WL127X_FW_NAME_SINGLE  "ti-connectivity/wl127x-fw-5-sr.bin"
+#define WL127X_PLT_FW_NAME     "ti-connectivity/wl127x-fw-5-plt.bin"
 
-#define WL128X_FW_NAME_MULTI   "ti-connectivity/wl128x-fw-4-mr.bin"
-#define WL128X_FW_NAME_SINGLE  "ti-connectivity/wl128x-fw-4-sr.bin"
-#define WL128X_PLT_FW_NAME     "ti-connectivity/wl128x-fw-4-plt.bin"
+#define WL128X_FW_NAME_MULTI   "ti-connectivity/wl128x-fw-5-mr.bin"
+#define WL128X_FW_NAME_SINGLE  "ti-connectivity/wl128x-fw-5-sr.bin"
+#define WL128X_PLT_FW_NAME     "ti-connectivity/wl128x-fw-5-plt.bin"
 
 static int wl127x_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len)
 {
@@ -637,6 +637,7 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
                               wl->chip.id);
 
                wl->quirks |= WLCORE_QUIRK_LEGACY_NVS |
+                             WLCORE_QUIRK_DUAL_PROBE_TMPL |
                              WLCORE_QUIRK_TKIP_HEADER_SPACE;
                wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
                wl->mr_fw_name = WL127X_FW_NAME_MULTI;
@@ -646,6 +647,9 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
                /* read data preparation is only needed by wl127x */
                wl->ops->prepare_read = wl127x_prepare_read;
 
+               wlcore_set_min_fw_ver(wl, WL127X_CHIP_VER, WL127X_IFTYPE_VER,
+                                     WL127X_MAJOR_VER, WL127X_SUBTYPE_VER,
+                                     WL127X_MINOR_VER);
                break;
 
        case CHIP_ID_1271_PG20:
@@ -653,6 +657,7 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
                             wl->chip.id);
 
                wl->quirks |= WLCORE_QUIRK_LEGACY_NVS |
+                             WLCORE_QUIRK_DUAL_PROBE_TMPL |
                              WLCORE_QUIRK_TKIP_HEADER_SPACE;
                wl->plt_fw_name = WL127X_PLT_FW_NAME;
                wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
@@ -663,6 +668,9 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
                /* read data preparation is only needed by wl127x */
                wl->ops->prepare_read = wl127x_prepare_read;
 
+               wlcore_set_min_fw_ver(wl, WL127X_CHIP_VER, WL127X_IFTYPE_VER,
+                                     WL127X_MAJOR_VER, WL127X_SUBTYPE_VER,
+                                     WL127X_MINOR_VER);
                break;
 
        case CHIP_ID_1283_PG20:
@@ -674,8 +682,12 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
 
                /* wl128x requires TX blocksize alignment */
                wl->quirks |= WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN |
+                             WLCORE_QUIRK_DUAL_PROBE_TMPL |
                              WLCORE_QUIRK_TKIP_HEADER_SPACE;
 
+               wlcore_set_min_fw_ver(wl, WL128X_CHIP_VER, WL128X_IFTYPE_VER,
+                                     WL128X_MAJOR_VER, WL128X_SUBTYPE_VER,
+                                     WL128X_MINOR_VER);
                break;
        case CHIP_ID_1283_PG10:
        default:
@@ -688,7 +700,8 @@ out:
        return ret;
 }
 
-static int wl12xx_top_reg_write(struct wl1271 *wl, int addr, u16 val)
+static int __must_check wl12xx_top_reg_write(struct wl1271 *wl, int addr,
+                                            u16 val)
 {
        int ret;
 
@@ -712,7 +725,8 @@ out:
        return ret;
 }
 
-static int wl12xx_top_reg_read(struct wl1271 *wl, int addr, u16 *out)
+static int __must_check wl12xx_top_reg_read(struct wl1271 *wl, int addr,
+                                           u16 *out)
 {
        u32 val;
        int timeout = OCP_CMD_LOOP;
@@ -1325,6 +1339,14 @@ static int wl12xx_hw_init(struct wl1271 *wl)
                ret = wl128x_cmd_general_parms(wl);
                if (ret < 0)
                        goto out;
+
+               /*
+                * If we are in calibrator based auto detect then we got the FEM nr
+                * in wl->fem_manuf. No need to continue further
+                */
+               if (wl->plt_mode == PLT_FEM_DETECT)
+                       goto out;
+
                ret = wl128x_cmd_radio_parms(wl);
                if (ret < 0)
                        goto out;
@@ -1341,6 +1363,14 @@ static int wl12xx_hw_init(struct wl1271 *wl)
                ret = wl1271_cmd_general_parms(wl);
                if (ret < 0)
                        goto out;
+
+               /*
+                * If we are in calibrator based auto detect then we got the FEM nr
+                * in wl->fem_manuf. No need to continue further
+                */
+               if (wl->plt_mode == PLT_FEM_DETECT)
+                       goto out;
+
                ret = wl1271_cmd_radio_parms(wl);
                if (ret < 0)
                        goto out;
@@ -1486,6 +1516,13 @@ static int wl12xx_plt_init(struct wl1271 *wl)
        if (ret < 0)
                goto out_irq_disable;
 
+       /*
+        * If we are in calibrator based auto detect then we got the FEM nr
+        * in wl->fem_manuf. No need to continue further
+        */
+       if (wl->plt_mode == PLT_FEM_DETECT)
+               goto out;
+
        ret = wl1271_acx_init_mem_config(wl);
        if (ret < 0)
                goto out_irq_disable;