lpi2c: Fix bus stop problem in xfer
authorYe Li <ye.li@nxp.com>
Sun, 8 Jul 2018 03:46:42 +0000 (11:46 +0800)
committerHeiko Schocher <hs@denx.de>
Thu, 12 Jul 2018 09:09:23 +0000 (11:09 +0200)
commitd144f61ad3faa2104676791af58c2371729bef94
tree63ed8747b1cad9a8c94365bb3691d1114e675668
parenta32effd2838a62a5d1dcc01f613508f1d90b5667
lpi2c: Fix bus stop problem in xfer

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@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
drivers/i2c/imx_lpi2c.c