aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJianpeng Ma <majianpeng@gmail.com>2013-10-20 14:55:20 -0400
committerChris Ball <cjb@laptop.org>2013-10-30 20:26:19 -0400
commit1e881786c9038cd78dfa325b012f4a00ce1bcfd4 (patch)
treed4f412b8c8e9f87dbebab949514ccb446f81c023
parent0a82e06e6183a252608df48cc4793b83e2d73dfd (diff)
mmc: omap_hsmmc: fix timeout for cmd and data soft reset
With HSMMC_HAS_UPDATED_RESET reset of cmd/data (SRC/SRD) can be to quick and can be missed resulting in wait for software timeout. With cpu_relax timeout can be long and unpredictable. Use udelay instead for timeout implementation. Reported-by: Yuzheng Ma <mayuzheng@kedacom.com> Tested-by: Yuzheng Ma <mayuzheng@kedacom.com> Reviewed-by: Hein Tibosch <hein_tibosch@yahoo.es> Signed-off-by: Jianpeng Ma <majianpeng@gmail.com> Signed-off-by: Balaji T K <balajitk@ti.com> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/host/omap_hsmmc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 53b53b581687..4d1170fa34c0 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -119,7 +119,8 @@
119 BRR_EN | BWR_EN | TC_EN | CC_EN) 119 BRR_EN | BWR_EN | TC_EN | CC_EN)
120 120
121#define MMC_AUTOSUSPEND_DELAY 100 121#define MMC_AUTOSUSPEND_DELAY 100
122#define MMC_TIMEOUT_MS 20 122#define MMC_TIMEOUT_MS 20 /* 20 mSec */
123#define MMC_TIMEOUT_US 20000 /* 20000 micro Sec */
123#define OMAP_MMC_MIN_CLOCK 400000 124#define OMAP_MMC_MIN_CLOCK 400000
124#define OMAP_MMC_MAX_CLOCK 52000000 125#define OMAP_MMC_MAX_CLOCK 52000000
125#define DRIVER_NAME "omap_hsmmc" 126#define DRIVER_NAME "omap_hsmmc"
@@ -967,8 +968,7 @@ static inline void omap_hsmmc_reset_controller_fsm(struct omap_hsmmc_host *host,
967 unsigned long bit) 968 unsigned long bit)
968{ 969{
969 unsigned long i = 0; 970 unsigned long i = 0;
970 unsigned long limit = (loops_per_jiffy * 971 unsigned long limit = MMC_TIMEOUT_US;
971 msecs_to_jiffies(MMC_TIMEOUT_MS));
972 972
973 OMAP_HSMMC_WRITE(host->base, SYSCTL, 973 OMAP_HSMMC_WRITE(host->base, SYSCTL,
974 OMAP_HSMMC_READ(host->base, SYSCTL) | bit); 974 OMAP_HSMMC_READ(host->base, SYSCTL) | bit);
@@ -980,13 +980,13 @@ static inline void omap_hsmmc_reset_controller_fsm(struct omap_hsmmc_host *host,
980 if (mmc_slot(host).features & HSMMC_HAS_UPDATED_RESET) { 980 if (mmc_slot(host).features & HSMMC_HAS_UPDATED_RESET) {
981 while ((!(OMAP_HSMMC_READ(host->base, SYSCTL) & bit)) 981 while ((!(OMAP_HSMMC_READ(host->base, SYSCTL) & bit))
982 && (i++ < limit)) 982 && (i++ < limit))
983 cpu_relax(); 983 udelay(1);
984 } 984 }
985 i = 0; 985 i = 0;
986 986
987 while ((OMAP_HSMMC_READ(host->base, SYSCTL) & bit) && 987 while ((OMAP_HSMMC_READ(host->base, SYSCTL) & bit) &&
988 (i++ < limit)) 988 (i++ < limit))
989 cpu_relax(); 989 udelay(1);
990 990
991 if (OMAP_HSMMC_READ(host->base, SYSCTL) & bit) 991 if (OMAP_HSMMC_READ(host->base, SYSCTL) & bit)
992 dev_err(mmc_dev(host->mmc), 992 dev_err(mmc_dev(host->mmc),