summaryrefslogtreecommitdiff
path: root/drivers/mmc/core/mmc.c
diff options
context:
space:
mode:
authorMohit Kataria <mkataria@nvidia.com>2012-06-05 15:05:31 +0530
committerSimone Willett <swillett@nvidia.com>2012-06-11 16:27:31 -0700
commit5702f8c67472c05feb28a3f45550bb7ab1ca865d (patch)
tree5f0e8d293cbd0df207e69136c28c856cf1fd8be6 /drivers/mmc/core/mmc.c
parenta79e68c19180953ba479b3730e2945974660b43d (diff)
mmc: proactively issue bkops_start and refresh
Adding CMD56 implementation. Doing the following for manfid 0x90 and FW revisions 0x73 and 0x7b (both are non-standard custom FW): 1. Adding change to issue BKOPS_START whenever 20 seconds have gone by without any slow write operations. 2. Adding change to issue CMD56 to refresh (custom feature) 1 block whenever 60 seconds have gone by without any slow write operations. Corresponding changes are already there in embedded branches: http://git-master/r/#change,93247 http://git-master/r/#change,97555 Bug 847037. Bug 874256. Bug 963737. Change-Id: Ie36b52620a75320abfedc36d1408647b36eddb46 Signed-off-by: Vishal Singh <vissingh@nvidia.com> Reviewed-on: http://git-master/r/102259 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Luis Dib <ldib@nvidia.com> Reviewed-by: Varun Wadekar <vwadekar@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Diffstat (limited to 'drivers/mmc/core/mmc.c')
-rw-r--r--drivers/mmc/core/mmc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 69fb2275845c..254713bce18c 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -96,6 +96,7 @@ static int mmc_decode_cid(struct mmc_card *card)
card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8);
card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8);
card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8);
+ card->cid.prod_rev = UNSTUFF_BITS(resp, 48, 8);
card->cid.serial = UNSTUFF_BITS(resp, 16, 32);
card->cid.month = UNSTUFF_BITS(resp, 12, 4);
card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997;
@@ -425,6 +426,11 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
/* Check whether the eMMC card supports background ops */
if (ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1)
card->ext_csd.bk_ops = 1;
+
+ /* Check whether the eMMC card needs proactive refresh */
+ if ((card->cid.manfid == 0x90) && ((card->cid.prod_rev == 0x73)
+ || (card->cid.prod_rev == 0x7b)))
+ card->ext_csd.refresh = 1;
}
if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
@@ -672,6 +678,17 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
if (err)
goto free_card;
+ if (card->ext_csd.refresh) {
+ init_timer(&card->timer);
+ card->timer.data = (unsigned long) card;
+ card->timer.function = mmc_refresh;
+ card->timer.expires = MMC_BKOPS_INTERVAL <
+ MMC_REFRESH_INTERVAL ? MMC_BKOPS_INTERVAL :
+ MMC_REFRESH_INTERVAL;
+ card->timer.expires *= HZ;
+ card->timer.expires += jiffies;
+ add_timer(&card->timer);
+ }
/* If doing byte addressing, check if required to do sector
* addressing. Handle the case of <2GB cards needing sector
* addressing. See section 8.1 JEDEC Standard JED84-A441;