rk292x (v86 & tr726) :add sd-vcc control while sd hw initial
authorhj <hj@rock-chips.com>
Wed, 28 Nov 2012 03:45:11 +0000 (11:45 +0800)
committerwuhao <wuhao@wuhao@rock-chips.com>
Wed, 28 Nov 2012 03:45:11 +0000 (11:45 +0800)
arch/arm/mach-rk2928/board-rk2926-sdk.c
arch/arm/mach-rk2928/board-rk2928-sdk.c
arch/arm/plat-rk/include/plat/board.h
block/blk-core.c
drivers/mmc/host/rk29_sdmmc.c
fs/fat/misc.c

index a069676e9803bb3f8913f5cc50af0e08187381a9..dffaa1ea194932959e02a1c8b9dcc37ee2bd0e66 100755 (executable)
@@ -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,
index 66eb4f5f6bcfe0bb3a58dfc7f4b0f4ee4bdd334f..3ffe4a8c4b9b87203c08cca1fd4091754bbcebe4 100755 (executable)
@@ -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,
index 2f74c56bec6b0a2568a3872771b865a97b09f95c..19683e2f0de5dfb47a178774898f77233255872d 100755 (executable)
@@ -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 {
index 44f67b52c399c7b60bdea6f043137829c70e7a71..6f80fe23587e2dce6f1e27cdf2453193ca272526 100755 (executable)
@@ -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      
        }
 
index 71ed31c80f00e608a2ea43c92ecba1494f8b5591..59d6ccc7d3b74f2a983125111f9d67fc82a932b5 100755 (executable)
@@ -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);                  
 }
index 6d93360ca0ccec574f941dd72d2f4c32f94865b0..c168c27bb70929f69a653987759fcd9bcdbce2bb 100644 (file)
@@ -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 */