From ba544242b23c25616de0ba76c2998c239f618a6f Mon Sep 17 00:00:00 2001 From: wdc Date: Thu, 26 Sep 2013 14:56:57 +0800 Subject: [PATCH] AndroidComputer: wifi,bt,ethernet board config --- arch/arm/configs/rk3188_ac_defconfig | 9 +- .../board-rk3188-ac-sdmmc-config.c | 172 ++++++++++++++++++ arch/arm/mach-rk3188/board-rk3188-ac.c | 20 +- 3 files changed, 192 insertions(+), 9 deletions(-) create mode 100644 arch/arm/mach-rk3188/board-rk3188-ac-sdmmc-config.c diff --git a/arch/arm/configs/rk3188_ac_defconfig b/arch/arm/configs/rk3188_ac_defconfig index fbb726e83c90..9d1815dfc8db 100644 --- a/arch/arm/configs/rk3188_ac_defconfig +++ b/arch/arm/configs/rk3188_ac_defconfig @@ -202,11 +202,14 @@ CONFIG_BLK_DEV_DM=y CONFIG_DM_CRYPT=y CONFIG_DM_UEVENT=y CONFIG_NETDEVICES=y -CONFIG_PHYLIB=y +CONFIG_NET_ETHERNET=y +CONFIG_RK29_VMAC=y # CONFIG_NETDEV_1000 is not set # CONFIG_NETDEV_10000 is not set CONFIG_WLAN_80211=y -CONFIG_MT5931_MT6622=y +# CONFIG_BCM_OOB_ENABLED is not set +CONFIG_RKWIFI=y +CONFIG_AP6210=y CONFIG_USB_USBNET=y CONFIG_PPP=y CONFIG_PPP_MULTILINK=y @@ -398,6 +401,8 @@ CONFIG_MMC_UNSAFE_RESUME=y CONFIG_MMC_EMBEDDED_SDIO=y CONFIG_MMC_PARANOID_SD_INIT=y CONFIG_SDMMC_RK29=y +CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD=y +# CONFIG_SDMMC1_RK29 is not set CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_GPIO=y diff --git a/arch/arm/mach-rk3188/board-rk3188-ac-sdmmc-config.c b/arch/arm/mach-rk3188/board-rk3188-ac-sdmmc-config.c new file mode 100644 index 000000000000..7943695bed4e --- /dev/null +++ b/arch/arm/mach-rk3188/board-rk3188-ac-sdmmc-config.c @@ -0,0 +1,172 @@ +/***************************************************************************************** + * arch/arm/mach-rkxx/baord-xxx-sdmmc-config.c + * + * Copyright (C) 2013 ROCKCHIP, Inc. + * + * Description: + * define the gpio for SD-MMC-SDIO-Wifi functions according to your own projects. + * + * Author: Michael Xie + * 15 Jan,2013 + * E-mail: xbw@rock-chips.com + * + ******************************************************************************************/ + +#define DS1006H_V1_2_SUPPORT 1 + +/* +** If you select the macro of CONFIG_SDMMC0_RK29_WRITE_PROTECT, You must define the following values. +** Otherwise, there is no need to define the following values¡£ +*/ +//#define SDMMC0_WRITE_PROTECT_PIN RK30_PIN3_PB2 //According to your own project to set the value of write-protect-pin. +//#define SDMMC0_WRITE_PROTECT_ENABLE_VALUE GPIO_HIGH + +/* +** If you select the macro of CONFIG_SDMMC1_RK29_WRITE_PROTECT, You must define the following values. +** Otherwise, there is no need to define the following values¡£ +*/ +//#define SDMMC1_WRITE_PROTECT_PIN RK30_PIN3_PB3 //According to your own project to set the value of write-protect-pin. +//#define SDMMC1_WRITE_PROTECT_ENABLE_VALUE GPIO_HIGH + +/* +** If you select the macro of CONFIG_RK29_SDIO_IRQ_FROM_GPIO, You must define the following values. +** Otherwise, there is no need to define the following values¡£ +*/ +//#define RK29SDK_WIFI_SDIO_CARD_INT RK30_PIN3_PD2 + + +/* +* define sdcard PowerEn-pin +*/ +#define RK29SDK_SD_CARD_PWR_EN RK30_PIN3_PA1 +#define RK29SDK_SD_CARD_PWR_EN_LEVEL GPIO_LOW +int rk31sdk_get_sdmmc0_pin_io_voltage(void) +{ + int voltage; +#define RK31SDK_SET_SDMMC0_PIN_VOLTAGE + + /************************************************************************************** + ** Please tell me how much voltage of your SDMMC0-pin in your project. + ** + ** ÀýÈç: ÓеÄÏîÄ¿£¬ËüµÄSDMMC0ËùÔÚµÄRKÖ÷¿ØµÄIO×飬ÏëÓÃ1.8V, ¶ø¿¨±¾ÉíÓÃ3.3V, + ** ¶øÖмäͨ¹ý¸öµçƽת»».ÄÇô£¬Äú´Ëʱ£¬Ó¦¸ÃÉèÖÃÏÂÃæµÄvoltageֵΪ 1.8V(¼´1800mv) + ***************************************************************************************/ + voltage = 3300; //default the voltage 3300mv. + + return voltage; +} + +/* +* define the card-detect-pin. +*/ +#define RK29SDK_SD_CARD_DETECT_N RK30_PIN3_PB0 //According to your own project to set the value of card-detect-pin. +#define RK29SDK_SD_CARD_INSERT_LEVEL GPIO_LOW // set the voltage of insert-card. Please pay attention to the default setting. + +#define RK30SDK_WIFI_GPIO_WIFI_INT_B RK30_PIN3_PD2 +#define RK30SDK_WIFI_GPIO_WIFI_INT_B_ENABLE_VALUE GPIO_HIGH + +/* +* Define wifi module's power and reset gpio, and gpio sensitive level. +* Please set the value according to your own project. +* +* Well, you just own engineering module to set the value in the corresponding module branch. +* Otherwise, you do not define this macro, eliminate it. +* +*/ +#if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) || defined(CONFIG_RTL8723AU) + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD0 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_LOW//GPIO_HIGH + +#elif defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RKWIFI) \ + || defined(CONFIG_RTL8189ES) + + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PA1 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH + + //#define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN2_PA7 + //#define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH + +#elif defined(CONFIG_MT5931_MT6622) || defined(CONFIG_MT5931) + + #ifdef CONFIG_MACH_RK3168_LR097 + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD0 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH + + //#define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN3_PD1 + //#define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH + + #else + #if DS1006H_V1_2_SUPPORT + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD0 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH + #else + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN0_PA5 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH + + #define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN3_PD1 + #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH + #endif + #endif + +#elif defined(CONFIG_MT6620) + #define COMBO_MODULE_MT6620_CDT 1 // to control antsel2,antsel3 and gps_lan foot when using AcSip or Cdtech chip. + //- 1--use Cdtech chip; 0--unuse CDT chip + + //power, PMU_EN + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PC7 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH + //reset, DAIRST,SYSRST_B + #define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN3_PD1 + #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH + //VDDIO + //#define RK30SDK_WIFI_GPIO_VCCIO_WL RK30_PIN0_PD2 //You do not get control of the foot, and you do not need to define the macro + //#define RK30SDK_WIFI_GPIO_VCCIO_WL_ENABLE_VALUE GPIO_HIGH + //WIFI_INT_B + #define RK30SDK_WIFI_GPIO_WIFI_INT_B RK30_PIN3_PD2 + #define RK30SDK_WIFI_GPIO_WIFI_INT_B_ENABLE_VALUE GPIO_HIGH + //BGF_INT_B + #define RK30SDK_WIFI_GPIO_BGF_INT_B RK30_PIN6_PA7 + #define RK30SDK_WIFI_GPIO_BGF_INT_B_ENABLE_VALUE GPIO_HIGH + //GPS_SYNC + #define RK30SDK_WIFI_GPIO_GPS_SYNC RK30_PIN3_PD0 + #define RK30SDK_WIFI_GPIO_GPS_SYNC_ENABLE_VALUE GPIO_HIGH + + #if COMBO_MODULE_MT6620_CDT + //ANTSEL2 + #define RK30SDK_WIFI_GPIO_ANTSEL2 RK30_PIN4_PD4 + #define RK30SDK_WIFI_GPIO_ANTSEL2_ENABLE_VALUE GPIO_LOW //use 6620 in CDT chip, LOW--work; High--no work. + //ANTSEL3 + #define RK30SDK_WIFI_GPIO_ANTSEL3 RK30_PIN4_PD3 + #define RK30SDK_WIFI_GPIO_ANTSEL3_ENABLE_VALUE GPIO_HIGH //use 6620 in CDT chip, High--work; Low--no work.. + //GPS_LAN + #define RK30SDK_WIFI_GPIO_GPS_LAN RK30_PIN4_PD6 + #define RK30SDK_WIFI_GPIO_GPS_LAN_ENABLE_VALUE GPIO_HIGH //use 6620 in CDT chip, High--work; Low--no work.. + #endif // #if COMBO_MODULE_MT6620_CDT--#endif +#endif + +int rk31sdk_get_sdio_wifi_voltage(void) +{ + int voltage; + + /****************************************************************************** + ** Please tell me how much wifi-module uses voltage in your project. + ******************************************************************************/ +#if defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RKWIFI) + voltage = 1800 ; //power 1800mV + +#elif defined(CONFIG_MT5931_MT6622)||defined(CONFIG_MT5931) + voltage = 2800 ; //power 1800V +#elif defined(CONFIG_MT6620) + voltage = 2800 ; //power 2800V +#elif defined(CONFIG_RDA5990)||defined(CONFIG_RTL8723AS) || defined(CONFIG_RTL8189ES) + voltage = 3300 ; //power 3300V +#else + //default, sdio use 3.0V + voltage = 3000 ; //power 3000V +#endif + + return voltage; +} + + + diff --git a/arch/arm/mach-rk3188/board-rk3188-ac.c b/arch/arm/mach-rk3188/board-rk3188-ac.c index 9bf68649c678..89f3a6ec30de 100755 --- a/arch/arm/mach-rk3188/board-rk3188-ac.c +++ b/arch/arm/mach-rk3188/board-rk3188-ac.c @@ -725,7 +725,7 @@ static struct platform_device device_ion = { * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05 **************************************************************************************************/ #ifdef CONFIG_SDMMC_RK29 -#include "board-rk3188-ds1006h-sdmmc-config.c" +#include "board-rk3188-ac-sdmmc-config.c" #include "../plat-rk/rk-sdmmc-ops.c" #include "../plat-rk/rk-sdmmc-wifi.c" #endif //endif ---#ifdef CONFIG_SDMMC_RK29 @@ -794,7 +794,7 @@ struct rk29_sdmmc_platform_data default_sdmmc0_data = { .use_dma = 0, #endif -#if defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) && defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD) +#if defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD) .status = rk29sdk_wifi_mmc0_status, .register_status_notify = rk29sdk_wifi_mmc0_status_register, #endif @@ -1096,6 +1096,12 @@ struct platform_device pwm_regulator_device[1] = { }; #endif +#ifdef CONFIG_RK29_VMAC +#define PHY_PWR_EN_GPIO RK30_PIN0_PC0 +#define PHY_PWR_EN_VALUE GPIO_HIGH +#include "../mach-rk30/board-rk31-sdk-vmac.c" +#endif + #ifdef CONFIG_RFKILL_RK // bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c static struct rfkill_rk_platform_data rfkill_rk_platdata = { @@ -1111,26 +1117,26 @@ static struct rfkill_rk_platform_data rfkill_rk_platdata = { }, .reset_gpio = { // BT_RST - .io = RK30_PIN3_PD1, // set io to INVALID_GPIO for disable it + .io = RK30_PIN3_PA0, // set io to INVALID_GPIO for disable it .enable = GPIO_LOW, .iomux = { .name = "bt_reset", - .fgpio = GPIO3_D1, + .fgpio = GPIO3_A0, }, }, .wake_gpio = { // BT_WAKE, use to control bt's sleep and wakeup - .io = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it + .io = RK30_PIN3_PB0, // set io to INVALID_GPIO for disable it .enable = GPIO_HIGH, .iomux = { .name = "bt_wake", - .fgpio = GPIO3_C6, + .fgpio = GPIO3_B0, }, }, .wake_host_irq = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep .gpio = { - .io = RK30_PIN0_PA5, // set io to INVALID_GPIO for disable it + .io = RK30_PIN3_PB1, // set io to INVALID_GPIO for disable it .enable = GPIO_LOW, // set GPIO_LOW for falling, set 0 for rising .iomux = { .name = NULL, -- 2.34.1