From: hwg Date: Sun, 30 Dec 2012 14:37:56 +0000 (+0800) Subject: fix CONFIG_MT5931(wifi) bug: on LR097 X-Git-Tag: firefly_0821_release~8032 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=aa3ce52a11b095764cd29877bc5c145b5c98ba6e;p=firefly-linux-kernel-4.4.55.git fix CONFIG_MT5931(wifi) bug: on LR097 --- diff --git a/arch/arm/configs/rk3168_LR097_defconfig b/arch/arm/configs/rk3168_LR097_defconfig index 6857806ac373..fe3010090e24 100644 --- a/arch/arm/configs/rk3168_LR097_defconfig +++ b/arch/arm/configs/rk3168_LR097_defconfig @@ -177,10 +177,8 @@ CONFIG_BT_HIDP=y CONFIG_BT_HCIUART=y CONFIG_BT_HCIUART_H4=y CONFIG_BT_HCIUART_LL=y -CONFIG_BT_HCIBCM4325=y -CONFIG_BT_AUTOSLEEP=y +CONFIG_MAC80211=y CONFIG_RFKILL=y -CONFIG_RFKILL_RK=y CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y # CONFIG_FIRMWARE_IN_KERNEL is not set @@ -206,7 +204,7 @@ CONFIG_PHYLIB=y # CONFIG_NETDEV_1000 is not set # CONFIG_NETDEV_10000 is not set CONFIG_WLAN_80211=y -CONFIG_RKWIFI=y +CONFIG_MT5931_MT6622=y CONFIG_USB_USBNET=y CONFIG_PPP=y CONFIG_PPP_MULTILINK=y @@ -260,9 +258,8 @@ CONFIG_PS_STK3171=y # CONFIG_LEGACY_PTYS is not set CONFIG_SERIAL_RK29=y CONFIG_UART0_RK29=y -CONFIG_UART0_CTS_RTS_RK29=y -CONFIG_UART3_RK29=y -CONFIG_UART3_CTS_RTS_RK29=y +CONFIG_UART0_DMA_RK29=2 +CONFIG_UART2_RK29=y # CONFIG_HW_RANDOM is not set CONFIG_I2C=y # CONFIG_I2C_COMPAT is not set @@ -292,8 +289,6 @@ CONFIG_RK30_PWM_REGULATOR=y CONFIG_MEDIA_SUPPORT=y CONFIG_VIDEO_DEV=y CONFIG_SOC_CAMERA=y -CONFIG_SOC_CAMERA_OV2659=y -CONFIG_SOC_CAMERA_OV5642=y CONFIG_VIDEO_RK29=y CONFIG_VIDEO_RK29_CAMMEM_ION=y CONFIG_ION=y diff --git a/arch/arm/mach-rk30/board-rk30-sdk-sdmmc.c b/arch/arm/mach-rk30/board-rk30-sdk-sdmmc.c index fdae0fb89ee6..27d87a5ae542 100755 --- a/arch/arm/mach-rk30/board-rk30-sdk-sdmmc.c +++ b/arch/arm/mach-rk30/board-rk30-sdk-sdmmc.c @@ -351,7 +351,7 @@ #endif #elif defined(CONFIG_ARCH_RK3066B)//refer to file /arch/arm/mach-rk30/include/mach/iomux-rk3066b.h #define WIFI_HOST_WAKE RK30_PIN3_PD2 - + #if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD0 #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_LOW//GPIO_HIGH @@ -368,6 +368,17 @@ #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH #define RK30SDK_WIFI_GPIO_RESET_PIN_NAME GPIO2A7_LCDC1DATA7_SMCDATA7_TRACEDATA7_NAME #define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO GPIO2A_GPIO2A7 + + #elif defined(CONFIG_MT5931_MT6622) || defined(CONFIG_MT5931) + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD0 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH + #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME GPIO3D0_SDMMC1PWREN_MIIMD_NAME + #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO GPIO3D_GPIO3D0 + + //#define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN3_PD1 + //#define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH + //#define RK30SDK_WIFI_GPIO_RESET_PIN_NAME GPIO3D1_SDMMC1BACKENDPWR_MIIMDCLK_NAME + //#define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO GPIO3D_GPIO3D1 #endif #elif defined(CONFIG_ARCH_RK2928) //refer to file ./arch/arm/mach-rk2928/include/mach/iomux.h #define WIFI_HOST_WAKE RK2928_PIN3_PC0 diff --git a/arch/arm/mach-rk30/board-rk3168-LR097.c b/arch/arm/mach-rk30/board-rk3168-LR097.c index 07962e6c6993..bfbbde5e9441 100644 --- a/arch/arm/mach-rk30/board-rk3168-LR097.c +++ b/arch/arm/mach-rk30/board-rk3168-LR097.c @@ -1296,6 +1296,42 @@ struct platform_device rk_device_gps = { }; #endif +#if defined(CONFIG_MT5931_MT6622) +static struct mt6622_platform_data mt6622_platdata = { + .power_gpio = { // BT_REG_ON + .io = RK30_PIN3_PC7, // set io to INVALID_GPIO for disable it + .enable = GPIO_HIGH, + .iomux = { + .name = NULL, + }, + }, + + .reset_gpio = { // BT_RST + .io = RK30_PIN3_PD1, + .enable = GPIO_HIGH, + .iomux = { + .name = NULL, + }, + }, + + .irq_gpio = { + .io = RK30_PIN0_PA5, + .enable = GPIO_HIGH, + .iomux = { + .name = NULL, + }, + } +}; + +static struct platform_device device_mt6622 = { + .name = "mt6622", + .id = -1, + .dev = { + .platform_data = &mt6622_platdata, + }, +}; + +#endif static struct platform_device *devices[] __initdata = { #ifdef CONFIG_FB_ROCKCHIP @@ -1348,6 +1384,9 @@ static struct platform_device *devices[] __initdata = { #ifdef CONFIG_GPS_RK &rk_device_gps, #endif +#ifdef CONFIG_MT5931_MT6622 + &device_mt6622, +#endif }; @@ -2052,14 +2091,14 @@ static void __init rk30_reserve(void) * comments : min arm/logic voltage */ static struct dvfs_arm_table dvfs_cpu_logic_table[] = { - {.frequency = 312 * 1000, .cpu_volt = 850 * 1000, .logic_volt = 1000 * 1000}, +/* {.frequency = 312 * 1000, .cpu_volt = 850 * 1000, .logic_volt = 1000 * 1000}, {.frequency = 504 * 1000, .cpu_volt = 900 * 1000, .logic_volt = 1000 * 1000}, - {.frequency = 816 * 1000, .cpu_volt = 950 * 1000, .logic_volt = 1000 * 1000}, - {.frequency = 1008 * 1000, .cpu_volt = 1025 * 1000, .logic_volt = 1000 * 1000}, +*/ {.frequency = 816 * 1000, .cpu_volt = 950 * 1000, .logic_volt = 1000 * 1000}, +/* {.frequency = 1008 * 1000, .cpu_volt = 1025 * 1000, .logic_volt = 1000 * 1000}, {.frequency = 1200 * 1000, .cpu_volt = 1100 * 1000, .logic_volt = 1050 * 1000}, {.frequency = 1416 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1150 * 1000}, {.frequency = 1608 * 1000, .cpu_volt = 1300 * 1000, .logic_volt = 1250 * 1000}, - {.frequency = CPUFREQ_TABLE_END}, +*/ {.frequency = CPUFREQ_TABLE_END}, }; static struct cpufreq_frequency_table dvfs_gpu_table[] = { diff --git a/drivers/mtk_wcn_bt/bt_hwctl.h b/drivers/mtk_wcn_bt/bt_hwctl.h index 140212c04cdf..3149033007c4 100755 --- a/drivers/mtk_wcn_bt/bt_hwctl.h +++ b/drivers/mtk_wcn_bt/bt_hwctl.h @@ -50,6 +50,7 @@ struct gpio_set { extern void mt_bt_gpio_init(void); extern void mt_bt_gpio_release(void); +extern int mt_bt_power_init(void); extern int mt_bt_power_on(void); extern void mt_bt_power_off(void); diff --git a/drivers/mtk_wcn_bt/bt_hwctl_dev.c b/drivers/mtk_wcn_bt/bt_hwctl_dev.c index 8838cb849718..d073bbc28a72 100755 --- a/drivers/mtk_wcn_bt/bt_hwctl_dev.c +++ b/drivers/mtk_wcn_bt/bt_hwctl_dev.c @@ -242,24 +242,32 @@ static int mt6622_probe(struct platform_device *pdev) return -1; } - if (gpio_request(pdata->power_gpio.io, "BT_PWR_EN")){ - printk("mt6622 power_gpio is busy!\n"); - return -1; + if(pdata->power_gpio.io != INVALID_GPIO) { + if (gpio_request(pdata->power_gpio.io, "BT_PWR_EN")){ + printk("mt6622 power_gpio is busy!\n"); + return -1; + } } - if (gpio_request(pdata->reset_gpio.io, "BT_RESET")){ - printk("mt6622 reset_gpio is busy!\n"); - gpio_free(pdata->power_gpio.io); - return -1; + if(pdata->reset_gpio.io != INVALID_GPIO) { + if (gpio_request(pdata->reset_gpio.io, "BT_RESET")){ + printk("mt6622 reset_gpio is busy!\n"); + gpio_free(pdata->power_gpio.io); + return -1; + } } - if (gpio_request(pdata->irq_gpio.io, "BT_EINT")){ - printk("mt6622 irq_gpio is busy!\n"); - gpio_free(pdata->power_gpio.io); - gpio_free(pdata->reset_gpio.io); - return -1; + if(pdata->irq_gpio.io != INVALID_GPIO) { + if (gpio_request(pdata->irq_gpio.io, "BT_EINT")){ + printk("mt6622 irq_gpio is busy!\n"); + gpio_free(pdata->power_gpio.io); + gpio_free(pdata->reset_gpio.io); + return -1; + } } + mt_bt_power_init(); + return 0; } @@ -270,9 +278,12 @@ static int mt6622_remove(struct platform_device *pdev) printk("mt6622_remove.\n"); if(pdata) { - gpio_free(pdata->power_gpio.io); - gpio_free(pdata->reset_gpio.io); - gpio_free(pdata->irq_gpio.io); + if(pdata->power_gpio.io != INVALID_GPIO) + gpio_free(pdata->power_gpio.io); + if(pdata->reset_gpio.io != INVALID_GPIO) + gpio_free(pdata->reset_gpio.io); + if(pdata->irq_gpio.io != INVALID_GPIO) + gpio_free(pdata->irq_gpio.io); } return 0; diff --git a/drivers/mtk_wcn_bt/bt_plat_smdk.c b/drivers/mtk_wcn_bt/bt_plat_smdk.c index 1d829883c0df..3af0cd10ec3b 100755 --- a/drivers/mtk_wcn_bt/bt_plat_smdk.c +++ b/drivers/mtk_wcn_bt/bt_plat_smdk.c @@ -58,8 +58,14 @@ static int irq_num = -1; static int mt_bt_request_irq(void) { int iRet; + int trigger = IRQF_TRIGGER_HIGH; + struct mt6622_platform_data *pdata = (struct mt6622_platform_data *)mt_bt_get_platform_data(); + + if(pdata->irq_gpio.enable == GPIO_LOW) + trigger = IRQF_TRIGGER_RISING; + iRet = request_irq(irq_num, mt_bt_eirq_handler, - /*IRQF_TRIGGER_RISING*/IRQF_TRIGGER_HIGH, "BT_INT_B", NULL); + trigger, "BT_INT_B", NULL); if (iRet){ printk(KERN_ALERT MODULE_TAG "request_irq IRQ%d fails, errno %d\n", irq_num, iRet); } @@ -100,6 +106,38 @@ EXPORT_SYMBOL(mt_bt_disable_irq); * P O W E R C O N T R O L * *****************************************************************************/ +int mt_bt_power_init(void) +{ + struct mt6622_platform_data *pdata; + + printk(KERN_INFO MODULE_TAG "mt_bt_power_init\n"); + + pdata = (struct mt6622_platform_data *)mt_bt_get_platform_data(); + + if(pdata) { + + // PWR_EN and RESET + /* PWR_EN set to gpio output low */ + if(pdata->power_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->power_gpio.io, 0); + /* RESET set to gpio output low */ + if(pdata->reset_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->reset_gpio.io, 0); + msleep(200); + + /* RESET pull up */ + if(pdata->reset_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->reset_gpio.io, 1); + msleep(1000); + + //pdata->power_gpio.io = INVALID_GPIO; + pdata->reset_gpio.io = INVALID_GPIO; + } + + return 0; +} +EXPORT_SYMBOL(mt_bt_power_init); + int mt_bt_power_on(void) { int error; @@ -117,12 +155,14 @@ int mt_bt_power_on(void) // EINT //--s3c_gpio_cfgpin(GPIO_BT_EINT_PIN, S3C_GPIO_SFN(0)); //--s3c_gpio_setpull(GPIO_BT_EINT_PIN, S3C_GPIO_PULL_DOWN); - gpio_direction_input(pdata->irq_gpio.io); + if(pdata->irq_gpio.io != INVALID_GPIO) + gpio_direction_input(pdata->irq_gpio.io); //gpio_pull_updown(pdata->irq_gpio->io, GPIOPullDown); /* set to EINT mode */ //--s3c_gpio_cfgpin(GPIO_BT_EINT_PIN, S3C_GPIO_SFN(0xF)); /* get irq number */ - irq_num = gpio_to_irq(pdata->irq_gpio.io); + if(pdata->irq_gpio.io != INVALID_GPIO) + irq_num = gpio_to_irq(pdata->irq_gpio.io); //mt_set_gpio_mode(GPIO_BT_EINT_PIN, GPIO_BT_EINT_PIN_M_GPIO); //mt_set_gpio_pull_enable(GPIO_BT_EINT_PIN, 1); //mt_set_gpio_pull_select(GPIO_BT_EINT_PIN, GPIO_PULL_DOWN); @@ -134,24 +174,31 @@ int mt_bt_power_on(void) // PWR_EN and RESET /* PWR_EN set to gpio output low */ - gpio_direction_output(pdata->power_gpio.io, 0); + if(pdata->power_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->power_gpio.io, 0); /* RESET set to gpio output low */ - gpio_direction_output(pdata->reset_gpio.io, 0); + if(pdata->reset_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->reset_gpio.io, 0); msleep(200); /* PWR_EN pull up */ - gpio_direction_output(pdata->power_gpio.io, 1); + if(pdata->power_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->power_gpio.io, 1); msleep(200); /* RESET pull up */ - gpio_direction_output(pdata->reset_gpio.io, 1); + if(pdata->reset_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->reset_gpio.io, 1); msleep(1000); error = mt_bt_request_irq(); if (error){ - gpio_direction_output(pdata->power_gpio.io, 0); - gpio_direction_output(pdata->reset_gpio.io, 0); + if(pdata->power_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->power_gpio.io, 0); + if(pdata->reset_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->reset_gpio.io, 0); //--s3c_gpio_cfgpin(GPIO_BT_EINT_PIN, S3C_GPIO_SFN(1)); - gpio_direction_output(pdata->irq_gpio.io, 0); + if(pdata->irq_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->irq_gpio.io, 0); return error; } } @@ -173,12 +220,15 @@ void mt_bt_power_off(void) if(pdata) { // PWR_EN and RESET - gpio_direction_output(pdata->power_gpio.io, 0); - gpio_direction_output(pdata->reset_gpio.io, 0); + if(pdata->power_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->power_gpio.io, 0); + if(pdata->reset_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->reset_gpio.io, 0); // EINT //--s3c_gpio_cfgpin(GPIO_BT_EINT_PIN, S3C_GPIO_SFN(1)); - gpio_direction_output(pdata->irq_gpio.io, 0); + if(pdata->irq_gpio.io != INVALID_GPIO) + gpio_direction_output(pdata->irq_gpio.io, 0); mt_bt_free_irq(); }