rtc: pcf2127: Fixed bug with rtc settings and getting error time
authorChuanhua Han <chuanhua.han@nxp.com>
Mon, 8 Jul 2019 03:45:25 +0000 (11:45 +0800)
committerHeiko Schocher <hs@denx.de>
Tue, 9 Jul 2019 08:51:12 +0000 (10:51 +0200)
commitef6c26d338a168110b7688b07e319ff46c73748d
tree80abc7740b3790154a49419338a8a9f6f4db39ec
parentd3826fb052af9e6df22abaefb1b0c7496e469f9e
rtc: pcf2127: Fixed bug with rtc settings and getting error time

The previous pcf2127 RTC chip could not read and set the correct time.
When reading the data of internal registers, the read address was the
value of register plus 1. This is because this chip requires the host
to send a stop signal after setting the register address and before
reading the register data.

This patch sets the register address using dm_i2c_write and reads
the register data using the original dm_i2c_xfer in order to generate
a stop signal after the register address is set, and fixes the bug of
the original read and write time.

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Chuanhua Han <chuanhua.han@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
drivers/rtc/pcf2127.c