mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
This reverts commit 72a89e0da5
, which
causes the imx53 HSC to hang as the eMMC is not working properly anymore.
The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed
0 blocks written: ERROR
imx53 is not using the DDR mode.
Debugging of pre_div and div generation showed that those values are
generated in a way, which is not matching the ones from working setup.
As the original patch was performing code refactoring, let's revert this
change, so all imx53 boards would work again.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
parent
e14d9ca491
commit
b6a0427554
1 changed files with 5 additions and 18 deletions
|
@ -621,31 +621,18 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)
|
||||||
#else
|
#else
|
||||||
int pre_div = 2;
|
int pre_div = 2;
|
||||||
#endif
|
#endif
|
||||||
|
int ddr_pre_div = mmc->ddr_mode ? 2 : 1;
|
||||||
int sdhc_clk = priv->sdhc_clk;
|
int sdhc_clk = priv->sdhc_clk;
|
||||||
uint clk;
|
uint clk;
|
||||||
|
|
||||||
/*
|
|
||||||
* For ddr mode, usdhc need to enable DDR mode first, after select
|
|
||||||
* this DDR mode, usdhc will automatically divide the usdhc clock
|
|
||||||
*/
|
|
||||||
if (mmc->ddr_mode) {
|
|
||||||
writel(readl(®s->mixctrl) | MIX_CTRL_DDREN, ®s->mixctrl);
|
|
||||||
sdhc_clk >>= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clock < mmc->cfg->f_min)
|
if (clock < mmc->cfg->f_min)
|
||||||
clock = mmc->cfg->f_min;
|
clock = mmc->cfg->f_min;
|
||||||
|
|
||||||
if (sdhc_clk / 16 > clock) {
|
while (sdhc_clk / (16 * pre_div * ddr_pre_div) > clock && pre_div < 256)
|
||||||
for (; pre_div < 256; pre_div *= 2)
|
pre_div *= 2;
|
||||||
if ((sdhc_clk / pre_div) <= (clock * 16))
|
|
||||||
break;
|
|
||||||
} else
|
|
||||||
pre_div = 1;
|
|
||||||
|
|
||||||
for (div = 1; div <= 16; div++)
|
while (sdhc_clk / (div * pre_div * ddr_pre_div) > clock && div < 16)
|
||||||
if ((sdhc_clk / (div * pre_div)) <= clock)
|
div++;
|
||||||
break;
|
|
||||||
|
|
||||||
pre_div >>= 1;
|
pre_div >>= 1;
|
||||||
div -= 1;
|
div -= 1;
|
||||||
|
|
Loading…
Reference in a new issue