u-boot-brain/drivers/i2c
Marek Behún d50e29662f i2c: mvtwsi: fix reading status register after interrupt
The twsi_wait function reads the control register for interrupt flag,
and if interrupt flag is present, it immediately reads status register.

On our device this sometimes causes bad value being read from status
register, as if the value was not yet updated.

My theory is that the controller does approximately this:
  1. sets interrupt flag in control register,
  2. sets the value of status register,
  3. causes an interrupt

In U-Boot we do not use interrupts, so I think that it is possible that
sometimes the status register in the twsi_wait function is read between
points 1 and 2.

The bug does not appear if I add a small delay before reading status
register.

Wait 100ns (which in U-Boot currently means 1 us, because ndelay(i)
function calls udelay(DIV_ROUND_UP(i, 1000))) before reading the status
register.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
2019-05-03 08:14:39 +02:00
..
muxes i2c: muxes: pca954x: support PCA9543 I2C switch 2019-04-11 15:21:33 +02:00
ast_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
ast_i2c.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
at91_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
at91_i2c.h i2c: atmel: add i2c driver 2016-08-15 22:12:00 +02:00
cros_ec_ldo.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
cros_ec_tunnel.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
davinci_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
davinci_i2c.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
designware_i2c.c i2c: designware: fix reset handling on socfpga gen5 2019-04-25 00:00:49 +02:00
designware_i2c.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
exynos_hs_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
fsl_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
i2c_core.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
i2c-cdns.c i2c: i2c_cdns: Fix below warnings with checker tool 2019-03-21 08:21:43 +01:00
i2c-emul-uclass.c dm: sandbox: i2c: Add a new 'emulation parent' uclass 2018-11-29 09:30:05 -07:00
i2c-gpio.c treewide: replace with error() with pr_err() 2017-10-04 11:59:44 -04:00
i2c-uclass-compat.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
i2c-uclass.c DM: I2C: Introduce 'u-boot, i2c-transaction-bytes' property 2019-04-11 15:21:33 +02:00
i2c-uniphier-f.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
i2c-uniphier.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
i2c-versatile.c i2c: Add support for the Arm's Versatile Express I2C controller. 2018-10-03 06:08:06 +02:00
ihs_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
imx_lpi2c.c i2c: imx_lpi2c: fix typo and register base address format 2018-10-22 14:35:57 +02:00
intel_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
Kconfig Kconfig: tegra: Migrate SYS_I2C_TEGRA 2019-02-20 09:01:44 -07:00
kona_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
lpc32xx_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
Makefile i2c: Remove ancient zynq_i2c driver 2019-02-14 14:31:10 +01:00
meson_i2c.c i2c: meson: add configurable divider factors 2019-04-10 16:50:02 +02:00
mv_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
mv_i2c.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
mvtwsi.c i2c: mvtwsi: fix reading status register after interrupt 2019-05-03 08:14:39 +02:00
mxc_i2c.c DM: I2C: Introduce 'u-boot, i2c-transaction-bytes' property 2019-04-11 15:21:33 +02:00
omap24xx_i2c.c i2c: omap24xx_i2c: Use platdata to probe the device 2018-12-10 06:11:18 +01:00
omap24xx_i2c.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
rcar_i2c.c i2c: rcar_i2c: Move FSDA check to rcar_i2c_recover 2019-03-08 05:53:40 +01:00
rcar_iic.c i2c: rcar_iic: Read ICSR only once 2019-03-07 06:20:09 +01:00
rk_i2c.c rockchip: i2c: enable i2c controller for rk3066 and rk3188 2018-07-21 01:55:25 +02:00
s3c24x0_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
s3c24x0_i2c.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
sandbox_i2c.c dm: sandbox: i2c: Use new emulator parent uclass 2018-11-29 09:30:05 -07:00
sh_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
soft_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
stm32f7_i2c.c i2c: stm32f7: change setup struct to const 2018-11-16 16:51:58 -05:00
tegra_i2c.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
tegra186_bpmp_i2c.c i2c: tegra: Fix regression by implementing a dummy probe_chip() callback 2018-12-12 06:06:14 +01:00
xilinx_xiic.c i2c: xiic: Add Xilinx AXI I2C driver 2019-01-15 09:04:49 +01:00