From d489cd9790764351739702182ca4c2734266e555 Mon Sep 17 00:00:00 2001 From: kfx Date: Fri, 2 Aug 2013 10:44:40 +0800 Subject: [PATCH] rk3026: rk3028a_tb: wifi support --- arch/arm/mach-rk3026/board-rk3026-tb.c | 5 + .../board-rk3028a-tb-sdmmc-config.c | 4 +- arch/arm/mach-rk3026/board-rk3028a-tb.c | 21 +- arch/arm/plat-rk/rk-sdmmc-ops.c | 179 ++++++++++++++++++ 4 files changed, 199 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-rk3026/board-rk3026-tb.c b/arch/arm/mach-rk3026/board-rk3026-tb.c index a00a41e9aee3..857892beaf1b 100755 --- a/arch/arm/mach-rk3026/board-rk3026-tb.c +++ b/arch/arm/mach-rk3026/board-rk3026-tb.c @@ -1085,6 +1085,11 @@ static void __init machine_rk30_board_init(void) spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices)); platform_add_devices(devices, ARRAY_SIZE(devices)); rk_platform_add_display_devices(); +#if defined(CONFIG_WIFI_CONTROL_FUNC) + rk29sdk_wifi_bt_gpio_control_init(); +#elif defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) + rk29sdk_wifi_combo_module_gpio_init(); +#endif } static void __init rk30_reserve(void) diff --git a/arch/arm/mach-rk3026/board-rk3028a-tb-sdmmc-config.c b/arch/arm/mach-rk3026/board-rk3028a-tb-sdmmc-config.c index 453e7d84a9ab..ccb1047b126f 100644 --- a/arch/arm/mach-rk3026/board-rk3028a-tb-sdmmc-config.c +++ b/arch/arm/mach-rk3026/board-rk3028a-tb-sdmmc-config.c @@ -73,10 +73,10 @@ int rk31sdk_get_sdmmc0_pin_io_voltage(void) #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_LOW//GPIO_HIGH #elif defined(CONFIG_BCM4330) || defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RK903) || defined(CONFIG_RK901) - #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD0 + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN0_PD6 #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH - #define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN2_PA7 + #define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN3_PC2 #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH #elif defined(CONFIG_MT5931_MT6622) || defined(CONFIG_MT5931) diff --git a/arch/arm/mach-rk3026/board-rk3028a-tb.c b/arch/arm/mach-rk3026/board-rk3028a-tb.c index 394505ec721c..1cdbb622ab1e 100755 --- a/arch/arm/mach-rk3026/board-rk3028a-tb.c +++ b/arch/arm/mach-rk3026/board-rk3028a-tb.c @@ -721,40 +721,40 @@ static struct rfkill_rk_platform_data rfkill_rk_platdata = { }, .reset_gpio = { // BT_RST - .io = RK30_PIN1_PB3, // set io to INVALID_GPIO for disable it + .io = RK30_PIN3_PD5, // set io to INVALID_GPIO for disable it .enable = GPIO_LOW, .iomux = { .name = "bt_reset", - .fgpio = GPIO1_B3, + //.fgpio = GPIO3_D5, }, }, .wake_gpio = { // BT_WAKE, use to control bt's sleep and wakeup - .io = RK30_PIN1_PB2, // set io to INVALID_GPIO for disable it + .io = RK30_PIN0_PC6, // set io to INVALID_GPIO for disable it .enable = GPIO_HIGH, .iomux = { .name = "bt_wake", - .fgpio = GPIO1_B2, + //.fgpio = GPIO0_C6, }, }, .wake_host_irq = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep .gpio = { - .io = RK30_PIN0_PA4, // set io to INVALID_GPIO for disable it + .io = RK30_PIN0_PC5, // set io to INVALID_GPIO for disable it .enable = GPIO_LOW, // set GPIO_LOW for falling, set 0 for rising .iomux = { .name = "bt_wake_host", - //.fgpio = GPIO0_A4, + //.fgpio = GPIO0_C5, }, }, }, .rts_gpio = { // UART_RTS, enable or disable BT's data coming - .io = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it + .io = RK30_PIN0_PC3, // set io to INVALID_GPIO for disable it .enable = GPIO_LOW, .iomux = { .name = "bt_rts", - .fgpio = GPIO1_A3, + .fgpio = GPIO0_C3, .fmux = UART0_RTSN, }, } @@ -1153,6 +1153,11 @@ static void __init machine_rk30_board_init(void) spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices)); platform_add_devices(devices, ARRAY_SIZE(devices)); rk_platform_add_display_devices(); +#if defined(CONFIG_WIFI_CONTROL_FUNC) + rk29sdk_wifi_bt_gpio_control_init(); +#elif defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) + rk29sdk_wifi_combo_module_gpio_init(); +#endif } static void __init rk30_reserve(void) diff --git a/arch/arm/plat-rk/rk-sdmmc-ops.c b/arch/arm/plat-rk/rk-sdmmc-ops.c index 1cdc8e9f616d..e0a83d30be00 100644 --- a/arch/arm/plat-rk/rk-sdmmc-ops.c +++ b/arch/arm/plat-rk/rk-sdmmc-ops.c @@ -461,6 +461,185 @@ static struct rksdmmc_gpio_board rksdmmc1_gpio_init = { }; // ---end -#if defined(CONFIG_ARCH_RK2928) +#elif defined(CONFIG_ARCH_RK3026) +/* +* define the gpio for sdmmc0 +*/ +static struct rksdmmc_gpio_board rksdmmc0_gpio_init = { + + .clk_gpio = { + .io = RK30_PIN1_PC0, + .enable = GPIO_HIGH, + .iomux = { + .name = "mmc0_clk", + .fgpio = GPIO1_C0, + .fmux = MMC0_CLKOUT, + }, + }, + + .cmd_gpio = { + .io = RK30_PIN1_PB7, + .enable = GPIO_HIGH, + .iomux = { + .name = "mmc0_cmd", + .fgpio = GPIO1_B7, + .fmux = MMC0_CMD, + }, + }, + + .data0_gpio = { + .io = RK30_PIN1_PC2, + .enable = GPIO_HIGH, + .iomux = { + .name = "mmc0_d0", + .fgpio = GPIO1_C2, + .fmux = MMC0_D0, + }, + }, + + .data1_gpio = { + .io = RK30_PIN1_PC3, + .enable = GPIO_HIGH, + .iomux = { + .name = "mmc0_d1", + .fgpio = GPIO1_C3, + .fmux = MMC0_D1, + }, + }, + + .data2_gpio = { + .io = RK30_PIN1_PC4, + .enable = GPIO_HIGH, + .iomux = { + .name = "mmc0_d2", + .fgpio = GPIO1_C4, + .fmux = MMC0_D2, + }, + }, + + .data3_gpio = { + .io = RK30_PIN1_PC5, + .enable = GPIO_HIGH, + .iomux = { + .name = "mmc0_d3", + .fgpio = GPIO1_C5, + .fmux = MMC0_D3, + }, + }, + + + .power_en_gpio = { +#if defined(RK29SDK_SD_CARD_PWR_EN) || (INVALID_GPIO != RK29SDK_SD_CARD_PWR_EN) + .io = RK29SDK_SD_CARD_PWR_EN, + .enable = RK29SDK_SD_CARD_PWR_EN_LEVEL, + #ifdef RK29SDK_SD_CARD_PWR_EN_PIN_NAME + .iomux = { + .name = RK29SDK_SD_CARD_PWR_EN_PIN_NAME, + #ifdef RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO + .fgpio = RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO, + #endif + #ifdef RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX + .fmux = RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX, + #endif + }, + #endif +#else + .io = INVALID_GPIO, + .enable = GPIO_LOW, +#endif + }, + + .detect_irq = { +#if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N) + .io = RK29SDK_SD_CARD_DETECT_N, + .enable = RK29SDK_SD_CARD_INSERT_LEVEL, + #ifdef RK29SDK_SD_CARD_DETECT_PIN_NAME + .iomux = { + .name = RK29SDK_SD_CARD_DETECT_PIN_NAME, + #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO + .fgpio = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO, + #endif + #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FMUX + .fmux = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX, + #endif + }, + #endif +#else + .io = INVALID_GPIO, + .enable = GPIO_LOW, +#endif + }, +}; + + +/* +* define the gpio for sdmmc1 +*/ +static struct rksdmmc_gpio_board rksdmmc1_gpio_init = { + + .clk_gpio = { + .io = RK30_PIN0_PB1, + .enable = GPIO_HIGH, + .iomux = { + .name = "mmc1_clk", + .fgpio = GPIO0_B1, + .fmux = MMC1_CLKOUT, + }, + }, + + .cmd_gpio = { + .io = RK30_PIN0_PB0, + .enable = GPIO_HIGH, + .iomux = { + .name = "mmc1_cmd", + .fgpio = GPIO0_B0, + .fmux = MMC1_CMD, + }, + }, + + .data0_gpio = { + .io = RK30_PIN0_PB3, + .enable = GPIO_HIGH, + .iomux = { + .name = "mmc1_d0", + .fgpio = GPIO0_B3, + .fmux = MMC1_D0, + }, + }, + + .data1_gpio = { + .io = RK30_PIN0_PB4, + .enable = GPIO_HIGH, + .iomux = { + .name = "mmc1_d1", + .fgpio = GPIO0_B4, + .fmux = MMC1_D1, + }, + }, + + .data2_gpio = { + .io = RK30_PIN0_PB5, + .enable = GPIO_HIGH, + .iomux = { + .name = "mmc1_d2", + .fgpio = GPIO0_B5, + .fmux = MMC1_D2, + }, + }, + + .data3_gpio = { + .io = RK30_PIN0_PB6, + .enable = GPIO_HIGH, + .iomux = { + .name = "mmc1_d3", + .fgpio = GPIO0_B6, + .fmux = MMC1_D3, + }, + }, + + +}; +// ---end -#if defined(CONFIG_ARCH_RK3026) #else //default for RK30,RK3066 SDK /* -- 2.34.1