[U-Boot] [U-Boot,V2] i2c: mxs_i2c: Squash endless loop

Heiko Schocher hs at denx.de
Wed Nov 13 07:36:05 CET 2013


Hello Marek,

Am 04.11.2013 14:29, schrieb Marek Vasut:
> The endless waiting for a bit to be set can cause a hang, add a timeout
> so we prevent such situation. A testcase for such a hang is below. The
> testcase assumes a device to be present at address 0x50 and a device to
> NOT be present at address 0x42 . Also note that the "sleep 1" induced
> delays are imperative for this bug to manifest .
>
> i2c read 0x42 0x0.2 0x10 0x42000000 ; sleep 1 ; \
> i2c read 0x50 0x0.2 0x10 0x42000000 ; sleep 1 ; \
> i2c read 0x42 0x0.2 0x10 0x42000000
>
> The expected result of the above command is:
>
> Error reading the chip.
> Error reading the chip.
>
> While without this patch, we observe a hang in the last read from 0x42
> precisely when waiting for this bit to be set.
>
> Signed-off-by: Marek Vasut<marex at denx.de>
> Cc: Fabio Estevam<fabio.estevam at freescale.com>
> Cc: Heiko Schocher<hs at denx.de>
> Cc: Stefano Babic<sbabic at denx.de>
>
> ---
> drivers/i2c/mxs_i2c.c | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)

Thanks!

Applied to u-boot-i2c.git

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


More information about the U-Boot mailing list