From: Eugeniu Rosca Date: Fri, 16 Aug 2019 18:17:10 +0200 Subject: [U-Boot] [PATCH 1/2] mmc: Fix timeout values passed to mmc_wait_dat0() In-Reply-To: <20190814195251.14208-1-semen.protsenko@linaro.org> References: <20190814195251.14208-1-semen.protsenko@linaro.org> Message-ID: <20190816161710.GA28029@vmlxhi-102.adit-jv.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Sam, CC: Peng On Wed, Aug 14, 2019 at 10:52:50PM +0300, Sam Protsenko wrote: > mmc_wait_dat0() expects timeout argument to be in usec units. I agree, based on the documentation of wait_dat0() from commit: https://gitlab.denx.de/u-boot/u-boot/commit/c10b85d6c25f9#5a47a9a1803c0a873c9ec4b91ce244822405d1ec_413_436 > But some > overlying functions operate on timeout in msec units. That seems to be also true. The two functions touched in this commit (mmc_poll_for_busy, __mmc_switch) seem to originate from Linux, where they clearly accept MS timeout granularity [1-2]. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=716bdb8953c7c [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f90d2e4035d45 > Convert timeout > from msec to usec when passing it to mmc_wait_dat0(). I've reviewed all the callers of mmc_wait_dat0() and I couldn't find any other occurrences of passing MS values to this function. I've run 'ext2load mmc 0:1 0x48000000 Image' several times on H3-Salvator-X w/o noticing any issues. I agree with the idea of s/timeout/timeout_{us,ms}/ in the second patch from this series. > > This fixes 'avb' commands on BeagleBoard X15, because next chain was > failing: > > get_partition() -> mmc_switch_part() -> __mmc_switch() -> > mmc_wait_dat0() > > when passing incorrect timeout from __mmc_switch() to mmc_wait_dat0(). > > Fixes: bb98b8c5c06a ("mmc: During a switch, poll on dat0 if available and check the final status") > Signed-off-by: Sam Protsenko Reviewed-by: Eugeniu Rosca Tested-by: Eugeniu Rosca -- Best Regards, Eugeniu.