[U-Boot] linux/compat.h: Properly implement ndelay fallback

Tom Rini trini at konsulko.com
Tue Nov 29 02:01:41 CET 2016


On Fri, Nov 18, 2016 at 02:40:37PM +0100, mario.six at gdsys.cc wrote:

> Commit c68c62 ("i2c: mvtwsi: Make delay times frequency-dependent")
> extensively used the ndelay function with a calculated parameter
> which is dependant on the configured frequency of the I2C bus. If
> standard speed is employed, the parameter is usually 10000 (10000ns
> period length for 100kHz frequency).
> 
> But, since the arm architecture does not implement a proper version of
> ndelay, the fallback default from include/linux/compat.h is used,
> which defines every ndelay as udelay(1). This causes problems for
> slower speeds on arm, since the delay time is now 9us too short for
> the desired frequency, which leads to random failures of the I2C
> interface.
> 
> To remedy this, we implement a proper, parameter-aware ndelay fallback
> for architectures that don't implement a real ndelay function.
> 
> Reported-By: Jason Brown <Jason.brown at apcon.com>
> To: Tom Rini <trini at konsulko.com>
> To: Heiko Schocher <hs at denx.de>
> Signed-off-by: Mario Six <mario.six at gdsys.cc>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161128/a94b66f8/attachment.sig>


More information about the U-Boot mailing list