Skip to content
Snippets Groups Projects
Commit 4a89a24e authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

mmc: uniphier-sd: just return if already set to desired clock rate


With this, we can save unnecessary udelay().

Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 8be12e28
No related branches found
No related tags found
No related merge requests found
...@@ -571,6 +571,9 @@ static void uniphier_sd_set_clk_rate(struct uniphier_sd_priv *priv, ...@@ -571,6 +571,9 @@ static void uniphier_sd_set_clk_rate(struct uniphier_sd_priv *priv,
val = UNIPHIER_SD_CLKCTL_DIV1024; val = UNIPHIER_SD_CLKCTL_DIV1024;
tmp = readl(priv->regbase + UNIPHIER_SD_CLKCTL); tmp = readl(priv->regbase + UNIPHIER_SD_CLKCTL);
if (tmp & UNIPHIER_SD_CLKCTL_SCLKEN &&
(tmp & UNIPHIER_SD_CLKCTL_DIV_MASK) == val)
return;
/* stop the clock before changing its rate to avoid a glitch signal */ /* stop the clock before changing its rate to avoid a glitch signal */
tmp &= ~UNIPHIER_SD_CLKCTL_SCLKEN; tmp &= ~UNIPHIER_SD_CLKCTL_SCLKEN;
...@@ -582,6 +585,8 @@ static void uniphier_sd_set_clk_rate(struct uniphier_sd_priv *priv, ...@@ -582,6 +585,8 @@ static void uniphier_sd_set_clk_rate(struct uniphier_sd_priv *priv,
tmp |= UNIPHIER_SD_CLKCTL_SCLKEN; tmp |= UNIPHIER_SD_CLKCTL_SCLKEN;
writel(tmp, priv->regbase + UNIPHIER_SD_CLKCTL); writel(tmp, priv->regbase + UNIPHIER_SD_CLKCTL);
udelay(1000);
} }
static int uniphier_sd_set_ios(struct udevice *dev) static int uniphier_sd_set_ios(struct udevice *dev)
...@@ -599,8 +604,6 @@ static int uniphier_sd_set_ios(struct udevice *dev) ...@@ -599,8 +604,6 @@ static int uniphier_sd_set_ios(struct udevice *dev)
uniphier_sd_set_ddr_mode(priv, mmc); uniphier_sd_set_ddr_mode(priv, mmc);
uniphier_sd_set_clk_rate(priv, mmc); uniphier_sd_set_clk_rate(priv, mmc);
udelay(1000);
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment