From 64a1ccaaecab8c4e6c1360877c66a6980a7e5332 Mon Sep 17 00:00:00 2001 From: hj Date: Wed, 28 Nov 2012 11:45:11 +0800 Subject: [PATCH] rk292x (v86 & tr726) :add sd-vcc control while sd hw initial --- arch/arm/mach-rk2928/board-rk2926-sdk.c | 22 ++++++++++++++++++++++ arch/arm/mach-rk2928/board-rk2928-sdk.c | 17 +++++++++++++++++ arch/arm/plat-rk/include/plat/board.h | 1 + block/blk-core.c | 2 ++ drivers/mmc/host/rk29_sdmmc.c | 16 ++++++++++++++++ fs/fat/misc.c | 2 ++ 6 files changed, 60 insertions(+) diff --git a/arch/arm/mach-rk2928/board-rk2926-sdk.c b/arch/arm/mach-rk2928/board-rk2926-sdk.c index a069676e9803..dffaa1ea1949 100755 --- a/arch/arm/mach-rk2928/board-rk2926-sdk.c +++ b/arch/arm/mach-rk2928/board-rk2926-sdk.c @@ -647,6 +647,25 @@ static int rk29_sdmmc0_cfg_gpio(void) return 0; } +#if defined(CONFIG_MACH_RK2926_V86) +int rk2926_v86_sd_vcc_reset(){ + struct regulator *vcc; + + vcc = regulator_get(NULL,"vmmc"); + if (vcc == NULL || IS_ERR(vcc) ){ + printk("%s get cif vaux33 ldo failed!\n",__func__); + return -1 ; + } + + + printk("hj---->rk29_sdmmc_hw_init get vmmc regulator successfully \n\n\n"); + regulator_disable(vcc); + mdelay(2000); + regulator_enable(vcc); + +} +#endif + #define CONFIG_SDMMC0_USE_DMA struct rk29_sdmmc_platform_data default_sdmmc0_data = { .host_ocr_avail = @@ -684,6 +703,9 @@ struct rk29_sdmmc_platform_data default_sdmmc0_data = { #else .write_prt = INVALID_GPIO, #endif +#if defined(CONFIG_MACH_RK2926_V86) + .sd_vcc_reset = rk2926_v86_sd_vcc_reset , +#endif .det_pin_info = { .io = RK29SDK_SD_CARD_DETECT_N, //INVALID_GPIO, diff --git a/arch/arm/mach-rk2928/board-rk2928-sdk.c b/arch/arm/mach-rk2928/board-rk2928-sdk.c index 66eb4f5f6bcf..3ffe4a8c4b9b 100755 --- a/arch/arm/mach-rk2928/board-rk2928-sdk.c +++ b/arch/arm/mach-rk2928/board-rk2928-sdk.c @@ -571,6 +571,22 @@ static int rk29_sdmmc0_cfg_gpio(void) return 0; } +int rk2928_sd_vcc_reset(){ + struct regulator *vcc; + + vcc = regulator_get(NULL,"act_ldo4"); + if (vcc == NULL || IS_ERR(vcc) ){ + printk("%s get cif vaux33 ldo failed!\n",__func__); + return -1 ; + } + + printk("hj---->rk29_sdmmc_hw_init get vmmc regulator successfully \n\n\n"); + regulator_disable(vcc); + mdelay(2000); + regulator_enable(vcc); + +} + #define CONFIG_SDMMC0_USE_DMA struct rk29_sdmmc_platform_data default_sdmmc0_data = { .host_ocr_avail = @@ -608,6 +624,7 @@ struct rk29_sdmmc_platform_data default_sdmmc0_data = { #else .write_prt = INVALID_GPIO, #endif + .sd_vcc_reset = rk2928_sd_vcc_reset , .det_pin_info = { .io = RK29SDK_SD_CARD_DETECT_N, //INVALID_GPIO, diff --git a/arch/arm/plat-rk/include/plat/board.h b/arch/arm/plat-rk/include/plat/board.h index 2f74c56bec6b..19683e2f0de5 100755 --- a/arch/arm/plat-rk/include/plat/board.h +++ b/arch/arm/plat-rk/include/plat/board.h @@ -167,6 +167,7 @@ struct rk29_sdmmc_platform_data { int write_prt_enalbe_level; unsigned int sdio_INT_gpio; struct rksdmmc_gpio det_pin_info; + int (*sd_vcc_reset)(void); }; struct gsensor_platform_data { diff --git a/block/blk-core.c b/block/blk-core.c index 44f67b52c399..6f80fe23587e 100755 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -2037,6 +2037,7 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes) error_type = "I/O"; break; } +#if 0 #if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) //Modifyed by xbw at 2011-21-14 printk(KERN_DEBUG "end_request: %s error, dev %s, sector %llu\n", error_type, req->rq_disk ? req->rq_disk->disk_name : "?", @@ -2046,6 +2047,7 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes) printk(KERN_ERR "end_request: %s error, dev %s, sector %llu\n", error_type, req->rq_disk ? req->rq_disk->disk_name : "?", (unsigned long long)blk_rq_pos(req)); +#endif #endif } diff --git a/drivers/mmc/host/rk29_sdmmc.c b/drivers/mmc/host/rk29_sdmmc.c index 71ed31c80f00..59d6ccc7d3b7 100755 --- a/drivers/mmc/host/rk29_sdmmc.c +++ b/drivers/mmc/host/rk29_sdmmc.c @@ -1949,11 +1949,25 @@ SetFreq_error: int rk29_sdmmc_hw_init(void *data) { struct rk29_sdmmc *host = (struct rk29_sdmmc *)data; + struct rk29_sdmmc_platform_data *pdata = host->pdev->dev.platform_data; //set the iomux host->ctype = SDMMC_CTYPE_1BIT; host->set_iomux(host->pdev->id, host->ctype); + if( pdata && pdata->sd_vcc_reset ){ + int cdetect = gpio_get_value(host->det_pin.io) ; + if(host->det_pin.enable){ + cdetect = cdetect?1:0; + }else{ + cdetect = cdetect?0:1; + } + + if( cdetect ){ + pdata->sd_vcc_reset(); + } + } + /* reset controller */ rk29_sdmmc_reset_controller(host); @@ -3442,6 +3456,8 @@ static void rk29_sdmmc_detect_change_work(struct work_struct *work) int ret; struct rk29_sdmmc *host = container_of(work, struct rk29_sdmmc, work.work); + rk29_sdmmc_hw_init(host); + rk28_send_wakeup_key(); rk29_sdmmc_detect_change(host); } diff --git a/fs/fat/misc.c b/fs/fat/misc.c index 6d93360ca0cc..c168c27bb709 100644 --- a/fs/fat/misc.c +++ b/fs/fat/misc.c @@ -50,6 +50,7 @@ EXPORT_SYMBOL_GPL(__fat_fs_error); */ void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...) { + #if 0 struct va_format vaf; va_list args; @@ -58,6 +59,7 @@ void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...) vaf.va = &args; printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf); va_end(args); + #endif } /* Flushes the number of free clusters on FAT32 */ -- 2.34.1