u-boot/drivers/rtc
Rasmus Villemoes 9fb6a41cda rtc: sandbox-rtc: fix set method
The current set method is broken; a simple test case is to first set
the date to something in April, then change the date to 31st May:

=> date 040412122020.34
Date: 2020-04-04 (Saturday)    Time: 12:12:34
=> date 053112122020.34
Date: 2020-05-01 (Friday)    Time: 12:12:34

or via the amending of the existing rtc_set_get test case similarly:

$ ./u-boot -T -v
=> ut dm rtc_set_get
Test: dm_test_rtc_set_get: rtc.c
expected: 31/08/2004 18:18:00
actual: 01/08/2004 18:18:00

The problem is that after each register write,
sandbox_i2c_rtc_complete_write() gets called and sets the internal
time from the current set of registers. However, when we get to
writing 31 to mday, the registers are in an inconsistent state (mon is
still 4), so the mktime machinery ends up translating April 31st to
May 1st. Upon the next register write, the registers are populated by
sandbox_i2c_rtc_prepare_read(), so the 31 we just wrote to mday gets
overwritten by a 1.

Fix it by writing all registers at once, and for consistency, update
the get method to retrieve them all with one "i2c transfer".

Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2020-07-09 06:02:45 +02:00
..
at91sam9_rtt.c rtc: remove CONFIG_CMD_DATE dependency 2018-07-25 15:00:24 +02:00
davinci.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
ds164x.c rtc: remove CONFIG_CMD_DATE dependency 2018-07-25 15:00:24 +02:00
ds174x.c rtc: remove CONFIG_CMD_DATE dependency 2018-07-25 15:00:24 +02:00
ds1302.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
ds1306.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
ds1307.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
ds1337.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
ds1374.c rtc: ds1374: typo Watchdog 2020-04-24 16:40:09 -04:00
ds1556.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
ds3231.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
ds3232.c common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
ftrtc010.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
i2c_rtc_emul.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
imxdi.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
isl1208.c rtc: Add read8 and write8 support to isl1208 driver 2018-10-08 14:45:02 -04:00
Kconfig rtc: add support for DS3232 device 2020-01-10 10:25:13 -05:00
m41t11.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
m41t60.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
m41t62.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
m41t94.c Fix for Void function returning value in sbc35-a9g20 2009-11-27 16:26:11 -06:00
m48t35ax.c rtc: remove CONFIG_CMD_DATE dependency 2018-07-25 15:00:24 +02:00
Makefile rtc: add support for DS3232 device 2020-01-10 10:25:13 -05:00
max6900.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
mc13xxx-rtc.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
mc146818.c Patch queue for efi - 2018-07-25 2018-07-30 16:02:29 -04:00
mcfrtc.c rtc: remove CONFIG_CMD_DATE dependency 2018-07-25 15:00:24 +02:00
mk48t59.c rtc: remove CONFIG_CMD_DATE dependency 2018-07-25 15:00:24 +02:00
mvrtc.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
mvrtc.h drivers/rtc: convert mvrtc to DM 2018-06-05 20:19:09 -04:00
mx27rtc.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
mxsrtc.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pcf2127.c rtc: pcf2127: provide ->write method 2020-07-09 06:02:45 +02:00
pcf8563.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
pl031.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
pt7c4338.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
rs5c372.c rtc: remove CONFIG_CMD_DATE dependency 2018-07-25 15:00:24 +02:00
rtc-lib.c rtc: export rtc_month_days() 2019-05-31 23:27:12 +02:00
rtc-uclass.c rtc: fall back to ->{read, write} if ->{read, write}8 are not provided 2020-07-09 06:02:45 +02:00
rv3029.c common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
rv8803.c common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
rx8010sj.c common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
rx8025.c rtc, rx8025: add DM support 2019-07-29 09:32:12 -04:00
s3c24x0_rtc.c rtc: remove CONFIG_CMD_DATE dependency 2018-07-25 15:00:24 +02:00
s35392a.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
sandbox_rtc.c rtc: sandbox-rtc: fix set method 2020-07-09 06:02:45 +02:00
stm32_rtc.c common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
x1205.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00