summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authormario.six@gdsys.cc <mario.six@gdsys.cc>2016-11-18 13:40:37 (GMT)
committerTom Rini <trini@konsulko.com>2016-11-28 20:10:34 (GMT)
commitca388143ce87e5b1ae6c3b5eb41fcf8bcecdc0dd (patch)
treeb3e4ec4498a5780bef6f63732e1362fc58e4aa5d /include/linux
parent877ea607a8e07a9ed308e44a58e8e2b9028f01f2 (diff)
downloadu-boot-fsl-qoriq-ca388143ce87e5b1ae6c3b5eb41fcf8bcecdc0dd.tar.xz
linux/compat.h: Properly implement ndelay fallback
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@apcon.com> To: Tom Rini <trini@konsulko.com> To: Heiko Schocher <hs@denx.de> Signed-off-by: Mario Six <mario.six@gdsys.cc>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/compat.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h
index c7fd649..533983f 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -15,7 +15,7 @@ struct p_current{
extern struct p_current *current;
-#define ndelay(x) udelay(1)
+#define ndelay(x) udelay((x) < 1000 ? 1 : (x)/1000)
#define dev_dbg(dev, fmt, args...) \
debug(fmt, ##args)