Skip to content
  • Ye Li's avatar
    lpi2c: Fix bus stop problem in xfer · d144f61a
    Ye Li authored and Heiko Schocher's avatar Heiko Schocher committed
    
    
    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: default avatarYe Li <ye.li@nxp.com>
    Acked-by: Peng Fan's avatarPeng Fan <peng.fan@nxp.com>
    Reviewed-by: default avatarHeiko Schocher <hs@denx.de>
    d144f61a