[U-Boot] [PATCH 25/41] lpi2c: Fix bus stop problem in xfer

Heiko Schocher hs at denx.de
Tue May 29 03:55:37 UTC 2018


Hello Peng,

Am 28.05.2018 um 14:25 schrieb Peng Fan:
> From: Ye Li <ye.li at nxp.com>
> 
> In xfer function, both bus_i2c_read and bus_i2c_write will
> send a STOP command.  This causes a problem when reading register
> data from i2c device.
> 
> Generally two operations comprise the register data reading:
>     1. Write the register address to i2c device.
>        START | chip_addr | W | ACK | register_addr | ACK |
> 
>     2. Read the Data from i2c device.
>        START | chip_addr | R | ACK | DATA          | NACK | STOP
> 
> The STOP command should happen at the end of the transfer, otherwise
> we will always get data from register address 0
> 
> Signed-off-by: Ye Li <ye.li at nxp.com>
> Acked-by: Peng Fan <peng.fan at nxp.com>
> Cc: Heiko Schocher <hs at denx.de>
> ---
>   drivers/i2c/imx_lpi2c.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)

Good catch.

Reviewed-by: Heiko Schocher <hs at denx.de>

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list