Increasing stabilization time in sunxi_mmc_core_init

Jernej Škrabec jernej.skrabec at gmail.com
Thu Jul 21 17:14:33 CEST 2022


Hi!

Dne četrtek, 21. julij 2022 ob 13:28:59 CEST je Andre Przywara napisal(a):
> On 21/07/2022 12:03, Da Xue wrote:
> 
> Hi Da,
> 
> > Users were reporting non-boot on our H5 boards (ALL-H3-CC-H5). u-boot
> > gets stuck in SPL with this message for SD/eMMC respectively.
> > 
> > Trying to boot from MMC1 or Trying to boot from MMC2
> > 
> > I tested about 20 MicroSD cards from different brands and some were
> > happy and some were not. Increasing the udelay to 8-10ms in
> > drivers/mmc/sunxi_mmc.c sunxi_mmc_core_init after reset seems to fix
> > the issue for the MicroSD cards.
> 
> That's interesting, thanks for the report. I don't remember hearing of
> issues with MMC before, at least not in the SPL.

I certainly experienced this issue on board in question. I vaguely remember 
asking about this issue on IRC. I also tried all sorts of tweaks, but it never 
occured to me that mmc reset timeout would be too short.

Da, how did you find this?

I only test one other H5 board occasionally, namely OrangePi PC2, but I never 
observed such issue there. I always needed about 5 attempts to boot ALL-H3-CC-
H5 board, but once it's cold booted, warm boots always succeed.

Best regards,
Jernej

> It's a bit odd that waiting after the *controller* reset should affect
> SD cards, and 1ms seems plenty for just the reset.
> I just checked and at least the SOFT_RESET and FIFO_RESET bits are self
> clearing. Can you try to use wait_for_bit_le32() to wait for those parts
> to finish? See sun8i_emac_eth_start() for an example.
> 
> And since you mentioned it's card related: can you check whether the
> delay is actually needed somewhere else, later? At some point where we
> wait to the card to response, for instance?
> 
> I am not against taking this patch, if it fixes problems for you, but
> just want to avoid that it papers over other issues.
> 
> Cheers,
> Andre
> 
> > Author: Da Xue <da at libre.computer>
> > Date:   Wed Jul 20 19:11:55 2022 -0400
> > 
> >      sunxi: raise stabilization time for mmc from 1ms to 8ms
> > 
> > diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
> > index 1bb7b6d0e9..499e057725 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(8000);
> > 
> >          return 0;
> >   
> >   }
> > 
> > I don't know the implications of this change so I am seeking feedback.
> > Are other boards having this issue as well or is it specific to our
> > hardware?
> > 
> > Best,
> > Da






More information about the U-Boot mailing list