From: Kever Yang Date: Fri, 30 Aug 2019 08:58:05 +0800 Subject: [U-Boot] [PATCH] mmc: dw_mmc: fix timeout calculate method In-Reply-To: References: <20190814083819.5784-1-kever.yang@rock-chips.com> <3a4fc838-0cc9-64c8-3993-628cce6484c5@rock-chips.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de Hi Alexey, On 2019/8/29 下午5:21, Alexey Brodkin wrote: > Hi Kever, > >> -----Original Message----- >> From: Kever Yang >> Sent: Thursday, August 29, 2019 10:17 AM >> To: Peng Fan ; u-boot at lists.denx.de >> Cc: trini at konsulko.com; Eugeniy.Paltsev at synopsys.com; Alexey Brodkin ; Simon >> Glass >> 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 On Behalf Of Peng Fan >>>> Sent: 2019年8月27日 15:40 >>>> To: Kever Yang ; 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 >>> 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: > https://github.com/gcc-mirror/gcc/blob/master/libgcc/libgcc2.c#L1318. > > 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: > ---------------------------->8----------------------- > # arc-linux-gcc -v > gcc version 8.2.1 20180814 (ARCv2 ISA Linux uClibc toolchain 2018.09) > ---------------------------->8----------------------- > > And may successfully build U-Boot for HSDK from > https://github.com/MrVan/u-boot/commits/mmc-8-28-2019: > ---------------------------->8----------------------- > # git l > 76c0bf2873 - (HEAD -> mrvan, github-mrvan/mmc-8-28-2019) ARM: dts: ast2500: Add SDHCI nodes (27 hours ago) > 07b000cd32 - configs: AST2500 EVB: Enable SD controller (27 hours ago) > 5f6a033f10 - mmc: Add Aspeed SD controller driver (27 hours ago) > a6503eaa66 - clk: aspeed: Add support for SD clock (27 hours ago) > c54e328452 - mmc: Rename timeout parameters for clarification (27 hours ago) > be949bb19c - mmc: Fix timeout values passed to mmc_wait_dat0() (27 hours ago) > 49842f0edf - dm: mmc: remove unused U_BOOT_DRIVER(mmc) (27 hours ago) > 7b91b47f8f - Prepare v2019.10-rc3 (27 hours ago) > ---------------------------->8----------------------- I think this tree does not including this patch, Peng drop it because of this issue, so you need to apply this patch in your branch to reproduce the problem. I have send out V2 patch for this fix with only using 32bit variable instead of 64bit. Thanks, - Kever > > That way: > ---------------------------->8----------------------- > ./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 > ---------------------------->8----------------------- > > What do I do wrong? > > -Alexey > >