From: hwg Date: Wed, 28 Nov 2012 09:20:06 +0000 (+0800) Subject: wifi: add mt5931 wifi and mt6622 bt power control X-Git-Tag: firefly_0821_release~8166 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1e5752c75bd0b72ff5e0ddfe484a521fc4232cf0;p=firefly-linux-kernel-4.4.55.git wifi: add mt5931 wifi and mt6622 bt power control --- diff --git a/arch/arm/mach-rk2928/board-rk2928-sdk-sdmmc.c b/arch/arm/mach-rk2928/board-rk2928-sdk-sdmmc.c index 47f653fbcd64..92a1976329eb 100755 --- a/arch/arm/mach-rk2928/board-rk2928-sdk-sdmmc.c +++ b/arch/arm/mach-rk2928/board-rk2928-sdk-sdmmc.c @@ -386,11 +386,18 @@ #define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO GPIO3C_GPIO3C2 - #elif defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) + #elif defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) #define RK30SDK_WIFI_GPIO_POWER_N RK2928_PIN0_PD6 #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_LOW #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME GPIO0D6_MMC1_PWREN_NAME #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO GPIO0D_GPIO0D6 + + #elif defined(CONFIG_MT5931) || defined(CONFIG_MT5931_MT6622) + #define RK30SDK_WIFI_GPIO_POWER_N RK2928_PIN3_PD2 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH + + #define RK30SDK_WIFI_GPIO_RESET_N RK2928_PIN3_PD5 + #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH #endif #endif @@ -995,7 +1002,6 @@ static void rk29_sdmmc_gpio_open(int device_id, int on) gpio_request(rksdmmc1_gpio_init.data0_gpio.io, "mmc1-data0"); gpio_direction_output(rksdmmc1_gpio_init.data0_gpio.io,GPIO_LOW);//set mmc1-data0 to low. - #if defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) rk29_mux_api_set(rksdmmc1_gpio_init.data1_gpio.iomux.name, rksdmmc1_gpio_init.data1_gpio.iomux.fgpio); gpio_request(rksdmmc1_gpio_init.data1_gpio.io, "mmc1-data1"); gpio_direction_output(rksdmmc1_gpio_init.data1_gpio.io,GPIO_LOW);//set mmc1-data1 to low. @@ -1007,7 +1013,7 @@ static void rk29_sdmmc_gpio_open(int device_id, int on) rk29_mux_api_set(rksdmmc1_gpio_init.data3_gpio.iomux.name, rksdmmc1_gpio_init.data3_gpio.iomux.fgpio); gpio_request(rksdmmc1_gpio_init.data3_gpio.io, "mmc1-data3"); gpio_direction_output(rksdmmc1_gpio_init.data3_gpio.io,GPIO_LOW);//set mmc1-data3 to low. - #endif + mdelay(100); } #endif @@ -1445,6 +1451,13 @@ static int rk29sdk_wifi_status_register(void (*callback)(int card_present, void return 0; } +#if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) +static int __init rk29sdk_wifi_bt_gpio_control_init(void) +{ + pr_info("%s: init finished\n",__func__); + return 0; +} +#else static int __init rk29sdk_wifi_bt_gpio_control_init(void) { rk29sdk_init_wifi_mem(); @@ -1470,25 +1483,13 @@ static int __init rk29sdk_wifi_bt_gpio_control_init(void) #endif #if defined(CONFIG_SDMMC1_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - - rk29_mux_api_set(rksdmmc1_gpio_init.data1_gpio.iomux.name, rksdmmc1_gpio_init.data1_gpio.iomux.fgpio); - gpio_request(rksdmmc1_gpio_init.data1_gpio.io, "mmc1-data1"); - gpio_direction_output(rksdmmc1_gpio_init.data1_gpio.io,GPIO_LOW);//set mmc1-data1 to low. - - rk29_mux_api_set(rksdmmc1_gpio_init.data2_gpio.iomux.name, rksdmmc1_gpio_init.data2_gpio.iomux.fgpio); - gpio_request(rksdmmc1_gpio_init.data2_gpio.io, "mmc1-data2"); - gpio_direction_output(rksdmmc1_gpio_init.data2_gpio.io,GPIO_LOW);//set mmc1-data2 to low. - - rk29_mux_api_set(rksdmmc1_gpio_init.data3_gpio.iomux.name, rksdmmc1_gpio_init.data3_gpio.iomux.fgpio); - gpio_request(rksdmmc1_gpio_init.data3_gpio.io, "mmc1-data3"); - gpio_direction_output(rksdmmc1_gpio_init.data3_gpio.io,GPIO_LOW);//set mmc1-data3 to low. - rk29_sdmmc_gpio_open(1, 0); //added by xbw at 2011-10-13 #endif pr_info("%s: init finished\n",__func__); return 0; } +#endif #if (defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) )&& defined(CONFIG_ARCH_RK2928) static int usbwifi_power_status = 1; diff --git a/arch/arm/mach-rk2928/board-rk2928-sdk.c b/arch/arm/mach-rk2928/board-rk2928-sdk.c index 3ffe4a8c4b9b..e0d22e5e0d41 100755 --- a/arch/arm/mach-rk2928/board-rk2928-sdk.c +++ b/arch/arm/mach-rk2928/board-rk2928-sdk.c @@ -714,7 +714,7 @@ struct rk29_sdmmc_platform_data default_sdmmc1_data = { .iomux = { .name = RK29SDK_SD_CARD_DETECT_PIN_NAME, .fgpio = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO, - .fmux = GPIO3B_SDMMC0_DETECT_N, + .fmux = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX, }, }, @@ -726,6 +726,41 @@ struct rk29_sdmmc_platform_data default_sdmmc1_data = { * the end of setting for SDMMC devices **************************************************************************************************/ +#if defined(CONFIG_MT5931_MT6622) +static struct mt6622_platform_data mt6622_platdata = { + .power_gpio = { // BT_REG_ON + .io = RK2928_PIN3_PC2, // set io to INVALID_GPIO for disable it + .enable = GPIO_HIGH, + .iomux = { + .name = NULL, + }, + }, + + .reset_gpio = { // BT_RST + .io = RK2928_PIN0_PC6, + .enable = GPIO_LOW, + .iomux = { + .name = NULL, + }, + }, + + .irq_gpio = { + .io = RK2928_PIN3_PD3, + .enable = GPIO_HIGH, + .iomux = { + .name = NULL, + }, + } +}; + +static struct platform_device device_mt6622 = { + .name = "mt6622", + .id = -1, + .dev = { + .platform_data = &mt6622_platdata, + }, +}; +#endif #ifdef CONFIG_SND_SOC_RK2928 static struct resource resources_acodec[] = { @@ -792,6 +827,12 @@ static struct platform_device *devices[] __initdata = { #ifdef CONFIG_BATTERY_RK30_ADC_FAC &rk30_device_adc_battery, #endif +#ifdef CONFIG_WIFI_CONTROL_FUNC + &rk29sdk_wifi_device, +#endif +#ifdef CONFIG_MT5931_MT6622 + &device_mt6622, +#endif }; //i2c #ifdef CONFIG_I2C0_RK30