mmc: Did not change the actual module funciton, only to standardized printed information
[firefly-linux-kernel-4.4.55.git] / drivers / mmc / core / mmc.c
old mode 100644 (file)
new mode 100755 (executable)
index aa7d1d7..f0216b8
@@ -440,7 +440,17 @@ static int mmc_compare_ext_csds(struct mmc_card *card, unsigned bus_width)
                goto out;
 
        /* only compare read only fields */
-       err = (!(card->ext_csd.raw_partition_support ==
+       //err = (!(card->ext_csd.raw_partition_support ==                                                          
+       err = !((card->ext_csd.raw_partition_support ==
+                                                           /*Modifyed by xbw at 2012-03-05
+                                                           
+                                                          commit dd13b4ed4650bb3a7d6c86b549ab66a6aa0c00d8
+                                                        Author: Jurgen Heeks <jurgen.heeks@nokia.com>
+                                                        Date:   Wed Feb 1 13:30:55 2012 +0100
+
+                                                          mmc: core: Fix comparison issue in mmc_compare_ext_csds
+                                                          */
+       
                        bw_ext_csd[EXT_CSD_PARTITION_SUPPORT]) &&
                (card->ext_csd.raw_erased_mem_count ==
                        bw_ext_csd[EXT_CSD_ERASED_MEM_CONT]) &&
@@ -559,7 +569,13 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
        /* The extra bit indicates that we support high capacity */
        err = mmc_send_op_cond(host, ocr | (1 << 30), &rocr);
        if (err)
+       {
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+           printk(KERN_INFO "%s..%d..  ====*Identify the card as MMC , but OCR error, so fail to initialize.[%s]\n",\
+               __FUNCTION__, __LINE__, mmc_hostname(host));
+#endif
                goto err;
+       }
 
        /*
         * For SPI, enable CRC as appropriate.
@@ -734,6 +750,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
                if (max_dtr > card->ext_csd.hs_max_dtr)
                        max_dtr = card->ext_csd.hs_max_dtr;
        } else if (max_dtr > card->csd.max_dtr) {
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+        //in order to expand the compatibility of card. Added by xbw@2011-03-21
+               card->csd.max_dtr = (card->csd.max_dtr > MMC_FPP_FREQ) ? MMC_FPP_FREQ : (card->csd.max_dtr); 
+#endif
                max_dtr = card->csd.max_dtr;
        }
 
@@ -1012,14 +1032,25 @@ int mmc_attach_mmc(struct mmc_host *host)
 {
        int err;
        u32 ocr;
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+       int retry_times = 3;
+#endif
 
        BUG_ON(!host);
        WARN_ON(!host->claimed);
 
        err = mmc_send_op_cond(host, 0, &ocr);
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
        if (err)
-               return err;
-
+               return 0xFF;//return err; Modifyed by xbw at 2011-11-17
+               
+    printk(KERN_INFO "\n%s..%d..  ===== Begin to identify card as MMC-card [%s]\n", \
+        __FUNCTION__, __LINE__, mmc_hostname(host));
+#else
+    if (err)
+       return err;
+#endif        
+        
        mmc_attach_bus_ops(host);
        if (host->ocr_avail_mmc)
                host->ocr_avail = host->ocr_avail_mmc;
@@ -1062,10 +1093,34 @@ int mmc_attach_mmc(struct mmc_host *host)
                goto err;
 
        mmc_release_host(host);
+
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+//modifyed by xbw at 2011--04-11
+Retry_add:
+       err = mmc_add_card(host->card);
+       mmc_claim_host(host);
+       if (err)
+       {
+           //retry add the card; Added by xbw
+        if((--retry_times >= 0))
+        {        
+            printk(KERN_ERR "\n%s..%s..%d   ****error in add partition, so retry.  [%s]\n",__FUNCTION__,__FILE__,__LINE__, mmc_hostname(host));   
+            /* sleep some time */
+            set_current_state(TASK_INTERRUPTIBLE);
+            schedule_timeout(HZ/2);
+            
+            goto Retry_add;
+        }
+
+               goto remove_card;
+    
+       }
+#else
        err = mmc_add_card(host->card);
        mmc_claim_host(host);
        if (err)
                goto remove_card;
+#endif
 
        return 0;