
On 09/03/2021 17:10:21+0100, Stefan Roese wrote:
Hi Heiko,
On 09.03.21 14:45, Heiko Schocher wrote:
add support for rtc3028 rtc from microcrystal. based on linux dirver: commit a38fd8748464: ("Linux 5.12-rc2")
Nitpicking: You might want to start a sentence in upper-case? ;)
Another minor comment below...
Signed-off-by: Heiko Schocher hs@denx.de
driver is based on code in linux, but with already corrected weekday usage. linux codes the weekday bitwise, while the weekday register has only 3 valid bits as the app manual [1] says:
This register holds the current day of the week. Each value represents one weekday that is assigned by the user. Values will range from 0 to 6 The weekday counter is simply a 3-bit counter which counts up to 6 and then resets to 0.
[1] https://www.microcrystal.com/fileadmin/Media/Products/RTC/App.Manual/RV-3028...
This is not a big problem, as userspace never use weekday. Nevertheless, I will also send an update for the linux driver.
Also the nvram can be used for bootcounter purposes.
Tested this driver on "PHYTEC phyBOARD-Pollux i.MX8MP" board.
azure build: https://dev.azure.com/hs0298/hs/_build/results?buildId=63&view=results
drivers/rtc/Kconfig | 6 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rv3028.c | 215 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 222 insertions(+) create mode 100644 drivers/rtc/rv3028.c
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index aa6d90158c..e451308b40 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -95,6 +95,12 @@ config RTC_PCF8563 If you say yes here you get support for the Philips PCF8563 RTC and compatible chips. +config RTC_RV3028
- bool "Enable RV3028 driver"
- depends on DM_RTC
- help
The MicroCrystal RV3028 is a I2C Real Time Clock (RTC)
- config RTC_RV3029 bool "Enable RV3029 driver" depends on DM_RTC
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 6a45a9c874..e7acd76266 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_RTC_PCF2127) += pcf2127.o obj-$(CONFIG_RTC_PL031) += pl031.o obj-$(CONFIG_RTC_PT7C4338) += pt7c4338.o obj-$(CONFIG_RTC_RS5C372A) += rs5c372.o +obj-$(CONFIG_RTC_RV3028) += rv3028.o obj-$(CONFIG_RTC_RV3029) += rv3029.o obj-$(CONFIG_RTC_RV8803) += rv8803.o obj-$(CONFIG_RTC_RX8025) += rx8025.o diff --git a/drivers/rtc/rv3028.c b/drivers/rtc/rv3028.c new file mode 100644 index 0000000000..8d8336c5f1 --- /dev/null +++ b/drivers/rtc/rv3028.c @@ -0,0 +1,215 @@ +// SPDX-License-Identifier: GPL-2.0+ +/*
- RTC driver for the Micro Crystal RV3028
- based on linux driver from
- Copyright (C) 2019 Micro Crystal SA
- Alexandre Belloni alexandre.belloni@bootlin.com
- */
+#include <common.h>
Please don't include "common.h" any more. It's deprecated.
+#include <command.h>
Do you really need "command.h" ...
+#include <dm.h> +#include <eeprom.h>
... and this one? Please check and only inlude the necessary headers.
Wouldn't that be needed to expose the on board NVRAM or EEPROM? However I don't see any code to access that right now.