wifi: add pci reinit [5/7]
authorWeiguang Ruan <Weiguang.ruan@amlogic.com>
Thu, 31 Aug 2017 08:01:09 +0000 (16:01 +0800)
committerWeiguang Ruan <Weiguang.ruan@amlogic.com>
Thu, 31 Aug 2017 10:28:30 +0000 (03:28 -0700)
PD# 148564

bcm pci wifi needs to remove pci device and
the bus it is on. so we call pci_remove_reinit,
a function realize in wifi_dt.c

Change-Id: I54de64d81301e9b004da1a9f55556ee161f88f99

bcmdhd.1.363.59.144.x.cn/dhd_gpio.c

index b371ca810497ea97f25e4593356eb05dbc64b465..db3b45df23bfc8531a58da0f84139b970783890e 100644 (file)
@@ -22,6 +22,7 @@ extern int wifi_irq_trigger_level(void);
 #ifdef CUSTOMER_HW_AMLOGIC
 extern  void sdio_reinit(void);
 extern void extern_wifi_set_enable(int is_on);
+extern void pci_remove_reinit(unsigned int vid, unsigned int pid, int delBus);
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
 extern int wifi_irq_num(void);
 #endif
@@ -55,12 +56,14 @@ dhd_wlan_set_power(bool on
                        }
                }
 #ifdef CUSTOMER_HW_AMLOGIC
+#ifdef BCMSDIO
                extern_wifi_set_enable(0);
                mdelay(200);
                extern_wifi_set_enable(1);
                mdelay(200);
 //             sdio_reinit();
 #endif
+#endif
 #if defined(BUS_POWER_RESTORE)
 #if defined(BCMSDIO)
                if (adapter->sdio_func && adapter->sdio_func->card && adapter->sdio_func->card->host) {
@@ -138,8 +141,6 @@ static int dhd_wlan_set_carddetect(bool present)
 #ifdef CUSTOMER_HW_AMLOGIC
                sdio_reinit();
 #endif
-#elif defined(BCMPCIE)
-               printf("======== Card detection to detect PCIE card! ========\n");
 #endif
        } else {
 #if defined(BCMSDIO)
@@ -153,6 +154,8 @@ static int dhd_wlan_set_carddetect(bool present)
 #endif
 #elif defined(BCMPCIE)
                printf("======== Card detection to remove PCIE card! ========\n");
+               extern_wifi_set_enable(0);
+               mdelay(200);
 #endif
        }
 #endif /* BUS_POWER_RESTORE */
@@ -286,6 +289,10 @@ int dhd_wlan_init_gpio(void)
        gpio_wl_host_wake = -1;
 #endif
 
+#if defined(BCMPCIE)
+       printf("======== Card detection to detect PCIE card! ========\n");
+       pci_remove_reinit(0x14e4, 0x43ec, 1);
+#endif
        printf("%s: GPIO(WL_REG_ON) = %d\n", __FUNCTION__, gpio_wl_reg_on);
        if (gpio_wl_reg_on >= 0) {
                err = gpio_request(gpio_wl_reg_on, "WL_REG_ON");