[Feature][ZXW-278]The sdio0 pin is configured in gpio mode before and after wifi uninstallation
Only Configure :No
Affected branch: master
Affected module: wifi
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I32cc6ec6ce1bb8d617c97c407f1ba90fb53fd90f
diff --git a/ap/os/linux/linux-3.4.x/drivers/mmc/host/zx29_mmc-pltfm.c b/ap/os/linux/linux-3.4.x/drivers/mmc/host/zx29_mmc-pltfm.c
index e3c1033..0cf0d7f 100755
--- a/ap/os/linux/linux-3.4.x/drivers/mmc/host/zx29_mmc-pltfm.c
+++ b/ap/os/linux/linux-3.4.x/drivers/mmc/host/zx29_mmc-pltfm.c
@@ -40,7 +40,10 @@
#endif
#include <mach/iomap.h>
#include <mach/gpio.h>
-
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on start
+static struct dw_mci *dw_mci_host_ptr[2];
+volatile u8 mmc0_data1_flag = 0xff;
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on end
static void dw_mci_rockchip_prepare_command(struct dw_mci *host, u32 *cmdr)
{
*cmdr |= SDMMC_CMD_USE_HOLD_REG;
@@ -128,7 +131,166 @@
DEVICE_ATTR(dw_regvalue, S_IRUGO | S_IWUSR, dw_regvalue_show, dw_regvalue_store);
-static struct dw_mci *dw_mci_host_ptr[2];
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on start
+int sd_io_config(u32 sd_index, bool active_flag)
+{
+ int rc = 0;
+ struct dw_mci_board *brd;
+ if(dw_mci_host_ptr[sd_index] == NULL){
+ printk("%s mmc%d not used or failed\n",__func__,sd_index);
+ return 0;
+ }
+ brd = dw_mci_host_ptr[sd_index]->pdata;
+ if (active_flag)
+ {
+ if (sd_index == 0)
+ {
+ if (dw_mci_host_ptr[sd_index]->quirks & DW_MCI_QUIRK_SDIO)
+ {
+ if (mmc0_data1_flag != 0x1)
+ {
+ irq_set_irq_wake(brd->data1_irq, 1);
+ mmc0_data1_flag = 0x1;
+ }
+ }
+ rc = zx29_gpio_config(ZX29_GPIO_66, GPIO66_EMMC_CLK);
+ if (rc)
+ printk("%s gpio66 config err !rc = %d\n", __func__, rc);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_66, IO_CFG_PULL_DOWN);
+ rc = zx29_gpio_config(ZX29_GPIO_67, GPIO67_EMMC_CMD);
+ if (rc)
+ printk("%s gpio67 config err !rc = %d\n", __func__, rc);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_67, IO_CFG_PULL_UP);
+ rc = zx29_gpio_config(ZX29_GPIO_68, GPIO68_EMMC_DATA0);
+ if (rc)
+ printk("%s gpio68 config err !rc = %d\n", __func__, rc);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_68, IO_CFG_PULL_UP);
+ rc = zx29_gpio_config(ZX29_GPIO_69, GPIO69_EMMC_DATA1);
+ if (rc)
+ printk("%s gpio69 config err !rc = %d\n", __func__, rc);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_69, IO_CFG_PULL_UP);
+ rc = zx29_gpio_config(ZX29_GPIO_70, GPIO70_EMMC_DATA2);
+ if (rc)
+ printk("%s gpio70 config err !rc = %d\n", __func__, rc);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_70, IO_CFG_PULL_UP);
+ rc = zx29_gpio_config(ZX29_GPIO_71, GPIO71_EMMC_DATA3);
+ if (rc)
+ printk("%s gpio71 config err !rc = %d\n", __func__, rc);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_71, IO_CFG_PULL_UP);
+ }
+ else if (sd_index == 1)
+ {
+ rc = zx29_gpio_config(ZX29_GPIO_72, GPIO72_SD1_HOST_SDCLK);
+ if (rc)
+ printk("%s gpio72 config err !rc = %d\n", __func__, rc);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_72, IO_CFG_PULL_DISABLE);
+ rc = zx29_gpio_config(ZX29_GPIO_73, GPIO73_SD1_CMD);
+ if (rc)
+ printk("%s gpio73 config err !rc = %d\n", __func__, rc);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_73, IO_CFG_PULL_UP);
+ rc = zx29_gpio_config(ZX29_GPIO_74, GPIO74_SD1_DATA0);
+ if (rc)
+ printk("%s gpio74 config err !rc = %d\n", __func__, rc);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_74, IO_CFG_PULL_UP);
+ rc = zx29_gpio_config(ZX29_GPIO_75, GPIO75_SD1_DATA1);
+ if (rc)
+ printk("%s gpio75 config err !rc = %d\n", __func__, rc);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_75, IO_CFG_PULL_UP);
+ rc = zx29_gpio_config(ZX29_GPIO_76, GPIO76_SD1_DATA2);
+ if (rc)
+ printk("%s gpio76 config err !rc = %d\n", __func__, rc);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_76, IO_CFG_PULL_UP);
+ rc = zx29_gpio_config(ZX29_GPIO_77, GPIO77_SD1_DATA3);
+ if (rc)
+ printk("%s gpio77 config err !rc = %d\n", __func__, rc);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_77, IO_CFG_PULL_UP);
+ }
+ else
+ printk("%s index error %d\n", __func__, sd_index);
+ }
+ else
+ {
+ if (sd_index == 0)
+ {
+ if (dw_mci_host_ptr[sd_index]->quirks & DW_MCI_QUIRK_SDIO)
+ {
+ if (mmc0_data1_flag != 0x0)
+ {
+ irq_set_irq_wake(brd->data1_irq, 0);
+ mmc0_data1_flag = 0x0;
+ }
+ }
+ rc = zx29_gpio_config(ZX29_GPIO_66, GPIO66_GPIO66);
+ if (rc)
+ printk("%s gpio66 err !rc = %d\n", __func__, rc);
+ zx29_gpio_set_direction(ZX29_GPIO_66, GPIO_IN);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_66, IO_CFG_PULL_DOWN);
+ rc = zx29_gpio_config(ZX29_GPIO_67, GPIO67_GPIO67);
+ if (rc)
+ printk("%s gpio67 err !rc = %d\n", __func__, rc);
+ zx29_gpio_set_direction(ZX29_GPIO_67, GPIO_IN);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_67, IO_CFG_PULL_DOWN);
+ rc = zx29_gpio_config(ZX29_GPIO_68, GPIO68_GPIO68);
+ if (rc)
+ printk("%s gpio68 err !rc = %d\n", __func__, rc);
+ zx29_gpio_set_direction(ZX29_GPIO_68, GPIO_IN);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_68, IO_CFG_PULL_DOWN);
+ rc = zx29_gpio_config(ZX29_GPIO_69, GPIO69_GPIO69);
+ if (rc)
+ printk("%s gpio69 err !rc = %d\n", __func__, rc);
+ zx29_gpio_set_direction(ZX29_GPIO_69, GPIO_IN);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_69, IO_CFG_PULL_DOWN);
+ rc = zx29_gpio_config(ZX29_GPIO_70, GPIO70_GPIO70);
+ if (rc)
+ printk("%s gpio70 err !rc = %d\n", __func__, rc);
+ zx29_gpio_set_direction(ZX29_GPIO_70, GPIO_IN);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_70, IO_CFG_PULL_DOWN);
+ rc = zx29_gpio_config(ZX29_GPIO_71, GPIO71_GPIO71);
+ if (rc)
+ printk("%s gpio71 err !rc = %d\n", __func__, rc);
+ zx29_gpio_set_direction(ZX29_GPIO_71, GPIO_IN);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_71, IO_CFG_PULL_DOWN);
+ }
+ else if (sd_index == 1)
+ {
+ rc = zx29_gpio_config(ZX29_GPIO_72, GPIO72_GPIO72);
+ if (rc)
+ printk("%s gpio72 err !rc = %d\n", __func__, rc);
+ zx29_gpio_set_direction(ZX29_GPIO_72, GPIO_IN);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_72, IO_CFG_PULL_DOWN);
+ rc = zx29_gpio_config(ZX29_GPIO_73, GPIO73_GPIO73);
+ if (rc)
+ printk("%s gpio73 err !rc = %d\n", __func__, rc);
+ zx29_gpio_set_direction(ZX29_GPIO_73, GPIO_IN);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_73, IO_CFG_PULL_DOWN);
+ rc = zx29_gpio_config(ZX29_GPIO_74, GPIO74_GPIO74);
+ if (rc)
+ printk("%s gpio74 err !rc = %d\n", __func__, rc);
+ zx29_gpio_set_direction(ZX29_GPIO_74, GPIO_IN);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_74, IO_CFG_PULL_DOWN);
+ rc = zx29_gpio_config(ZX29_GPIO_75, GPIO75_GPIO75);
+ if (rc)
+ printk("%s gpio75 err !rc = %d\n", __func__, rc);
+ zx29_gpio_set_direction(ZX29_GPIO_75, GPIO_IN);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_75, IO_CFG_PULL_DOWN);
+ rc = zx29_gpio_config(ZX29_GPIO_76, GPIO76_GPIO76);
+ if (rc)
+ printk("%s gpio76 err !rc = %d\n", __func__, rc);
+ zx29_gpio_set_direction(ZX29_GPIO_76, GPIO_IN);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_76, IO_CFG_PULL_DOWN);
+ rc = zx29_gpio_config(ZX29_GPIO_77, GPIO77_GPIO77);
+ if (rc)
+ printk("%s gpio77 err !rc = %d\n", __func__, rc);
+ zx29_gpio_set_direction(ZX29_GPIO_77, GPIO_IN);
+ zx29_gpio_pd_pu_set(ZX29_GPIO_77, IO_CFG_PULL_DOWN);
+ }
+ else
+ printk("%s index error %d\n", __func__, sd_index);
+ }
+ return rc;
+}
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on end
+
int dw_mci_pltfm_register(struct platform_device *pdev,
const struct dw_mci_drv_data *drv_data)
{
@@ -233,8 +395,35 @@
dw_mci_set_host(host, true);
}
#endif
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on start
+ if (host->pdata->quirks & DW_MCI_QUIRK_AUTO_GATE)
+ {
+ int rv = clk_set_auto_gate(sdmmc_wclk, true);
+ if (rv)
+ pr_err("%s: Failed to enable auto gate of sdmmc_wclk\n", __func__);
+ rv = clk_set_auto_gate(sdmmc_aclk, true);
+ if (rv)
+ pr_err("%s: Failed to enable auto gate of sdmmc_aclk\n", __func__);
+ }
+ else
+ {
+ int rv = clk_set_auto_gate(sdmmc_wclk, false);
+ if (rv)
+ pr_err("%s: Failed to disable auto gate of sdmmc_wclk\n", __func__);
+ rv = clk_set_auto_gate(sdmmc_aclk, false);
+ if (rv)
+ pr_err("%s: Failed to disable auto gate of sdmmc_aclk\n", __func__);
+ }
+ platform_set_drvdata(pdev, host);
+ pr_info("%s: host%u step 1 finish, reg addr %p\n", __func__, host->host_id, host->regs);
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on end
#if defined CONFIG_ARCH_ZX297520V3
if(host->host_id == 0) {
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on start
+#if CONFIG_AIC8800D80L
+ sd_io_config(host->host_id,0);
+#else
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on end
rc=gpio_request(ZX29_GPIO_66,"sd0_clk");
if(rc)
BUG();
@@ -259,6 +448,7 @@
if(rc)
BUG();
zx29_gpio_config(ZX29_GPIO_71, GPIO71_EMMC_DATA3);
+#endif
}
else if(host->host_id == 1) {
rc=gpio_request(ZX29_GPIO_72,"sd1_clk");
@@ -296,28 +486,6 @@
}
#endif
- if(host->pdata->quirks & DW_MCI_QUIRK_AUTO_GATE) {
- int rv = clk_set_auto_gate(sdmmc_wclk, true);
- if (rv)
- pr_err("%s: Failed to enable auto gate of sdmmc_wclk\n", __func__);
-
- rv = clk_set_auto_gate(sdmmc_aclk, true);
- if (rv)
- pr_err("%s: Failed to enable auto gate of sdmmc_aclk\n", __func__);
- }else{
- int rv = clk_set_auto_gate(sdmmc_wclk, false);
- if (rv)
- pr_err("%s: Failed to disable auto gate of sdmmc_wclk\n", __func__);
-
- rv = clk_set_auto_gate(sdmmc_aclk, false);
- if (rv)
- pr_err("%s: Failed to disable auto gate of sdmmc_aclk\n", __func__);
- }
-
-
- platform_set_drvdata(pdev, host);
-
- pr_info("%s: host%u step 1 finish, reg addr %p\n", __func__, host->host_id, host->regs);
rc = device_create_file(&pdev->dev, &dev_attr_dw_regoffset);
if (rc)
diff --git a/ap/os/linux/linux-3.4.x/drivers/mmc/host/zx29_mmc.c b/ap/os/linux/linux-3.4.x/drivers/mmc/host/zx29_mmc.c
index 7df7603..0aed35b 100755
--- a/ap/os/linux/linux-3.4.x/drivers/mmc/host/zx29_mmc.c
+++ b/ap/os/linux/linux-3.4.x/drivers/mmc/host/zx29_mmc.c
@@ -102,7 +102,9 @@
static struct dw_mci* dw_mmc_host[] = {NULL, NULL, NULL, NULL};
static unsigned int enable_wifi_irq = 0;
-
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on start
+extern volatile u8 mmc0_data1_flag;
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on end
//#pragma GCC optimize("O0")
/* Common flag combinations */
@@ -4159,9 +4161,20 @@
#endif
//ret = irq_set_irq_wake(host->irq, 1);
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on start
+#ifndef CONFIG_AIC8800D80L
if (host->quirks & DW_MCI_QUIRK_SDIO) {
irq_set_irq_wake(brd->data1_irq, 1);
}
+#else
+ if ((host->quirks & DW_MCI_QUIRK_SDIO)&&(mmc0_data1_flag !=0x0)) {
+ if(mmc0_data1_flag != 0x1){
+ irq_set_irq_wake(brd->data1_irq, 1);
+ mmc0_data1_flag = 0x1;
+ }
+ }
+#endif
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on end
#if (defined CONFIG_ARCH_ZX297520V2)||(defined CONFIG_ARCH_ZX297520V3)
if (!(host->quirks & DW_MCI_QUIRK_SDIO) && !(host->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION))
{
diff --git a/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800d80l/wifi_dev_aic88.c b/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800d80l/wifi_dev_aic88.c
index 3e06c1d..b65b051 100755
--- a/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800d80l/wifi_dev_aic88.c
+++ b/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800d80l/wifi_dev_aic88.c
@@ -14,6 +14,9 @@
extern int testmode;
extern void aic8800_wifi_disable(int bval);
extern void aic8800_wifi_re_enable(int bval);
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on start
+extern int sd_io_config(u32 sd_index, bool active_flag);
+//zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on end
void dw_mci_rescan_card(unsigned id, unsigned insert);
struct wifi_dev {
uint32_t dev_state;
@@ -50,14 +53,34 @@
printk(KERN_INFO "@@@exit Wlan@@@\n");
rwnx_mod_exit();
aic8800_wifi_disable(1);
+ //zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on start
+ ret = sd_io_config(0, 0);
+ if(ret)
+ printk(KERN_ERR "sd_io_config func fail, flag = %d ret = %d\n",0,ret);
+ //zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on end
testmode = 0;
break;
}
case WIFI_IOCTL_START: {
printk(KERN_INFO "@@@initWlan@@@\n");
+ //zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on start
+ ret = sd_io_config(0, 1);
+ if(ret)
+ printk(KERN_ERR "sd_io_config func fail, flag = %d ret = %d\n",1,ret);
+ //zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on end
aic8800_wifi_re_enable(1);
dw_mci_rescan_card(0, 1);
ret = rwnx_mod_init();
+ //zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on start
+ if(ret)
+ {
+ printk(KERN_ERR "qqq rwnx_mod_init fail, ret = %d\n",ret);
+ aic8800_wifi_disable(1);
+ ret = sd_io_config(0, 0);
+ if(ret)
+ printk(KERN_ERR "sd_io_config func fail, flag = %d ret = %d\n",0,ret);
+ }
+ //zw.wang The sdio0 pin is configured in gpio mode before and after wifi uninstallation on 20240521 on end
break;
}