u-boot-brain/test/dm
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
..
acpi.c test: Use ut_asserteq_mem() where possible 2020-05-19 14:01:47 -04:00
adc.c test: dm: adc: use the real device name 2019-07-12 21:07:58 -04:00
audio.c dm: sound: Create a uclass for audio codecs 2018-12-13 16:32:49 -07:00
axi.c test: Use ut_asserteq_mem() where possible 2020-05-19 14:01:47 -04:00
blk.c common: Drop part.h from common header 2020-05-18 17:33:33 -04:00
board.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
bootcount.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
bus.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
cache.c dm: cache: Add enable and disable ops for sandbox and test 2019-09-03 09:31:03 +08:00
clk_ccf.c sandbox: clk: add clk enable/disable test code 2019-08-22 00:10:09 +02:00
clk.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
core.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
cpu.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
devres.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
dma.c test: Use ut_asserteq_mem() where possible 2020-05-19 14:01:47 -04:00
dsi_host.c dm: Add a dsi host uclass 2019-10-13 23:34:43 +02:00
eth.c dm: uclass: don't assign aliased seq numbers 2020-06-11 20:52:11 -06:00
fdtdec.c test: fdtdec: test fdtdec_set_carveout() 2020-04-16 08:07:58 -06:00
firmware.c dm: test: Add "/firmware" node scan test 2018-09-29 11:49:35 -06:00
gpio.c gpio: search for gpio label if gpio is not found through bank name 2020-07-07 18:23:37 -04:00
hwspinlock.c dm: Add Hardware Spinlock class 2018-12-06 23:26:32 -05:00
i2c.c test: Use ut_asserteq_mem() where possible 2020-05-19 14:01:47 -04:00
i2s.c dm: sound: Create a uclass for i2s 2018-12-13 16:32:49 -07:00
irq.c dm: irq: Add support for requesting interrupts 2020-02-07 22:46:32 +08:00
k210_pll.c clk: Add K210 pll support 2020-07-01 15:01:21 +08:00
Kconfig test: Move the unit tests to their own menu 2015-05-21 09:16:17 -04:00
led.c sandbox: led: use new function to configure default state 2018-08-10 10:27:32 -04:00
mailbox.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
Makefile reset: Add generic reset driver 2020-07-01 15:01:21 +08:00
mdio_mux.c test: dm: add a test for MDIO MUX DM uclass 2019-07-18 16:37:13 -05:00
mdio.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
misc.c test: Use ut_asserteq_mem() where possible 2020-05-19 14:01:47 -04:00
mmc.c common: Drop part.h from common header 2020-05-18 17:33:33 -04:00
nop.c dm: Add a No-op uclass 2019-07-05 14:19:41 +02:00
ofnode.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
ofread.c dm: core: add ofnode and dev function to iterate on node property 2020-04-16 23:06:54 -04:00
osd.c test: Use ut_asserteq_mem() where possible 2020-05-19 14:01:47 -04:00
p2sb.c sandbox: Add PCI driver and test for p2sb 2019-12-15 11:44:11 +08:00
panel.c panel: Expand the backlight support 2018-10-09 04:40:27 -06:00
pch.c pch: Add ioctl support 2019-02-20 15:27:08 +08:00
pci_ep.c test: pci_ep: add basic pci_ep tests 2019-07-11 10:05:15 -04:00
pci.c dm: pci: Add a function to read a PCI BAR 2019-10-08 13:57:43 +08:00
phy.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
pmc.c x86: sandbox: Add a PMC emulator and test 2019-12-15 11:44:11 +08:00
pmic.c sandbox: tests: Add tests for mc34708 PMIC device 2018-05-18 08:27:26 +02:00
power-domain.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
pwm.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
ram.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
regmap.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
regulator.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
remoteproc.c test: Use ut_asserteq_mem() where possible 2020-05-19 14:01:47 -04:00
reset.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
rng.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
rtc.c rtc: sandbox-rtc: fix set method 2020-07-09 06:02:45 +02:00
serial.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
sf.c sf: Drop spl_flash_get_sw_write_prot 2020-06-01 17:55:24 +05:30
simple-pm-bus.c dm: Add support for simple-pm-bus 2020-07-01 15:01:21 +08:00
smem.c test: smem: add basic smem test 2018-07-19 17:03:28 -04:00
sound.c sound: Add a new stop_play() method 2020-02-05 19:33:46 -07:00
spi.c spi: Convert CONFIG_DM_SPI* to CONFIG_$(SPL_TPL_)DM_SPI* 2020-06-29 13:34:43 -04:00
spmi.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
syscon-reset.c reset: Add generic reset driver 2020-07-01 15:01:21 +08:00
syscon.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
sysreset.c sandbox: sysreset: Update to support power-on reset 2018-12-05 06:01:34 -07:00
tee.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
test-driver.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
test-fdt.c dm: uclass: don't assign aliased seq numbers 2020-06-11 20:52:11 -06:00
test-main.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
test-uclass.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
timer.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
usb.c usb: provide a device tree node to USB devices 2020-06-11 20:52:11 -06:00
video.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
virtio.c test: dm: virtio: Add test cases for virtio uclass 2018-11-14 09:16:28 -08:00
wdt.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00