Skip to contentSkip to conversation

dt-bindings: rtc: Add pcf85053 support

PATCH New Lakshay Piplani 3 participants 5 messages Oct 24 – Nov 21

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v11 1/2 dt-bindings: rtc: Add pcf85053 support

Add device tree bindings for NXP PCF85053 RTC chip.

---
V10 -> V11: - no changes
V9 -> V10: - Add description for the active-low level alarm interrupt.
- Move the PCF85053 MAINTAINERS entry to the driver patch.
V8 -> V9: - Document optional CLKOUT clock provider and add it to the example.
- Disallow interrupts and nxp,write-access on the secondary interface.
- Describe the alarm interrupt as active-low level triggered.
- Use 'const' for the single compatible string.
V7 -> V8: - Use 'unevaluatedProperties: false' instead of 'additionalProperties:

	    false'.
	  - Fix typo in 'nxp,interface' description ("ready only" -> "read only").

V6 -> V7: - no changes
- Added Reviewed-by: Conor Dooley <[email protected]>
V5 -> V6: - Dropped driver-specific commentary from property descriptions.
- Simplified and clarified descriptions for better readability.
V4 -> V5: - Updated schema validation logic to enforce correct combinations of
'nxp,interface' and 'nxp,write-access' using oneOf clauses.
- Refined property descriptions for clarity and hardware alignment.
V3 -> V4: Add dedicated nxp,pcf85053.yaml.
Remove entry from trivial-rtc.yaml.
V2 -> V3: Moved MAINTAINERS file changes to the driver patch
V1 -> V2: Handled dt-bindings by trivial-rtc.yaml

---
 .../devicetree/bindings/rtc/nxp,pcf85053.yaml | 132 ++++++++++++++++++
 1 file changed, 132 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/nxp,pcf85053.yaml
Documentation/devicetree/bindings/rtc/nxp,pcf85053.yaml new file +132 -0
new file mode 100644
index 000000000000..960f871b6334
@@ -0,0 +1,132 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2025-2026 NXP
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/nxp,pcf85053.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP PCF85053 Real Time Clock
+
+maintainers:
+  - Pankit Garg <[email protected]>
+  - Lakshay Piplani <[email protected]>
+
+properties:
+  compatible:
+    const: nxp,pcf85053
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+    description: |
+      Alarm interrupt output. The ALRT pin is active-low and should be
+      configured as a level-low interrupt.
+
+  "#clock-cells":
+    const: 0
+    description: |
+      Present when the CLKOUT pin is exposed as a clock provider. In a
+      dual-host configuration, only one PCF85053 interface node should
+      expose CLKOUT as a clock provider.
+
+  clock-output-names:
+    maxItems: 1
+
+  nxp,interface:
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [ primary, secondary ]
+    description: |
+      Identifies this host's logical role in a multi-host topology for the
+      PCF85053 RTC. The device exposes a "TWO" ownership bit in the CTRL
+      register that gates which host may write the time registers.
+        - "primary": Designated host that *may* claim write ownership (set
+          CTRL.TWO=1) **if** write-access is explicitly requested.
+        - "secondary": Peer host that writes only when CTRL.TWO=0 (default).
+
+      This property determines the intended role of the host in relation to
+      the write ownership.
+
+      The actual role depends on whether 'nxp,write-access' is also specified.
+      Supported configurations are:
+        1. Primary with 'nxp,write-access' -> primary claims write ownership.
+        2. Primary without 'nxp,write-access' -> secondary owns time-register writes.
+        3. Secondary (must not specify 'nxp,write-access') -> secondary may write
+           the time registers when CTRL.TWO=0.
+
+  nxp,write-access:
+    type: boolean
+    description: |
+      Indicates that write ownership of the PCF85053 RTC should be claimed by setting
+      CTRL.TWO=1. This property is only valid when acting as the primary interface
+      (nxp,interface="primary").
+
+required:
+  - compatible
+  - reg
+  - nxp,interface
+
+unevaluatedProperties: false
+
+allOf:
+  - $ref: rtc.yaml#
+  - if:
+      properties:
+        nxp,interface:
+          const: secondary
+    then:
+      properties:
+        # The secondary interface has read-only access to the control and
+        # status registers, so it cannot service or clear the alarm IRQ and
+        # cannot claim write ownership.
+        interrupts: false
+        nxp,write-access: false
+
+examples:
+  # Single host example.
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      rtc@6f {
+        compatible = "nxp,pcf85053";
+        reg = <0x6f>;
+        nxp,interface = "primary";
+        nxp,write-access;
+        #clock-cells = <0>;
+        clock-output-names = "pcf85053-clkout";
+        interrupt-parent = <&gpio2>;
+        interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
+      };
+    };
+
+  # Dual-host example: one primary that claims writes; one secondary that never claims writes.
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      rtc@6f {
+        compatible = "nxp,pcf85053";
+        reg = <0x6f>;
+        nxp,interface = "primary";
+        nxp,write-access;
+        interrupt-parent = <&gpio2>;
+        interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
+      };
+    };
+
+    i2c1 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      rtc@6f {
+        compatible = "nxp,pcf85053";
+        reg = <0x6f>;
+        nxp,interface = "secondary";
+      };
+    };
Signature · 1 line
2.25.1
#1 lore raw

PATCH v11 2/2 rtc: Add NXP PCF85053 driver support

PCF85053 is i2c based RTC which supports timer and calendar functionality.

Features supported:
1. Read/Write time
2. Get/Set Alarm
3. Wakeup Source
4. Generate up to 32768Hz clock output
5. Primary/Secondary i2c bus

---
V10 -> V11: - When no firmware node is present, default to a standalone primary
interface and claim time-register write ownership, allowing devices instantiated through the I2C new_device interface to probe and set time.
- Use device_property_*() for the interface and write-ownership properties.
V9 -> V10: - Move the PCF85053 MAINTAINERS entry from the binding patch.
- No driver functional changes.
V8 -> V9: - Select REGMAP_I2C; avoid RMW on write-0-to-clear status flags.
- Fix alarm IRQ enable/flag sequencing; disable unused OFIE/CIE sources.
- Limit alarms to the 24-hour window; handle alarm don't-care values.
- Restrict alarm IRQ handling to the primary interface.
- Handle CLKOUT ownership via XCLK; register provider only with #clock-cells.
- Use managed wake IRQ handling.
V7 -> V8: - read_time(): evaluate the status register and return -EINVAL when the
OF (oscillator fail) or RTCF flag is set, instead of ignoring it and using a corrupted time.
- set_time()/set_alarm(): stop forcing 24h/binary mode; format values to match the mode the device is currently configured for, avoiding corruption of the running clock and the read-only secondary interface.
- set_time(): read-modify-write the interleaved time/alarm block so a previously configured alarm is preserved instead of being cleared.
- Clear OF/RTCF after a valid set_time() and add an RTC_VL_CLR ioctl so the RTC no longer reports data permanently invalid after a power loss.
- clkout: use devm_clk_hw_register()/devm_of_clk_add_hw_provider() so the clock provider is removed on unbind/probe failure, fixing the leak and potential use-after-free.
V6 -> V7: - Addressed minor cleanups from review: use dev_get_drvdata()/dev_set_drvdata()
consistently, fix alarm IRQ dev_id handling, and switch to devm_device_init_wakeup().
- Simplified time/alarm programming by forcing 24h + binary mode in hardware, dropping complex 12h/BCD handling in setters.
- Documented the 2000-2099 supported year range, explaining how the 00-99 year register maps to leap-year behavior in the device.
V5 -> V6: no changes
V4 -> V5: no changes
V3 -> V4: - Handle multi-host ownership explicitly using primary/secondary bus hadling.
- Probe no longer changes any CTRL bits unconditionally and do not clear ST/AF/OF avoiding lost interrupts or silent mode changes.
- Read/Set time & alarm now respect HF(12/24h) and DM(BCD/BIN) converting hour fields correctly for all combinations.
- Minor changes: drop noisy warnings, tidy error paths/comments.
V2 -> V3: Add MAINTAINERS file changes to this patch
V1 -> V2: no changes

---
 MAINTAINERS                |   8 +
 drivers/rtc/Kconfig        |  11 +
 drivers/rtc/Makefile       |   1 +
 drivers/rtc/rtc-pcf85053.c | 912 +++++++++++++++++++++++++++++++++++++
 4 files changed, 932 insertions(+)
 create mode 100644 drivers/rtc/rtc-pcf85053.c
MAINTAINERS +8 -0
index c2414447892c..79b3fc694120 100644
@@ -19788,6 +19788,14 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/extcon/extcon-ptn5150.yaml
 F:	drivers/extcon/extcon-ptn5150.c
 
+NXP RTC PCF85053 DRIVER
+M:	Pankit Garg <[email protected]>
+M:	Lakshay Piplani <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/rtc/nxp,pcf85053.yaml
+F:	drivers/rtc/rtc-pcf85053.c
+
 NXP SGTL5000 DRIVER
 M:	Fabio Estevam <[email protected]>
 L:	[email protected]
drivers/rtc/Kconfig +11 -0
index 05b9233b9418..d261d71a0af3 100644
@@ -1005,6 +1005,17 @@ config RTC_DRV_PCF85063
 	  This driver can also be built as a module. If so, the module
 	  will be called rtc-pcf85063.
 
+config RTC_DRV_PCF85053
+	tristate "NXP PCF85053"
+	depends on OF && I2C
+	select REGMAP_I2C
+	help
+	  If you say yes here you get support for the NXP PCF85053 I2C Bootable CPU RTC
+	  chip.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-pcf85053.
+
 config RTC_DRV_RV3029C2
 	tristate "Micro Crystal RV3029/3049"
 	depends on RTC_I2C_AND_SPI
drivers/rtc/Makefile +1 -0
index 0347645b021f..9bf36f3b76e7 100644
@@ -131,6 +131,7 @@ obj-$(CONFIG_RTC_DRV_PALMAS)	+= rtc-palmas.o
 obj-$(CONFIG_RTC_DRV_PCF2123)	+= rtc-pcf2123.o
 obj-$(CONFIG_RTC_DRV_PCF2127)	+= rtc-pcf2127.o
 obj-$(CONFIG_RTC_DRV_PCF85063)	+= rtc-pcf85063.o
+obj-$(CONFIG_RTC_DRV_PCF85053)	+= rtc-pcf85053.o
 obj-$(CONFIG_RTC_DRV_PCF8523)	+= rtc-pcf8523.o
 obj-$(CONFIG_RTC_DRV_PCF85363)	+= rtc-pcf85363.o
 obj-$(CONFIG_RTC_DRV_PCF8563)	+= rtc-pcf8563.o
drivers/rtc/rtc-pcf85053.c new file +912 -0

912 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v11 2/2] rtc: Add NXP PCF85053 driver support

Sashiko has reviewed this patch and found no issues.
Quoted 10 lines

PCF85053 is i2c based RTC which supports timer and calendar functionality.

Features supported:
1. Read/Write time
2. Get/Set Alarm
3. Wakeup Source
4. Generate up to 32768Hz clock output
5. Primary/Secondary i2c bus

Quoted 3 lines

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#3 lore raw

PATCH v11 2/2 rtc: Add NXP PCF85053 driver support

In reply to Lakshay Piplani

Thanks for the patch.

Quoted 14 lines

Date: Sat, 24 Oct 2026 16:34:37 +0530 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

PCF85053 is i2c based RTC which supports timer and calendar functionality.

Features supported:
1. Read/Write time
2. Get/Set Alarm
3. Wakeup Source
4. Generate up to 32768Hz clock output
5. Primary/Secondary i2c bus

Quoted 3 lines

Test on the StarFive JHB100 EVB1:

Best Regards,
Changhuang