[RK3288][Android6.0] 调试笔记 --- WiFi芯片AP6356S添加

Platform: RK3288
OS: Android 6.0
Kernel: 3.10.92

背景:

RK3288 Android6.0平台对AP6356S的支持不是很完善,直接修改wifi chip type后,会出现如下error:

[    9.169008] dhdsdio_download_nvram: Open nvram file failed /system/etc/firmware/nvram_ap6356s.txt
[    9.169016] _dhdsdio_download_firmware: dongle nvram file download failed
[    9.169039] dhd_net_bus_devreset: dhd_bus_devreset: -35
[    9.169045] dhd_prot_ioctl : bus is down. we have nothing to do
[    9.169048] dhd_net_bus_devreset: dhd_bus_devreset: -35

也就是说对应的bin文件和nvram文件缺失,需要更新固件和驱动。


解决方法:

1. 更新驱动

diff --git a/arch/arm/boot/dts/rk3288-ben.dts b/arch/arm/boot/dts/rk3288-ben.dts
index c6faa65..d903a36 100644
@@ -17,19 +17,19 @@
                  * rtl8188eu, rtl8723bs, rtl8723bu
                  * esp8089
 		*/
-		wifi_chip_type = "ap6335";
+		wifi_chip_type = "ap6354";
 
         sdio_vref = <1800>; //1800mv or 3300mv
 
         //keep_wifi_power_on;
 
         //power_ctrl_by_pmu;
-        power_pmu_regulator = "act_ldo3";
+        power_pmu_regulator = "rk818_ldo8";
         power_pmu_enable_level = <1>; //1->HIGH, 0->LOW
 
         //vref_ctrl_enable;
         //vref_ctrl_gpio = <&gpio0 GPIO_A2 GPIO_ACTIVE_HIGH>;
-        vref_pmu_regulator = "act_ldo3";
+        vref_pmu_regulator = "rk818_ldo8";
         vref_pmu_enable_level = <1>; //1->HIGH, 0->LOW
 
         WIFI,poweren_gpio = <&gpio4 GPIO_D4 GPIO_ACTIVE_HIGH>;
@@ -742,8 +742,8 @@
 
 		rk818_ldo8_reg: regulator@11 {
 			regulator-name= "rk818_ldo8";
-			regulator-min-microvolt = <3300000>;
-			regulator-max-microvolt = <3300000>;
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
 			regulator-initial-state = <3>;
 			regulator-state-mem {
 				regulator-state-enabled;
diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c
index 5f7e44c..2735b80 100755
--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c
+++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c
@@ -5,7 +5,7 @@
 #include 
 #include 
 #include 
-#if defined(HW_OOB) || defined(FORCE_WOWLAN)
+#if defined(HW_OOB) || defined(FORCE_WOWLAN)
 #include 
 #include 
 #include 
@@ -15,26 +15,25 @@
 #include 
 #include 
 
-/* message levels */
+/* message levels */
 #define CONFIG_ERROR_LEVEL	0x0001
 #define CONFIG_TRACE_LEVEL	0x0002
-#define USER_CONFIG_PATH    "/data/misc/roam/config.properties"
-
+
 uint config_msg_level = CONFIG_ERROR_LEVEL;
-
+
 #define CONFIG_ERROR(x) \
-	do { \
+	do { \
 		if (config_msg_level & CONFIG_ERROR_LEVEL) { \
 			printk(KERN_ERR "CONFIG-ERROR) ");	\
-			printk x; \
-		} \
-	} while (0)
+			printk x; \
+		} \
+	} while (0)
 #define CONFIG_TRACE(x) \
-	do { \
+	do { \
 		if (config_msg_level & CONFIG_TRACE_LEVEL) { \
 			printk(KERN_ERR "CONFIG-TRACE) ");	\
-			printk x; \
-		} \
+			printk x; \
+		} \
 	} while (0)
 
 #define MAXSZ_BUF		1000
@@ -173,11 +172,11 @@ const static char *bcm4356a2_pcie_ag_fw_name[] = {
 };
 #endif
 
-#define htod32(i) i
-#define htod16(i) i
-#define dtoh32(i) i
-#define dtoh16(i) i
-#define htodchanspec(i) i
+#define htod32(i) i
+#define htod16(i) i
+#define dtoh32(i) i
+#define dtoh16(i) i
+#define htodchanspec(i) i
 #define dtohchanspec(i) i
 
 #ifdef BCMSDIO
@@ -534,8 +533,10 @@ dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path, char *nv_path)
 			}
 			break;
 		case BCM4356_CHIP_ID:
-			if (chiprev == BCM4356A2_CHIP_REV)
-				strcpy(&fw_path[i+1], bcm4356a2_ag_fw_name[fw_type]);
+			if (chiprev == BCM4356A2_CHIP_REV) {
+				strcpy(&fw_path[i+1], bcm4356a2_ag_fw_name[fw_type]);
+				strcpy(&nv_path[j+1], "nvram_ap6356s.txt");
+			}
 			break;
 		case BCM4371_CHIP_ID:
 			if (chiprev == BCM4356A2_CHIP_REV)
@@ -866,10 +867,10 @@ dhd_conf_fix_country(dhd_pub_t *dhd)
 	if (!(dhd && dhd->conf)) {
 		return bcmerror;
 	}
-
+
 	memset(valid_chan_list, 0, sizeof(valid_chan_list));
-	list = (wl_uint32_list_t *)(void *) valid_chan_list;
-	list->count = htod32(WL_NUMCHANNELS);
+	list = (wl_uint32_list_t *)(void *) valid_chan_list;
+	list->count = htod32(WL_NUMCHANNELS);
 	if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VALID_CHANNELS, valid_chan_list, sizeof(valid_chan_list), FALSE, 0)) < 0) {
 		CONFIG_ERROR(("%s: get channels failed with %d\n", __FUNCTION__, bcmerror));
 	}
@@ -1283,8 +1284,8 @@ dhd_conf_read_log_level(dhd_pub_t *dhd, char *bufp, uint len)
 
 	if (pick)
 		MFREE(dhd->osh, pick, MAXSZ_BUF);
-}
-
+}
+
 void
 dhd_conf_read_wme_ac_params(dhd_pub_t *dhd, char *bufp, uint len)
 {
@@ -1719,7 +1720,6 @@ dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path)
 	bool conf_file_exists;
 	struct dhd_conf *conf = dhd->conf;
 
-    conf_path = USER_CONFIG_PATH;
 	conf_file_exists = ((conf_path != NULL) && (conf_path[0] != '\0'));
 	if (!conf_file_exists) {
 		printf("%s: config path %s\n", __FUNCTION__, conf_path);
@@ -1759,7 +1759,7 @@ dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path)
 		/* Process log_level */
 		dhd_conf_read_log_level(dhd, bufp, len);
 		dhd_conf_read_roam_params(dhd, bufp, len);
-		dhd_conf_read_wme_ac_params(dhd, bufp, len);
+		dhd_conf_read_wme_ac_params(dhd, bufp, len);
 		dhd_conf_read_fw_by_mac(dhd, bufp, len);
 		dhd_conf_read_nv_by_mac(dhd, bufp, len);
 		dhd_conf_read_nv_by_chip(dhd, bufp, len);
@@ -1948,7 +1948,7 @@ dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path)
 		len_val = process_config_vars(bufp, len, pick, "bus:txglom=");
 		if (len_val) {
 			conf->bus_txglom = (int)simple_strtol(pick, NULL, 10);
-			printf("%s: bus:txglom = %d\n", __FUNCTION__, conf->bus_txglom);
+			printf("%s: bus:txglom = %d\n", __FUNCTION__, conf->bus_txglom);
 		}
 
 		/* Process ampdu_ba_wsize parameters */
@@ -2010,7 +2010,7 @@ dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path)
 			printf("%s: use_rxchain = %d\n", __FUNCTION__, conf->use_rxchain);
 		}
 
-#if defined(BCMSDIOH_TXGLOM)
+#if defined(BCMSDIOH_TXGLOM)
 		/* Process txglomsize parameters */
 		memset(pick, 0, MAXSZ_BUF);
 		len_val = process_config_vars(bufp, len, pick, "txglomsize=");
@@ -2022,42 +2022,42 @@ dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path)
 		}
 
 		/* Process swtxglom parameters */
-		memset(pick, 0, MAXSZ_BUF);
+		memset(pick, 0, MAXSZ_BUF);
 		len_val = process_config_vars(bufp, len, pick, "swtxglom=");
-		if (len_val) {
-			if (!strncmp(pick, "0", len_val))
+		if (len_val) {
+			if (!strncmp(pick, "0", len_val))
 				conf->swtxglom = FALSE;
-			else
+			else
 				conf->swtxglom = TRUE;
 			printf("%s: swtxglom = %d\n", __FUNCTION__, conf->swtxglom);
 		}
 
-		/* Process txglom_ext parameters */
-		memset(pick, 0, MAXSZ_BUF);
-		len_val = process_config_vars(bufp, len, pick, "txglom_ext=");
-		if (len_val) {
-			if (!strncmp(pick, "0", len_val))
-				conf->txglom_ext = FALSE;
-			else
-				conf->txglom_ext = TRUE;
-			printf("%s: txglom_ext = %d\n", __FUNCTION__, conf->txglom_ext);
-			if (conf->txglom_ext) {
-				if ((conf->chip == BCM43362_CHIP_ID) || (conf->chip == BCM4330_CHIP_ID))
-					conf->txglom_bucket_size = 1680;
-				else if (conf->chip == BCM43340_CHIP_ID || conf->chip == BCM43341_CHIP_ID ||
+		/* Process txglom_ext parameters */
+		memset(pick, 0, MAXSZ_BUF);
+		len_val = process_config_vars(bufp, len, pick, "txglom_ext=");
+		if (len_val) {
+			if (!strncmp(pick, "0", len_val))
+				conf->txglom_ext = FALSE;
+			else
+				conf->txglom_ext = TRUE;
+			printf("%s: txglom_ext = %d\n", __FUNCTION__, conf->txglom_ext);
+			if (conf->txglom_ext) {
+				if ((conf->chip == BCM43362_CHIP_ID) || (conf->chip == BCM4330_CHIP_ID))
+					conf->txglom_bucket_size = 1680;
+				else if (conf->chip == BCM43340_CHIP_ID || conf->chip == BCM43341_CHIP_ID ||
 						conf->chip == BCM4334_CHIP_ID || conf->chip == BCM4324_CHIP_ID)
-					conf->txglom_bucket_size = 1684;
-			}
-			printf("%s: txglom_bucket_size = %d\n", __FUNCTION__, conf->txglom_bucket_size);
-		}
+					conf->txglom_bucket_size = 1684;
+			}
+			printf("%s: txglom_bucket_size = %d\n", __FUNCTION__, conf->txglom_bucket_size);
+		}
 #endif
 
 		/* Process disable_proptx parameters */
 		memset(pick, 0, MAXSZ_BUF);
 		len_val = process_config_vars(bufp, len, pick, "disable_proptx=");
 		if (len_val) {
-			conf->disable_proptx = (int)simple_strtol(pick, NULL, 10);
-			printf("%s: disable_proptx = %d\n", __FUNCTION__, conf->disable_proptx);
+			conf->disable_proptx = (int)simple_strtol(pick, NULL, 10);
+			printf("%s: disable_proptx = %d\n", __FUNCTION__, conf->disable_proptx);
 		}
 
 		/* Process dpc_cpucore parameters */
@@ -2131,44 +2131,44 @@ dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path)
 		if (len_val) {
 			conf->pktprio8021x = (int)simple_strtol(pick, NULL, 10);
 			printf("%s: pktprio8021x = %d\n", __FUNCTION__, conf->pktprio8021x);
-		}
-
-		/* Process txctl_tmo_fix parameters */
-		memset(pick, 0, MAXSZ_BUF);
-		len_val = process_config_vars(bufp, len, pick, "txctl_tmo_fix=");
-		if (len_val) {
-			if (!strncmp(pick, "0", len_val))
-				conf->txctl_tmo_fix = FALSE;
-			else
-				conf->txctl_tmo_fix = TRUE;
-			printf("%s: txctl_tmo_fix = %d\n", __FUNCTION__, conf->txctl_tmo_fix);
-		}
-
-		/* Process tx_in_rx parameters */
-		memset(pick, 0, MAXSZ_BUF);
-		len_val = process_config_vars(bufp, len, pick, "tx_in_rx=");
-		if (len_val) {
-			if (!strncmp(pick, "0", len_val))
-				conf->tx_in_rx = FALSE;
-			else
-				conf->tx_in_rx = TRUE;
-			printf("%s: tx_in_rx = %d\n", __FUNCTION__, conf->tx_in_rx);
-		}
-
-		/* Process dhd_txbound parameters */
-		memset(pick, 0, MAXSZ_BUF);
-		len_val = process_config_vars(bufp, len, pick, "dhd_txbound=");
-		if (len_val) {
-			dhd_txbound = (uint)simple_strtol(pick, NULL, 10);
-			printf("%s: dhd_txbound = %d\n", __FUNCTION__, dhd_txbound);
-		}
-
-		/* Process dhd_rxbound parameters */
-		memset(pick, 0, MAXSZ_BUF);
-		len_val = process_config_vars(bufp, len, pick, "dhd_rxbound=");
-		if (len_val) {
-			dhd_rxbound = (uint)simple_strtol(pick, NULL, 10);
-			printf("%s: dhd_rxbound = %d\n", __FUNCTION__, dhd_rxbound);
+		}
+
+		/* Process txctl_tmo_fix parameters */
+		memset(pick, 0, MAXSZ_BUF);
+		len_val = process_config_vars(bufp, len, pick, "txctl_tmo_fix=");
+		if (len_val) {
+			if (!strncmp(pick, "0", len_val))
+				conf->txctl_tmo_fix = FALSE;
+			else
+				conf->txctl_tmo_fix = TRUE;
+			printf("%s: txctl_tmo_fix = %d\n", __FUNCTION__, conf->txctl_tmo_fix);
+		}
+
+		/* Process tx_in_rx parameters */
+		memset(pick, 0, MAXSZ_BUF);
+		len_val = process_config_vars(bufp, len, pick, "tx_in_rx=");
+		if (len_val) {
+			if (!strncmp(pick, "0", len_val))
+				conf->tx_in_rx = FALSE;
+			else
+				conf->tx_in_rx = TRUE;
+			printf("%s: tx_in_rx = %d\n", __FUNCTION__, conf->tx_in_rx);
+		}
+
+		/* Process dhd_txbound parameters */
+		memset(pick, 0, MAXSZ_BUF);
+		len_val = process_config_vars(bufp, len, pick, "dhd_txbound=");
+		if (len_val) {
+			dhd_txbound = (uint)simple_strtol(pick, NULL, 10);
+			printf("%s: dhd_txbound = %d\n", __FUNCTION__, dhd_txbound);
+		}
+
+		/* Process dhd_rxbound parameters */
+		memset(pick, 0, MAXSZ_BUF);
+		len_val = process_config_vars(bufp, len, pick, "dhd_rxbound=");
+		if (len_val) {
+			dhd_rxbound = (uint)simple_strtol(pick, NULL, 10);
+			printf("%s: dhd_rxbound = %d\n", __FUNCTION__, dhd_rxbound);
 		}
 
 		/* Process tx_max_offset parameters */
@@ -2186,14 +2186,14 @@ dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path)
 			conf->rsdb_mode = (int)simple_strtol(pick, NULL, 10);
 			printf("%s: rsdb_mode = %d\n", __FUNCTION__, conf->rsdb_mode);
 		}
-
+
 		/* Process txglom_mode parameters */
-		memset(pick, 0, MAXSZ_BUF);
+		memset(pick, 0, MAXSZ_BUF);
 		len_val = process_config_vars(bufp, len, pick, "txglom_mode=");
-		if (len_val) {
-			if (!strncmp(pick, "0", len_val))
+		if (len_val) {
+			if (!strncmp(pick, "0", len_val))
 				conf->txglom_mode = FALSE;
-			else
+			else
 				conf->txglom_mode = TRUE;
 			printf("%s: txglom_mode = %d\n", __FUNCTION__, conf->txglom_mode);
 		}
@@ -2332,9 +2332,9 @@ dhd_conf_preinit(dhd_pub_t *dhd)
 	conf->roam_delta[0] = 15;
 #endif
 	conf->roam_delta[1] = WLC_BAND_ALL;
-#ifdef FULL_ROAMING_SCAN_PERIOD_60_SEC
+#ifdef FULL_ROAMING_SCAN_PERIOD_60_SEC
 	conf->fullroamperiod = 60;
-#else /* FULL_ROAMING_SCAN_PERIOD_60_SEC */
+#else /* FULL_ROAMING_SCAN_PERIOD_60_SEC */
 	conf->fullroamperiod = 120;
 #endif /* FULL_ROAMING_SCAN_PERIOD_60_SEC */
 #ifdef CUSTOM_KEEP_ALIVE_SETTING
@@ -2374,7 +2374,7 @@ dhd_conf_preinit(dhd_pub_t *dhd)
 	conf->tcpack_sup_mode = TCPACK_SUP_OFF;
 #endif
 	conf->dhd_poll = -1;
-	conf->pktprio8021x = -1;
+	conf->pktprio8021x = -1;
 	conf->txctl_tmo_fix = FALSE;
 	conf->tx_in_rx = TRUE;
 	conf->rsdb_mode = -2;
@@ -2386,7 +2386,7 @@ dhd_conf_preinit(dhd_pub_t *dhd)
 	if (conf->chip == BCM43430_CHIP_ID) {
 		conf->bus_rxglom = FALSE;
 		conf->use_rxchain = 0;
-	}
+	}
 	if (conf->chip == BCM4339_CHIP_ID) {
 		conf->txbf = 1;
 	}

2. 更新firmware和nvram文件

kris@eco:~/rk3288/external/wlan_loader$ g st
On branch tek_dev
Your branch is up-to-date with 'origin/tek_dev'.

Untracked files:
  (use "git add ..." to include in what will be committed)

	firmware/fw_bcm4356a2_ag.bin
	firmware/fw_bcm4356a2_ag_apsta.bin
	firmware/fw_bcm4356a2_ag_p2p.bin
	firmware/nvram_ap6356.txt
	firmware/nvram_ap6356s.txt


注意:
由于AP6356S包含BT功能,因此也要更新,这里就不给出了。

你可能感兴趣的:(RK3399,子类__WiFi)