net: rkwifi: auto recognize nvram file
authorhuweiguo <hwg@rock-chips.com>
Tue, 1 Nov 2016 03:27:26 +0000 (11:27 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 15 Nov 2016 01:54:17 +0000 (09:54 +0800)
Change-Id: Ia90c2657f9abf301882678e15ea18c2c17720be1
Signed-off-by: huweiguo <hwg@rock-chips.com>
drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c
drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.h
drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.c
drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_sdio.c

index 07bcc3c..1d7ae19 100755 (executable)
@@ -67,35 +67,35 @@ uint config_msg_level = CONFIG_ERROR_LEVEL;
 #define SBSDIO_CIS_SIZE_LIMIT          0x200           /* maximum bytes in one CIS */\r
 \r
 const static char *bcm4330b2_fw_name[] = {\r
-       "fw_bcm40183b2.bin",\r
-       "fw_bcm40183b2_apsta.bin",\r
-       "fw_bcm40183b2_p2p.bin",\r
+       "fw_RK903b2.bin",
+       "fw_RK903b2_apsta.bin",
+       "fw_RK903b2_p2p.bin",
        "fw_bcm40183b2_es.bin",\r
-       "fw_bcm40183b2_mfg.bin"\r
+       "fw_RK903b2_mfg.bin"
 };\r
 \r
 const static char *bcm4330b2_ag_fw_name[] = {\r
-       "fw_bcm40183b2_ag.bin",\r
-       "fw_bcm40183b2_ag_apsta.bin",\r
-       "fw_bcm40183b2_ag_p2p.bin",\r
+       "fw_RK903_ag.bin",
+       "fw_RK903_ag_apsta.bin",
+       "fw_RK903_ag_p2p.bin",
        "fw_bcm40183b2_ag_es.bin",\r
-       "fw_bcm40183b2_ag_mfg.bin"\r
+       "fw_RK903_ag_mfg.bin"
 };\r
 \r
 const static char *bcm43362a0_fw_name[] = {\r
-       "fw_bcm40181a0.bin",\r
-       "fw_bcm40181a0_apsta.bin",\r
-       "fw_bcm40181a0_p2p.bin",\r
+       "fw_RK901a0.bin",
+       "fw_RK901a0_apsta.bin",
+       "fw_RK901a0_p2p.bin",
        "fw_bcm40181a0_es.bin",\r
-       "fw_bcm40181a0_mfg.bin"\r
+       "fw_RK901a0_mfg.bin"
 };\r
 \r
 const static char *bcm43362a2_fw_name[] = {\r
-       "fw_bcm40181a2.bin",\r
-       "fw_bcm40181a2_apsta.bin",\r
-       "fw_bcm40181a2_p2p.bin",\r
+       "fw_RK901a2.bin",
+       "fw_RK901a2_apsta.bin",
+       "fw_RK901a2_p2p.bin",
        "fw_bcm40181a2_es.bin",\r
-       "fw_bcm40181a2_mfg.bin"\r
+       "fw_RK901a2_mfg.bin"
 };\r
 \r
 const static char *bcm4334b1_ag_fw_name[] = {\r
@@ -438,11 +438,11 @@ dhd_conf_set_nv_name_by_mac(dhd_pub_t *dhd, bcmsdh_info_t *sdh, char *nv_path)
 #endif\r
 \r
 void\r
-dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path)\r
+dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path, char *nv_path)
 {\r
        int fw_type, ag_type;\r
        uint chip, chiprev;\r
-       int i;\r
+       int i, j;
 \r
        chip = dhd->conf->chip;\r
        chiprev = dhd->conf->chiprev;\r
@@ -467,6 +467,12 @@ dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path)
                if (fw_path[i] == '/') break;\r
                i--;\r
        }\r
+       j = strlen(nv_path);
+       while (j > 0) {
+               if (nv_path[j] == '/')
+                       break;
+               j--;
+       }
 #ifdef BAND_AG\r
        ag_type = FW_TYPE_AG;\r
 #else\r
@@ -488,6 +494,7 @@ dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path)
                        } else {\r
                                if (chiprev == BCM4330B2_CHIP_REV)\r
                                        strcpy(&fw_path[i+1], bcm4330b2_ag_fw_name[fw_type]);\r
+                               strcpy(&nv_path[j + 1], "nvram_AP6330.txt");
                                break;\r
                        }\r
                case BCM43362_CHIP_ID:\r
@@ -495,12 +502,15 @@ dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path)
                                strcpy(&fw_path[i+1], bcm43362a0_fw_name[fw_type]);\r
                        else\r
                                strcpy(&fw_path[i+1], bcm43362a2_fw_name[fw_type]);\r
+                       if (!strstr(nv_path, "6476"))
+                               strcpy(&nv_path[j + 1], "nvram_AP6210.txt");
                        break;\r
                case BCM43430_CHIP_ID:\r
                        if (chiprev == BCM43430A0_CHIP_REV)\r
                                strcpy(&fw_path[i+1], bcm43438a0_fw_name[fw_type]);\r
                        else if (chiprev == BCM43430A1_CHIP_REV)\r
                                strcpy(&fw_path[i+1], bcm43438a1_fw_name[fw_type]);\r
+                       strcpy(&nv_path[j + 1], "nvram_ap6212.txt");
                        break;\r
                case BCM4334_CHIP_ID:\r
                        if (chiprev == BCM4334B1_CHIP_REV)\r
@@ -514,6 +524,7 @@ dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path)
                case BCM4324_CHIP_ID:\r
                        if (chiprev == BCM43241B4_CHIP_REV)\r
                                strcpy(&fw_path[i+1], bcm43241b4_ag_fw_name[fw_type]);\r
+                       strcpy(&nv_path[j + 1], "nvram_ap62x2.txt");
                        break;\r
                case BCM4335_CHIP_ID:\r
                        if (chiprev == BCM4335A0_CHIP_REV)\r
@@ -523,21 +534,27 @@ dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path)
                case BCM43454_CHIP_ID:\r
                        if (chiprev == BCM43455C0_CHIP_REV)\r
                                strcpy(&fw_path[i+1], bcm43455c0_ag_fw_name[fw_type]);\r
+                       strcpy(&nv_path[j + 1], "nvram_ap6255.txt");
                        break;\r
                case BCM4339_CHIP_ID:\r
                        if (chiprev == BCM4339A0_CHIP_REV)\r
                                strcpy(&fw_path[i+1], bcm4339a0_ag_fw_name[fw_type]);\r
+                       strcpy(&nv_path[j + 1], "nvram_AP6335.txt");
                        break;\r
                case BCM4354_CHIP_ID:\r
-                       if (chiprev == BCM4354A1_CHIP_REV)\r
+                       if (chiprev == BCM4354A1_CHIP_REV) {
                                strcpy(&fw_path[i+1], bcm4354a1_ag_fw_name[fw_type]);\r
-                       else if (chiprev == BCM4356A2_CHIP_REV)\r
+                               strcpy(&nv_path[j + 1], "nvram_ap6354.txt");
+                       } else if (chiprev == BCM4356A2_CHIP_REV) {
                                strcpy(&fw_path[i+1], bcm4356a2_ag_fw_name[fw_type]);\r
+                               strcpy(&nv_path[j + 1], "nvram_ap6356.txt");
+                       }
                        break;\r
                case BCM4356_CHIP_ID:\r
                case BCM4371_CHIP_ID:\r
                        if (chiprev == BCM4356A2_CHIP_REV)\r
                                strcpy(&fw_path[i+1], bcm4356a2_ag_fw_name[fw_type]);\r
+                       strcpy(&nv_path[j + 1], "nvram_ap6356.txt");
                        break;\r
                case BCM4359_CHIP_ID:\r
                        if (chiprev == BCM4359B1_CHIP_REV)\r
index d2bd306..dfd205d 100755 (executable)
@@ -179,7 +179,7 @@ void dhd_conf_set_nv_name_by_mac(dhd_pub_t *dhd, bcmsdh_info_t *sdh, char *nv_pa
 void dhd_conf_set_hw_oob_intr(bcmsdh_info_t *sdh, uint chip);\r
 #endif\r
 #endif\r
-void dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path);\r
+void dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path, char *nv_path);
 void dhd_conf_set_nv_name_by_chip(dhd_pub_t *dhd, char *nv_path);\r
 void dhd_conf_set_conf_path_by_nv_path(dhd_pub_t *dhd, char *conf_path, char *nv_path);\r
 #ifdef CONFIG_PATH_AUTO_SELECT\r
index 72f2ca3..f220031 100755 (executable)
@@ -1243,7 +1243,7 @@ dhdpcie_download_firmware(struct dhd_bus *bus, osl_t *osh)
        /* External conf takes precedence if specified */
        dhd_conf_preinit(bus->dhd);
        dhd_conf_read_config(bus->dhd, bus->dhd->conf_path);
-       dhd_conf_set_fw_name_by_chip(bus->dhd, bus->fw_path);
+       dhd_conf_set_fw_name_by_chip(bus->dhd, bus->fw_path, bus->nv_path);
        dhd_conf_set_nv_name_by_chip(bus->dhd, bus->nv_path);
 
        printf("Final fw_path=%s\n", bus->fw_path);
index e7fea67..2d89838 100755 (executable)
@@ -8384,7 +8384,7 @@ dhdsdio_download_firmware(struct dhd_bus *bus, osl_t *osh, void *sdh)
        /* External conf takes precedence if specified */
        dhd_conf_preinit(bus->dhd);
        dhd_conf_read_config(bus->dhd, bus->dhd->conf_path);
-       dhd_conf_set_fw_name_by_chip(bus->dhd, bus->fw_path);
+       dhd_conf_set_fw_name_by_chip(bus->dhd, bus->fw_path, bus->nv_path);
        dhd_conf_set_nv_name_by_chip(bus->dhd, bus->nv_path);
        dhd_conf_set_fw_name_by_mac(bus->dhd, bus->sdh, bus->fw_path);
        dhd_conf_set_nv_name_by_mac(bus->dhd, bus->sdh, bus->nv_path);