aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2019-11-23 13:36:18 +0100
committerPeng Fan <peng.fan@nxp.com>2019-11-27 16:56:46 +0800
commit37c399066409f0923cbe45b49cf0a12c85afe4f4 (patch)
treebe538139a48ac7ede62dcf5227a3ba5784035646 /drivers
parent0196a58a792f37d2c80ba6a50f52da15950937c9 (diff)
downloadu-boot-37c399066409f0923cbe45b49cf0a12c85afe4f4.zip
u-boot-37c399066409f0923cbe45b49cf0a12c85afe4f4.tar.gz
u-boot-37c399066409f0923cbe45b49cf0a12c85afe4f4.tar.bz2
mmc: tmio: sdhi: Track SMPCMP valu in private data
Retain the SMPCMP value from last calibration in private data. This will be later used for skipping bad taps. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/renesas-sdhi.c18
-rw-r--r--drivers/mmc/tmio-common.h1
2 files changed, 11 insertions, 8 deletions
diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c
index acc44e5..2f34173 100644
--- a/drivers/mmc/renesas-sdhi.c
+++ b/drivers/mmc/renesas-sdhi.c
@@ -289,7 +289,7 @@ static unsigned int renesas_sdhi_compare_scc_data(struct tmio_sd_priv *priv)
}
static int renesas_sdhi_select_tuning(struct tmio_sd_priv *priv,
- unsigned int taps, unsigned int smpcmp)
+ unsigned int taps)
{
unsigned long tap_cnt; /* counter of tuning success */
unsigned long tap_start;/* start position of tuning success */
@@ -311,9 +311,9 @@ static int renesas_sdhi_select_tuning(struct tmio_sd_priv *priv,
taps &= ~BIT(i % priv->tap_num);
taps &= ~BIT((i % priv->tap_num) + priv->tap_num);
}
- if (!(smpcmp & BIT(i))) {
- smpcmp &= ~BIT(i % priv->tap_num);
- smpcmp &= ~BIT((i % priv->tap_num) + priv->tap_num);
+ if (!(priv->smpcmp & BIT(i))) {
+ priv->smpcmp &= ~BIT(i % priv->tap_num);
+ priv->smpcmp &= ~BIT((i % priv->tap_num) + priv->tap_num);
}
}
@@ -355,7 +355,7 @@ static int renesas_sdhi_select_tuning(struct tmio_sd_priv *priv,
tap_start = 0;
tap_end = 0;
for (i = 0; i < priv->tap_num * 2; i++) {
- if (smpcmp & BIT(i))
+ if (priv->smpcmp & BIT(i))
ntap++;
else {
if (ntap > match_cnt) {
@@ -398,7 +398,7 @@ int renesas_sdhi_execute_tuning(struct udevice *dev, uint opcode)
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
struct mmc *mmc = upriv->mmc;
unsigned int tap_num;
- unsigned int taps = 0, smpcmp = 0;
+ unsigned int taps = 0;
int i, ret = 0;
u32 caps;
@@ -426,6 +426,8 @@ int renesas_sdhi_execute_tuning(struct udevice *dev, uint opcode)
goto out;
}
+ priv->smpcmp = 0;
+
/* Issue CMD19 twice for each tap */
for (i = 0; i < 2 * priv->tap_num; i++) {
renesas_sdhi_prepare_tuning(priv, i % priv->tap_num);
@@ -443,12 +445,12 @@ int renesas_sdhi_execute_tuning(struct udevice *dev, uint opcode)
ret = renesas_sdhi_compare_scc_data(priv);
if (ret == 0)
- smpcmp |= BIT(i);
+ priv->smpcmp |= BIT(i);
mdelay(1);
}
- ret = renesas_sdhi_select_tuning(priv, taps, smpcmp);
+ ret = renesas_sdhi_select_tuning(priv, taps);
out:
if (ret < 0) {
diff --git a/drivers/mmc/tmio-common.h b/drivers/mmc/tmio-common.h
index da89cc9..79f51d2 100644
--- a/drivers/mmc/tmio-common.h
+++ b/drivers/mmc/tmio-common.h
@@ -137,6 +137,7 @@ struct tmio_sd_priv {
struct clk clk;
#endif
#if CONFIG_IS_ENABLED(RENESAS_SDHI)
+ unsigned int smpcmp;
u8 tap_set;
u8 tap_num;
u8 nrtaps;