From 9b2202fcf735b3fefa80e05252e2fc736aa06c0a Mon Sep 17 00:00:00 2001 From: hwg Date: Tue, 6 Nov 2012 20:05:25 +0800 Subject: [PATCH] usb wifi: add rk29sdk_wifi_bt_gpio_control_init --- arch/arm/mach-rk2928/board-rk2926-sdk.c | 3 +++ arch/arm/mach-rk2928/board-rk2928-sdk-sdmmc.c | 25 +++++++++++++++---- arch/arm/mach-rk2928/board-rk2928-sdk.c | 5 +++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-rk2928/board-rk2926-sdk.c b/arch/arm/mach-rk2928/board-rk2926-sdk.c index f47eb46f472b..e3442639ed0e 100755 --- a/arch/arm/mach-rk2928/board-rk2926-sdk.c +++ b/arch/arm/mach-rk2928/board-rk2926-sdk.c @@ -972,6 +972,9 @@ static void __init rk2928_board_init(void) spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices)); platform_add_devices(devices, ARRAY_SIZE(devices)); +#ifdef CONFIG_WIFI_CONTROL_FUNC + rk29sdk_wifi_bt_gpio_control_init(); +#endif } static void __init rk2928_reserve(void) diff --git a/arch/arm/mach-rk2928/board-rk2928-sdk-sdmmc.c b/arch/arm/mach-rk2928/board-rk2928-sdk-sdmmc.c index 0e17d0cc3e16..33f5f5c7103e 100755 --- a/arch/arm/mach-rk2928/board-rk2928-sdk-sdmmc.c +++ b/arch/arm/mach-rk2928/board-rk2928-sdk-sdmmc.c @@ -358,12 +358,26 @@ 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) +{ + return 0; + if (gpio_request(RK30SDK_WIFI_GPIO_POWER_N, "wifi_power")) { + pr_info("%s: request wifi power gpio failed\n", __func__); + return -1; + } + gpio_direction_output(RK30SDK_WIFI_GPIO_POWER_N, !RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE); + + pr_info("%s: init finished\n",__func__); + return 0; +} +#else static int __init rk29sdk_wifi_bt_gpio_control_init(void) { rk29sdk_init_wifi_mem(); - + rk29_mux_api_set(GPIO0D6_MMC1_PWREN_NAME, GPIO0D_GPIO0D6); - + if (gpio_request(RK30SDK_WIFI_GPIO_POWER_N, "wifi_power")) { pr_info("%s: request wifi power gpio failed\n", __func__); return -1; @@ -375,12 +389,12 @@ static int __init rk29sdk_wifi_bt_gpio_control_init(void) gpio_free(RK30SDK_WIFI_GPIO_POWER_N); return -1; } -#endif +#endif gpio_direction_output(RK30SDK_WIFI_GPIO_POWER_N, !RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE); #ifdef RK30SDK_WIFI_GPIO_RESET_N gpio_direction_output(RK30SDK_WIFI_GPIO_RESET_N, !RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE); -#endif +#endif #if 0//defined(CONFIG_SDMMC1_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) @@ -397,11 +411,12 @@ static int __init rk29sdk_wifi_bt_gpio_control_init(void) gpio_direction_output(RK2928_PIN0_PB6,GPIO_LOW);//set mmc1-data3 to low. rk29_sdmmc_gpio_open(1, 0); //added by xbw at 2011-10-13 - #endif + #endif pr_info("%s: init finished\n",__func__); return 0; } +#endif #if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) 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 d50dc483fe5f..c6c70d8f7609 100755 --- a/arch/arm/mach-rk2928/board-rk2928-sdk.c +++ b/arch/arm/mach-rk2928/board-rk2928-sdk.c @@ -1003,7 +1003,10 @@ static void __init rk2928_board_init(void) rk30_i2c_register_board_info(); spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices)); platform_add_devices(devices, ARRAY_SIZE(devices)); - + +#ifdef CONFIG_WIFI_CONTROL_FUNC + rk29sdk_wifi_bt_gpio_control_init(); +#endif } static void __init rk2928_reserve(void) -- 2.34.1