
Hello Rasmu,
Am 02.06.2020 um 21:13 schrieb Rasmus Villemoes:
I need access to registers other than just the timekeeping ones of the pcf2127, so I wanted to implement ->read8 and ->write8. But for testing these it appeared there was no convenient way to invoke those from the shell, so I also ended up adding such a command.
Also, it seemed more natural to provide array variants that can read or write several registers at once, so rtc_ops is expanded a bit.
Simon, I've taken the liberty of keeping your R-Bs despite the first bullet below, yell if that's inappropriate.
Changes in v3:
Call the functions dm_rtc_read/dm_rtc_write rather than just rtc_read/rtc_write, since the latter names are used for local helpers by a number of drivers. That also matches the existing dm_rtc_set/dm_rtc_get (though then not the existing rtc_read{8,16,32}).
Update the rtc command (patch 6) as per Simon's feedback (parse input as hex, avoid overlong lines, use print_buffer()).
Update the tests (patches 9 and 10) according to these changes.
Changes in v2:
Use simply "read" and "write" instead of "read8_array", "write8_array", both for functions and methods, as suggested by Simon.
The rtc command's interface has been simplified a bit (no separate read/readm; the number of arguments determines whether the user wants the result on the console or to a memory address)
Add tests, both of rtc_{read,write}() and of the shell command, fixing a few things I stumbled on.
Rasmus Villemoes (10): rtc: add dm_rtc_read helper and ->read method rtc: add dm_rtc_write() helper rtc: fall back to ->{read,write} if ->{read,write}8 are not provided rtc: pcf2127: provide ->read method rtc: pcf2127: provide ->write method rtc: add rtc command rtc: sandbox-rtc: fix set method rtc: i2c_rtc_emul: catch any write to the "reset" register test: dm: rtc: add test of dm_rtc_read, dm_rtc_write test: dm: rtc: add tests of rtc shell command
arch/sandbox/include/asm/rtc.h | 5 + cmd/Kconfig | 6 ++ cmd/Makefile | 1 + cmd/rtc.c | 167 +++++++++++++++++++++++++++++++++ drivers/rtc/i2c_rtc_emul.c | 3 +- drivers/rtc/pcf2127.c | 13 ++- drivers/rtc/rtc-uclass.c | 56 ++++++++++- drivers/rtc/sandbox_rtc.c | 65 +++++-------- include/rtc.h | 47 ++++++++++ test/dm/rtc.c | 118 ++++++++++++++++++++++- 10 files changed, 431 insertions(+), 50 deletions(-) create mode 100644 cmd/rtc.c
I just added (locally only) your patches to my U-Boot tree, to integrate them into mainline, see:
https://github.com/hsdenx/u-boot-i2c/commits/work
test.py run on Azure shows following error:
https://dev.azure.com/hs0298/hs/_build/results?buildId=37&view=logs&... """ Unknown command 'rtc' - try 'help' """
May you need to add the new RTC command to sandbox config?
Can you look into it?
Also I have fixed some chackpatch warnings ... if you need to post a new patchset, please check your patches before with checkpatch script:
u-boot:/scripts/checkpatch.pl
Thanks!
bye, Heiko