Add support for Nuvoton ma35d1 rtc controller
Subsystems (4)
v3 cover Add support for Nuvoton ma35d1 rtc controller
From: Jacky Huang <[email protected]>
This patch series adds the rtc driver for the nuvoton ma35d1 ARMv8 SoC. It includes DT binding documentation, the ma35d1 rtc driver, and device tree updates.
The ma35d1 rtc controller provides real-time and calendar messaging capabilities. It supports programmable time tick and alarm match interrupts. The time and calendar messages are expressed in BCD format.
This rtc driver has been tested on the ma35d1 som board with Linux 6.5-rc2. It passed the rtctest and rtc-range 2000 ~ 2099.
v3:
- Update ma35d1 rtc driver
- Renamed "TICKIEN" to "UIEN" as their functional equivalence.
- Eliminated the usage of 'struct ma35_bcd_time' and associated ma35d1 bcd functions; instead, opted to directly utilize the "bin2bcd()" function
- Employed "ma35d1_alarm_irq_enable()" to accommodate the "alrm->enabled" feature
- Revised the probe sequence and implemented a check to verify if the rtc was initialized
- Other minor fixes
v2:
- Updated nuvoton,ma35d1-rtc.yaml
- Modified patch title and fixed typo
- Added reference to rtc.yaml
- Used unevaluatedProperties instead of additionalProperties
- Modified rtc driver
- Used dev_err_probe()
- Removed ma35d1_rtc_remove()
- Made other minor fixes
Jacky Huang (3):
dt-bindings: rtc: Add Nuvoton ma35d1 rtc
arm64: dts: nuvoton: Add rtc for ma35d1
rtc: Add driver for Nuvoton ma35d1 rtc controller
.../bindings/rtc/nuvoton,ma35d1-rtc.yaml | 48 +++ .../boot/dts/nuvoton/ma35d1-iot-512m.dts | 4 + .../boot/dts/nuvoton/ma35d1-som-256m.dts | 4 + arch/arm64/boot/dts/nuvoton/ma35d1.dtsi | 8 + drivers/rtc/Kconfig | 11 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-ma35d1.c | 324 ++++++++++++++++++ 7 files changed, 400 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/nuvoton,ma35d1-rtc.yaml create mode 100644 drivers/rtc/rtc-ma35d1.c
Signature · 1 line
2.34.1
PATCH v3 1/3 dt-bindings: rtc: Add Nuvoton ma35d1 rtc
From: Jacky Huang <[email protected]>
Add documentation describing the Nuvoton ma35d1 rtc controller.
--- .../bindings/rtc/nuvoton,ma35d1-rtc.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/nuvoton,ma35d1-rtc.yaml
Documentation/devicetree/bindings/rtc/nuvoton,ma35d1-rtc.yaml new file +48 -0
@@ -0,0 +1,48 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/rtc/nuvoton,ma35d1-rtc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nuvoton MA35D1 Real Time Clock + +maintainers: + - Min-Jen Chen <[email protected]> + +allOf: + - $ref: rtc.yaml# + +properties: + compatible: + enum: + - nuvoton,ma35d1-rtc + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + - clocks + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/nuvoton,ma35d1-clk.h> + rtc@40410000 { + compatible = "nuvoton,ma35d1-rtc"; + reg = <0x40410000 0x200>; + interrupts = <GIC_SPI 5 IRQ_TYPE_EDGE_RISING>; + clocks = <&clk RTC_GATE>; + }; + +...
Signature · 1 line
2.34.1
PATCH v3 2/3 arm64: dts: nuvoton: Add rtc for ma35d1
In reply to Jacky HuangFrom: Jacky Huang <[email protected]>
Add rtc controller support to the dtsi of ma35d1 SoC and enable rtc on SOM and IoT boards.
--- arch/arm64/boot/dts/nuvoton/ma35d1-iot-512m.dts | 4 ++++ arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts | 4 ++++ arch/arm64/boot/dts/nuvoton/ma35d1.dtsi | 8 ++++++++ 3 files changed, 16 insertions(+)
arch/arm64/boot/dts/nuvoton/ma35d1-iot-512m.dts +4 -0
@@ -54,3 +54,7 @@ &clk { "integer", "integer"; }; + +&rtc { + status = "okay"; +};
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +4 -0
@@ -54,3 +54,7 @@ &clk { "integer", "integer"; }; + +&rtc { + status = "okay"; +};
arch/arm64/boot/dts/nuvoton/ma35d1.dtsi +8 -0
@@ -95,6 +95,14 @@ clk: clock-controller@40460200 { clocks = <&clk_hxt>; }; + rtc: rtc@40410000 { + compatible = "nuvoton,ma35d1-rtc"; + reg = <0x0 0x40410000 0x0 0x200>; + interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk RTC_GATE>; + status = "disabled"; + }; + uart0: serial@40700000 { compatible = "nuvoton,ma35d1-uart"; reg = <0x0 0x40700000 0x0 0x100>;
Signature · 1 line
2.34.1
PATCH v3 3/3 rtc: Add driver for Nuvoton ma35d1 rtc controller
In reply to Jacky HuangFrom: Jacky Huang <[email protected]>
The ma35d1 rtc controller provides real-time and calendar messaging capabilities. It supports programmable time tick and alarm match interrupts. The time and calendar messages are expressed in BCD format. This driver supports the built-in rtc controller of the ma35d1. It enables setting and reading the rtc time and configuring and reading the rtc alarm.
--- drivers/rtc/Kconfig | 11 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-ma35d1.c | 324 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 336 insertions(+) create mode 100644 drivers/rtc/rtc-ma35d1.c
drivers/rtc/Kconfig +11 -0
@@ -1929,6 +1929,17 @@ config RTC_DRV_TI_K3 This driver can also be built as a module, if so, the module will be called "rtc-ti-k3". +config RTC_DRV_MA35D1 + tristate "Nuvoton MA35D1 RTC" + depends on ARCH_MA35 || COMPILE_TEST + select REGMAP_MMIO + help + If you say yes here you get support for the Nuvoton MA35D1 + On-Chip Real Time Clock. + + This driver can also be built as a module, if so, the module + will be called "rtc-ma35d1". + comment "HID Sensor RTC drivers" config RTC_DRV_HID_SENSOR_TIME
drivers/rtc/Makefile +1 -0
@@ -88,6 +88,7 @@ obj-$(CONFIG_RTC_DRV_M41T94) += rtc-m41t94.o obj-$(CONFIG_RTC_DRV_M48T35) += rtc-m48t35.o obj-$(CONFIG_RTC_DRV_M48T59) += rtc-m48t59.o obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o +obj-$(CONFIG_RTC_DRV_MA35D1) += rtc-ma35d1.o obj-$(CONFIG_RTC_DRV_MAX6900) += rtc-max6900.o obj-$(CONFIG_RTC_DRV_MAX6902) += rtc-max6902.o obj-$(CONFIG_RTC_DRV_MAX6916) += rtc-max6916.o
drivers/rtc/rtc-ma35d1.c new file +324 -0
324 lines not on this page · raw message
Signature · 1 line
2.34.1