All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] rtc: pcf85363: add support for timestamp and watchdog
@ 2025-08-08 11:22 Lakshay Piplani
  2025-08-08 11:22 ` [PATCH 2/2] rtc: pcf85363: add support for additional features Lakshay Piplani
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lakshay Piplani @ 2025-08-08 11:22 UTC (permalink / raw)
  To: alexandre.belloni, linux-rtc, linux-kernel, robh, krzk+dt,
	conor+dt, devicetree
  Cc: vikash.bansal, priyanka.jain, shashank.rebbapragada,
	Lakshay Piplani

Extend the device tree binding for NXP PCF85263/PCF85363 RTC with:
- Timestamp mode configuration
- Watchdog timer configuration

Also introduce a new header 'pcf85363-tsr.h' to expose
macros for timestamp mode fields, improving readability
of device tree file.

Signed-off-by: Lakshay Piplani <lakshay.piplani@nxp.com>
---
 .../devicetree/bindings/rtc/nxp,pcf85363.yaml | 44 ++++++++++++++++++-
 include/dt-bindings/rtc/pcf85363-tsr.h        | 28 ++++++++++++
 2 files changed, 71 insertions(+), 1 deletion(-)
 create mode 100644 include/dt-bindings/rtc/pcf85363-tsr.h

diff --git a/Documentation/devicetree/bindings/rtc/nxp,pcf85363.yaml b/Documentation/devicetree/bindings/rtc/nxp,pcf85363.yaml
index 52aa3e2091e9..2d2b52f7a9ba 100644
--- a/Documentation/devicetree/bindings/rtc/nxp,pcf85363.yaml
+++ b/Documentation/devicetree/bindings/rtc/nxp,pcf85363.yaml
@@ -4,7 +4,7 @@
 $id: http://devicetree.org/schemas/rtc/nxp,pcf85363.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Philips PCF85263/PCF85363 Real Time Clock
+title: NXP PCF85263/PCF85363 Real Time Clock
 
 maintainers:
   - Alexandre Belloni <alexandre.belloni@bootlin.com>
@@ -39,6 +39,41 @@ properties:
   start-year: true
   wakeup-source: true
 
+  nxp,timestamp-mode:
+    description: |
+      Defines timestamp modes for TSR1, TSR2, and TSR3.
+      Use macros from `dt-bindings/rtc/pcf85363-tsr.h`.
+    items:
+      - description: TSR1 mode (e.g., PCF85363_TSR1_FE)
+      - description: TSR2 mode (e.g., PCF85363_TSR2_LB)
+      - description: TSR3 mode (e.g., PCF85363_TSR3_LV)
+
+  nxp,enable-watchdog:
+    type: boolean
+    description: |
+      If present, the RTC watchdog timer is enabled and integrated with Linux watchdog subsystem.
+
+  nxp,watchdog-timeout:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 31
+    default: 10
+    description: |
+      Watchdog timeout value in seconds. Allowed values range from 1 to 31.
+
+  nxp,watchdog-stepsize:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0
+    maximum: 3
+    default: 0
+    description: |
+      Watchdog step size select: 0=0.25Hz, 1=1Hz, 2=4Hz, 3=16Hz.
+
+  nxp,watchdog-repeat:
+    type: boolean
+    description: |
+      If present, sets the watchdog to repeat mode. If omitted, watchdog runs in one-shot mode.
+
 required:
   - compatible
   - reg
@@ -47,6 +82,7 @@ additionalProperties: false
 
 examples:
   - |
+    #include <dt-bindings/rtc/pcf85363-tsr.h>
     i2c {
         #address-cells = <1>;
         #size-cells = <0>;
@@ -56,5 +92,11 @@ examples:
             reg = <0x51>;
             #clock-cells = <0>;
             quartz-load-femtofarads = <12500>;
+            wakeup-source;
+            nxp,timestamp-mode = <PCF85363_TSR1_FE PCF85363_TSR2_LB PCF85363_TSR3_LV>;
+            nxp,enable-watchdog;
+            nxp,watchdog-timeout = <10>;
+            nxp,watchdog-stepsize = <0>;
+            nxp,watchdog-repeat;
         };
     };
diff --git a/include/dt-bindings/rtc/pcf85363-tsr.h b/include/dt-bindings/rtc/pcf85363-tsr.h
new file mode 100644
index 000000000000..1fb5b9b3601e
--- /dev/null
+++ b/include/dt-bindings/rtc/pcf85363-tsr.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
+/*
+ * Copyright 2025 NXP
+ */
+
+#ifndef _DT_BINDINGS_RTC_PCF85363_TSR_H
+#define _DT_BINDINGS_RTC_PCF85363_TSR_H
+
+/* TSR1 modes */
+#define PCF85363_TSR1_NONE 0x00
+#define PCF85363_TSR1_FE 0x01
+#define PCF85363_TSR1_LE 0x02
+
+/* TSR2 modes */
+#define PCF85363_TSR2_NONE 0x00
+#define PCF85363_TSR2_FB 0x01
+#define PCF85363_TSR2_LB 0x02
+#define PCF85363_TSR2_LV 0x03
+#define PCF85363_TSR2_FE 0x04
+#define PCF85363_TSR2_LE 0x05
+
+/* TSR3 modes */
+#define PCF85363_TSR3_NONE 0x00
+#define PCF85363_TSR3_FB 0x01
+#define PCF85363_TSR3_LB 0x02
+#define PCF85363_TSR3_LV 0x03
+
+#endif /* _DT_BINDINGS_RTC_PCF85363_TSR_H */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] rtc: pcf85363: add support for additional features
@ 2025-08-10  4:31 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2025-08-10  4:31 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250808112246.4169280-2-lakshay.piplani@nxp.com>
References: <20250808112246.4169280-2-lakshay.piplani@nxp.com>
TO: Lakshay Piplani <lakshay.piplani@nxp.com>
TO: alexandre.belloni@bootlin.com
TO: linux-rtc@vger.kernel.org
TO: linux-kernel@vger.kernel.org
TO: robh@kernel.org
TO: krzk+dt@kernel.org
TO: conor+dt@kernel.org
TO: devicetree@vger.kernel.org
CC: vikash.bansal@nxp.com
CC: priyanka.jain@nxp.com
CC: shashank.rebbapragada@nxp.com
CC: Lakshay Piplani <lakshay.piplani@nxp.com>

Hi Lakshay,

kernel test robot noticed the following build warnings:

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on linus/master v6.16 next-20250808]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lakshay-Piplani/rtc-pcf85363-add-support-for-additional-features/20250808-192449
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
patch link:    https://lore.kernel.org/r/20250808112246.4169280-2-lakshay.piplani%40nxp.com
patch subject: [PATCH 2/2] rtc: pcf85363: add support for additional features
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: openrisc-randconfig-r071-20250810 (https://download.01.org/0day-ci/archive/20250810/202508101234.9f8Bejne-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 12.5.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202508101234.9f8Bejne-lkp@intel.com/

smatch warnings:
drivers/rtc/rtc-pcf85363.c:634 pcf85363_watchdog_init() error: uninitialized symbol 'ret'.

vim +/ret +634 drivers/rtc/rtc-pcf85363.c

9ca6579ec239f99 Lakshay Piplani 2025-08-08  605  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  606  /*
9ca6579ec239f99 Lakshay Piplani 2025-08-08  607   * Parses watchdog configuration from device tree and registers the
9ca6579ec239f99 Lakshay Piplani 2025-08-08  608   * watchdog with the Linux watchdog subsystem.
9ca6579ec239f99 Lakshay Piplani 2025-08-08  609   */
9ca6579ec239f99 Lakshay Piplani 2025-08-08  610  static int pcf85363_watchdog_init(struct device *dev, struct regmap *regmap)
9ca6579ec239f99 Lakshay Piplani 2025-08-08  611  {
9ca6579ec239f99 Lakshay Piplani 2025-08-08  612  	struct pcf85363_watchdog *wd;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  613  	u32 timeout = 10, clock = 0;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  614  	int ret;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  615  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  616  	if (!IS_ENABLED(CONFIG_WATCHDOG) || !device_property_read_bool(dev, "nxp,enable-watchdog"))
9ca6579ec239f99 Lakshay Piplani 2025-08-08  617  		return 0;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  618  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  619  	wd = devm_kzalloc(dev, sizeof(*wd), GFP_KERNEL);
9ca6579ec239f99 Lakshay Piplani 2025-08-08  620  	if (!wd)
9ca6579ec239f99 Lakshay Piplani 2025-08-08  621  		return -ENOMEM;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  622  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  623  	wd->regmap = regmap;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  624  	wd->dev = dev;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  625  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  626  	device_property_read_u32(dev, "nxp,watchdog-timeout", &timeout);
9ca6579ec239f99 Lakshay Piplani 2025-08-08  627  	wd->timeout_val = clamp(timeout, WD_TIMEOUT_MIN, WD_TIMEOUT_MAX);
9ca6579ec239f99 Lakshay Piplani 2025-08-08  628  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  629  	device_property_read_u32(dev, "nxp,watchdog-stepsize", &clock);
9ca6579ec239f99 Lakshay Piplani 2025-08-08  630  	wd->clock_sel = clock & WD_CLKSEL_MASK;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  631  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  632  	wd->repeat = device_property_read_bool(dev, "nxp,watchdog-repeat");
9ca6579ec239f99 Lakshay Piplani 2025-08-08  633  
9ca6579ec239f99 Lakshay Piplani 2025-08-08 @634  	if (ret)
9ca6579ec239f99 Lakshay Piplani 2025-08-08  635  		return ret;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  636  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  637  	/* Clear any stale WDF flag */
9ca6579ec239f99 Lakshay Piplani 2025-08-08  638  	regmap_update_bits(regmap, CTRL_FLAGS, FLAGS_WDF, 0);
9ca6579ec239f99 Lakshay Piplani 2025-08-08  639  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  640  	/* Register the watchdog device */
9ca6579ec239f99 Lakshay Piplani 2025-08-08  641  	wd->wdd.info = &pcf85363_wdt_info;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  642  	wd->wdd.ops = &pcf85363_wdt_ops;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  643  	wd->wdd.min_timeout = WD_TIMEOUT_MIN;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  644  	wd->wdd.max_timeout = WD_TIMEOUT_MAX;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  645  	wd->wdd.timeout = wd->timeout_val;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  646  	wd->wdd.parent = dev;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  647  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  648  	/*
9ca6579ec239f99 Lakshay Piplani 2025-08-08  649  	 * For testing purposes, it's recommended to enable CONFIG_WATCHDOG_NOWAYOUT
9ca6579ec239f99 Lakshay Piplani 2025-08-08  650  	 * in the kernel configuration. If this option is not set, the watchdog may stop
9ca6579ec239f99 Lakshay Piplani 2025-08-08  651  	 * immediately after being started, especially if the user-space daemon closes
9ca6579ec239f99 Lakshay Piplani 2025-08-08  652  	 * /dev/watchdog without keeping it alive. Enabling NOWAYOUT ensures the watchdog
9ca6579ec239f99 Lakshay Piplani 2025-08-08  653  	 * remains active and can properly test system reset behavior.
9ca6579ec239f99 Lakshay Piplani 2025-08-08  654  	 */
9ca6579ec239f99 Lakshay Piplani 2025-08-08  655  	wd->wdd.status = WATCHDOG_NOWAYOUT_INIT_STATUS;
9ca6579ec239f99 Lakshay Piplani 2025-08-08  656  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  657  	watchdog_set_drvdata(&wd->wdd, wd);
9ca6579ec239f99 Lakshay Piplani 2025-08-08  658  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  659  	dev_info(dev, "pcf85363: watchdog initialized successfully\n");
9ca6579ec239f99 Lakshay Piplani 2025-08-08  660  
9ca6579ec239f99 Lakshay Piplani 2025-08-08  661  	return devm_watchdog_register_device(dev, &wd->wdd);
9ca6579ec239f99 Lakshay Piplani 2025-08-08  662  }
9ca6579ec239f99 Lakshay Piplani 2025-08-08  663  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-10  4:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 11:22 [PATCH 1/2] rtc: pcf85363: add support for timestamp and watchdog Lakshay Piplani
2025-08-08 11:22 ` [PATCH 2/2] rtc: pcf85363: add support for additional features Lakshay Piplani
2025-08-09  4:39   ` kernel test robot
2025-08-08 13:29 ` [PATCH 1/2] rtc: pcf85363: add support for timestamp and watchdog Rob Herring (Arm)
2025-08-08 19:23 ` Rob Herring
  -- strict thread matches above, loose matches on Subject: below --
2025-08-10  4:31 [PATCH 2/2] rtc: pcf85363: add support for additional features kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.