[U-Boot] [PATCH] mmc: dw_mmc: fix timeout calculate method

Alexey Brodkin Alexey.Brodkin at synopsys.com
Thu Aug 29 09:21:34 UTC 2019

Hi Kever,

> -----Original Message-----
> From: Kever Yang <kever.yang at rock-chips.com>
> Sent: Thursday, August 29, 2019 10:17 AM
> To: Peng Fan <peng.fan at nxp.com>; u-boot at lists.denx.de
> Cc: trini at konsulko.com; Eugeniy.Paltsev at synopsys.com; Alexey Brodkin <abrodkin at synopsys.com>; Simon
> Glass <sjg at chromium.org>
> Subject: Re: [PATCH] mmc: dw_mmc: fix timeout calculate method
> Add ARC maintainers.

Thanks for adding us in the loop.

> On 2019/8/27 下午5:58, Peng Fan wrote:
> > Hi Kever,
> >
> >> -----Original Message-----
> >> From: U-Boot <u-boot-bounces at lists.denx.de> On Behalf Of Peng Fan
> >> Sent: 2019年8月27日 15:40
> >> To: Kever Yang <kever.yang at rock-chips.com>; u-boot at lists.denx.de
> >> Cc: trini at konsulko.com
> >> Subject: Re: [U-Boot] [PATCH] mmc: dw_mmc: fix timeout calculate method
> >>
> >>> Subject: [PATCH] mmc: dw_mmc: fix timeout calculate method
> >>>
> >>> There are two cases not been considered:
> >>> - use uint for timeout, it will overflow when size bigger than 512KB for
> >>>    it *8*1000 at the beginning, but we may use size up to 32MB;
> >>> - The timeout is using clock speed for data rate, but the device may not
> >>>    have such high speed, eg. clock is 52MHz while the device write speed
> >> may
> >>>    be less than 10MB/s.
> >>>
> >>> Fix them in this patch, the max timeout is about 6500 when size is
> >>> 32MB after fix.
> >>>
> >>> Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
> > This patch breaks build, I need drop it.
> > See build:
> > https://travis-ci.org/MrVan/u-boot/jobs/577210464
> The error happens only in ARC architecture, and seems like the arc
> compiler not support 64bit div?

It's not a compiler problem but a subtle issue with libgcc.
To be independent from toolchain type (and we have quite a few flavors like
little- and big-endian, ARCv1 or ARCv2 etc) decision was made to move
libgcc into U-Boot but given full libgcc is quite large only primitives required
by up-to-date U-Boot were copied from GCC to U-Boot.

> Any idea on how to fix this?

Add missing primitives like __udivdi3() and their dependencies, see for example:

And I'll happily do it myself but for some reason I cannot reproduce that problem locally.
I use the same pre-built arc-2018.09 toolchain:
# arc-linux-gcc -v
gcc version 8.2.1 20180814 (ARCv2 ISA Linux uClibc toolchain 2018.09)

And may successfully build U-Boot for HSDK from
# git l
76c0bf2873 - (HEAD -> mrvan, github-mrvan/mmc-8-28-2019) ARM: dts: ast2500: Add SDHCI nodes (27 hours ago) <Eddie James>
07b000cd32 - configs: AST2500 EVB: Enable SD controller (27 hours ago) <Eddie James>
5f6a033f10 - mmc: Add Aspeed SD controller driver (27 hours ago) <Eddie James>
a6503eaa66 - clk: aspeed: Add support for SD clock (27 hours ago) <Eddie James>
c54e328452 - mmc: Rename timeout parameters for clarification (27 hours ago) <Sam Protsenko>
be949bb19c - mmc: Fix timeout values passed to mmc_wait_dat0() (27 hours ago) <Sam Protsenko>
49842f0edf - dm: mmc: remove unused U_BOOT_DRIVER(mmc) (27 hours ago) <Andy Yan>
7b91b47f8f - Prepare v2019.10-rc3 (27 hours ago) <Tom Rini>

That way:
./tools/buildman/buildman hsdk
boards.cfg is up to date. Nothing to do.
Building current source for 1 boards (1 thread, 48 jobs per thread)
       arc:  w+   hsdk
    0    1    0 /1      hsdk

What do I do wrong?


More information about the U-Boot mailing list