Re: [PATCH v2 2/4] rtc: s32g: add NXP S32G2/S32G3 SoC support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/17/2024 11:34 AM, Nobuhiro Iwamatsu wrote:

Hello Nobuhiro,

Thanks for your review!

Hello,

2024年10月15日(火) 19:52 Ciprian Costea <ciprianmarian.costea@xxxxxxxxxxx>:

From: Ciprian Marian Costea <ciprianmarian.costea@xxxxxxxxxxx>

Add a RTC driver for NXP S32G2/S32G3 SoCs.

The RTC module is used to enable Suspend to RAM (STR) support
on NXP S32G2/S32G3 SoC based boards.
RTC tracks clock time during system suspend.

RTC from S32G2/S32G3 is not battery-powered and it is not
kept alive during system reset.

Co-developed-by: Bogdan Hamciuc <bogdan.hamciuc@xxxxxxx>
Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@xxxxxxx>
Co-developed-by: Ghennadi Procopciuc <Ghennadi.Procopciuc@xxxxxxx>
Signed-off-by: Ghennadi Procopciuc <Ghennadi.Procopciuc@xxxxxxx>
Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@xxxxxxxxxxx>
---
  drivers/rtc/Kconfig    |  11 +
  drivers/rtc/Makefile   |   1 +
  drivers/rtc/rtc-s32g.c | 778 +++++++++++++++++++++++++++++++++++++++++
  3 files changed, 790 insertions(+)
  create mode 100644 drivers/rtc/rtc-s32g.c

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index e87c3d74565c..18fc3577f6cd 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -2054,4 +2054,15 @@ config RTC_DRV_SSD202D
           This driver can also be built as a module, if so, the module
           will be called "rtc-ssd20xd".

+config RTC_DRV_S32G
+       tristate "RTC driver for S32G2/S32G3 SoCs"
+       depends on ARCH_S32 || COMPILE_TEST
+       depends on COMMON_CLK
+       help
+         Say yes to enable RTC driver for platforms based on the
+         S32G2/S32G3 SoC family.
+
+         This RTC module can be used as a wakeup source.
+         Please note that it is not battery-powered.
+
  endif # RTC_CLASS
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 8ee79cb18322..a63d010a753c 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -158,6 +158,7 @@ obj-$(CONFIG_RTC_DRV_RX8025)        += rtc-rx8025.o
  obj-$(CONFIG_RTC_DRV_RX8111)   += rtc-rx8111.o
  obj-$(CONFIG_RTC_DRV_RX8581)   += rtc-rx8581.o
  obj-$(CONFIG_RTC_DRV_RZN1)     += rtc-rzn1.o
+obj-$(CONFIG_RTC_DRV_S32G)     += rtc-s32g.o
  obj-$(CONFIG_RTC_DRV_S35390A)  += rtc-s35390a.o
  obj-$(CONFIG_RTC_DRV_S3C)      += rtc-s3c.o
  obj-$(CONFIG_RTC_DRV_S5M)      += rtc-s5m.o
diff --git a/drivers/rtc/rtc-s32g.c b/drivers/rtc/rtc-s32g.c
new file mode 100644
index 000000000000..d6502d8bf616
--- /dev/null
+++ b/drivers/rtc/rtc-s32g.c

[...]

+enum {
+       DIV1 = 1,
+       DIV32 = 32,
+       DIV512 = 512,
+       DIV512_32 = 16384
+};
+
+struct rtc_time_base {
+       s64 sec;
+       u64 cycles;
+       u64 rollovers;
+       struct rtc_time tm;
+};
+
+struct rtc_priv {
+       struct rtc_device *rdev;
+       struct device *dev;

You don't have to have 'struct device' here. You can refer to 'struct
device' from
member variable dev.parent of 'struct rtc_device'.


Thanks for your suggestion. I will update accordingly in V3.

Best regards,
   Nobuhiro


Best Regards,
Ciprian





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux