0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2024-12-15 20:20:30 +00:00
Lakka-LibreELEC/projects/Allwinner/patches/u-boot/0015-sunxi-mmc-increase-stabilization-delay-from-1ms-to-20ms.patch

50 lines
1.6 KiB
Diff

From: Da Xue <da@libre.computer>
Date: Thu, 21 Jul 2022 18:08:21 -0400
Some users experienced problems booting u-boot from SPL hanging here:
Trying to boot from MMC1 or Trying to boot from MMC2
This seems to occur with both MicroSD and eMMC modules on ALL-H3-CC.
Increasing the delay after mmc reset fixes these boot problems.
Some MicroSD cards are impacted more than others so it is possible that
MicroSD internals need time to stabilize. Below is some failure data.
sandisk ultra 64gb 9/20 with 1ms, 20/20 with 10ms
sandisk ultra 16gb 2/20 with 1ms, 20/20 with 10ms
sandisk extreme 16gb 6/20 with 10ms, 20/20 with 20ms
A quick comparison of schematics show series resistors for ESD
protection on the MicroSD GPIOs not present on all H3/H5 boards.
It is not known if this is related to the issue.
This patch adds a fixed 20ms delay to mmc init to mitigate the problem.
If boot time optimization is required and the platform does not require
the delay. The delay can be replaced with:
writel(SUNXI_MMC_GCTRL_RESET, &priv->reg->gctrl);
if (wait_for_bit_le32( &priv->reg->gctrl,
SUNXI_MMC_GCTRL_RESET, false, 20, false)) {
printf("%s: Timeout\n", __func__);
return -ETIMEDOUT;
}
Signed-off-by: Da Xue <da@libre.computer>
---
drivers/mmc/sunxi_mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 1bb7b6d0e9..f7942b69ce 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -297,7 +297,7 @@ static int sunxi_mmc_core_init(struct mmc *mmc)
/* Reset controller */
writel(SUNXI_MMC_GCTRL_RESET, &priv->reg->gctrl);
- udelay(1000);
+ udelay(20000);
return 0;
}