Skip to contentSkip to conversation

support for amlogic rtc

PATCH Applied Xianwei Zhao 2 participants 5 messages Nov 12, 2024

Subsystems (4)
lore
Share & tools
lore

Xianwei Zhao

author maintainer
#0 lore raw

v6 cover support for amlogic rtc

Add rtc driver and bindigns for the amlogic A4(A113L2) and A5(A113X2) SoCs.

---
Changes in v6:
- Solve compilation problems and dropped disable rtc action in remove funcion.
- Link to v5: https://lore.kernel.org/r/[email protected]

Changes in v5:
- Some formatting adjustments and minor fixes were made based on Christophe's suggestions.
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- Keep the same order as as in properties.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Perfect the binding description and rename binding.
- Using dev_err_probe function correctly, and modify commit message.
- Change placement about MAINTAINERS.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Modify bindings clock name and perfect the example.
- Fix some bug in driver, and use dev_err_probe instead of dev_err in probe process.
- Use RTC API to handle calibration.
- Remove unused func and rename driver file name.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Yiting Deng (3):
dt-bindings: rtc: Add Amlogic A4 and A5 RTC
rtc: support for the Amlogic on-chip RTC
MAINTAINERS: Add an entry for Amlogic RTC driver

 .../devicetree/bindings/rtc/amlogic,a4-rtc.yaml    |  63 +++
 MAINTAINERS                                        |   8 +
 drivers/rtc/Kconfig                                |  12 +
 drivers/rtc/Makefile                               |   1 +
 drivers/rtc/rtc-amlogic-a4.c                       | 474 +++++++++++++++++++++
 5 files changed, 558 insertions(+)

---
base-commit: 8a2c49e0fd92e6760636bcfbf11e11d9ddd61cf9
change-id: 20240823-rtc-127cd8192a13

Best regards,

Signature · 1 line
Xianwei Zhao <[email protected]>
author maintainer
#1 lore raw

PATCH v6 1/3 dt-bindings: rtc: Add Amlogic A4 and A5 RTC

From: Yiting Deng <[email protected]>

Add documentation describing the Amlogic A4(A113L2) and A5(A113X2) RTC.

---
 .../devicetree/bindings/rtc/amlogic,a4-rtc.yaml    | 63 ++++++++++++++++++++++
 1 file changed, 63 insertions(+)
Documentation/devicetree/bindings/rtc/amlogic,a4-rtc.yaml new file +63 -0
new file mode 100644
index 000000000000..5d3ac737abcb
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2024 Amlogic, Inc. All rights reserved
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/amlogic,a4-rtc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic A4 and A5 RTC
+
+maintainers:
+  - Yiting Deng <[email protected]>
+  - Xianwei Zhao <[email protected]>
+
+allOf:
+  - $ref: rtc.yaml#
+
+properties:
+  compatible:
+    enum:
+      - amlogic,a4-rtc
+      - amlogic,a5-rtc
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: RTC clock source, available 24M or 32K crystal
+          oscillator source. when using 24M, need to divide 24M into 32K.
+      - description: RTC module accesses the clock of the apb bus.
+
+  clock-names:
+    items:
+      - const: osc
+      - const: sys
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    apb {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        rtc@8e600 {
+            compatible = "amlogic,a4-rtc";
+            reg = <0x0 0x8e600 0x0 0x38>;
+            clocks = <&xtal_32k>, <&clkc_periphs 1>;
+            clock-names = "osc", "sys";
+            interrupts = <GIC_SPI 131 IRQ_TYPE_EDGE_RISING>;
+        };
+    };
Signature · 1 line
2.37.1
author maintainer
#2 lore raw

PATCH v6 2/3 rtc: support for the Amlogic on-chip RTC

In reply to Xianwei Zhao

From: Yiting Deng <[email protected]>

This is the third amlogic driver. The RTC hardware of A4 SoC is different from the previous one. This RTC hardware includes a timing function and an alarm function. But the existing has only timing function, alarm function is using the system clock to implement a virtual alarm. Add the RTC driver to support it.

---
 drivers/rtc/Kconfig          |  12 ++
 drivers/rtc/Makefile         |   1 +
 drivers/rtc/rtc-amlogic-a4.c | 474 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 487 insertions(+)
drivers/rtc/Kconfig +12 -0
index 66eb1122248b..98bce0c42307 100644
@@ -2070,4 +2070,16 @@ 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_AMLOGIC_A4
+	tristate "Amlogic RTC"
+	depends on ARCH_MESON || COMPILE_TEST
+	select REGMAP_MMIO
+	default y
+	help
+	  If you say yes here you get support for the RTC block on the
+	  Amlogic A113L2(A4) and A113X2(A5) SoCs.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called "rtc-amlogic-a4".
+
 endif # RTC_CLASS
drivers/rtc/Makefile +1 -0
index f62340ecc534..efeba9a2eaad 100644
@@ -26,6 +26,7 @@ obj-$(CONFIG_RTC_DRV_ABB5ZES3)	+= rtc-ab-b5ze-s3.o
 obj-$(CONFIG_RTC_DRV_ABEOZ9)	+= rtc-ab-eoz9.o
 obj-$(CONFIG_RTC_DRV_ABX80X)	+= rtc-abx80x.o
 obj-$(CONFIG_RTC_DRV_AC100)	+= rtc-ac100.o
+obj-$(CONFIG_RTC_DRV_AMLOGIC_A4)	+= rtc-amlogic-a4.o
 obj-$(CONFIG_RTC_DRV_ARMADA38X)	+= rtc-armada38x.o
 obj-$(CONFIG_RTC_DRV_AS3722)	+= rtc-as3722.o
 obj-$(CONFIG_RTC_DRV_ASM9260)	+= rtc-asm9260.o
drivers/rtc/rtc-amlogic-a4.c new file +474 -0

474 lines not on this page · raw message

Signature · 1 line
2.37.1
author maintainer
#3 lore raw

PATCH v6 3/3 MAINTAINERS: Add an entry for Amlogic RTC driver

In reply to Xianwei Zhao

From: Yiting Deng <[email protected]>

Add Amlogic RTC entry to MAINTAINERS to clarify the maintainers.

---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
index c27f3190737f..86675e03888c 100644
@@ -1209,6 +1209,14 @@ F:	Documentation/devicetree/bindings/perf/amlogic,g12-ddr-pmu.yaml
 F:	drivers/perf/amlogic/
 F:	include/soc/amlogic/
 
+AMLOGIC RTC DRIVER
+M:	Yiting Deng <[email protected]>
+M:	Xianwei Zhao <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/rtc/amlogic,a4-rtc.yaml
+F:	drivers/rtc/rtc-amlogic-a4.c
+
 AMPHENOL CHIPCAP 2 HUMIDITY-TEMPERATURE IIO DRIVER
 M:	Javier Carrasco <[email protected]>
 L:	[email protected]
Signature · 1 line
2.37.1
maintainer Applied
#4 lore raw
In reply to Xianwei Zhao
Quoted 3 lines · Xianwei Zhao

Add rtc driver and bindigns for the amlogic A4(A113L2) and A5(A113X2) SoCs.

Applied, thanks!

[1/3] dt-bindings: rtc: Add Amlogic A4 and A5 RTC

      https://git.kernel.org/abelloni/c/ce57cf7319e5
[2/3] rtc: support for the Amlogic on-chip RTC
      https://git.kernel.org/abelloni/c/c89ac9182ee2
[3/3] MAINTAINERS: Add an entry for Amlogic RTC driver
      https://git.kernel.org/abelloni/c/a012d430a4f2

Best regards,

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com