devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] add support for RV8063 SPI rtc
@ 2025-04-07 19:35 Antoni Pokusinski
  2025-04-07 19:35 ` [PATCH 1/3] rtc: pcf85063: create pcf85063_i2c_probe Antoni Pokusinski
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Antoni Pokusinski @ 2025-04-07 19:35 UTC (permalink / raw)
  To: alexandre.belloni, krzk+dt, conor+dt, robh, alexander.stein
  Cc: linux-rtc, linux-kernel, devicetree, Antoni Pokusinski

This patch series adds support for the Microcrystal RV8063 real time
clock module with SPI interface. This device is very similar to RV8263
(which however uses I2C), so I decided to extend the existing driver instead 
of creating a new one.

RV8063 datasheet: https://www.microcrystal.com/fileadmin/Media/Products/RTC/App.Manual/RV-8063-C7_App-Manual.pdf

Antoni Pokusinski (3):
  rtc: pcf85063: create pcf85063_i2c_probe
  rtc: pcf85063: add support for RV8063
  dt-bindings: rtc: add binding for RV8063

 .../devicetree/bindings/rtc/nxp,pcf85063.yaml |  33 +++-
 drivers/rtc/Kconfig                           |  21 ++-
 drivers/rtc/rtc-pcf85063.c                    | 169 +++++++++++++++---
 3 files changed, 186 insertions(+), 37 deletions(-)

-- 
2.25.1


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

* [PATCH 1/3] rtc: pcf85063: create pcf85063_i2c_probe
  2025-04-07 19:35 [PATCH 0/3] add support for RV8063 SPI rtc Antoni Pokusinski
@ 2025-04-07 19:35 ` Antoni Pokusinski
  2025-04-07 19:35 ` [PATCH 2/3] rtc: pcf85063: add support for RV8063 Antoni Pokusinski
  2025-04-07 19:35 ` [PATCH 3/3] dt-bindings: rtc: add binding " Antoni Pokusinski
  2 siblings, 0 replies; 9+ messages in thread
From: Antoni Pokusinski @ 2025-04-07 19:35 UTC (permalink / raw)
  To: alexandre.belloni, krzk+dt, conor+dt, robh, alexander.stein
  Cc: linux-rtc, linux-kernel, devicetree, Antoni Pokusinski

Move the i2c-specific code from pcf85063_probe to the newly created
function.

This is a preparation for introducing the support for RV8063 real-time
clock with SPI interface.

Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
---
 drivers/rtc/rtc-pcf85063.c | 97 +++++++++++++++++++++++++++-----------
 1 file changed, 70 insertions(+), 27 deletions(-)

diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
index 4fa5c4ecdd5a..03dfc58f4cd7 100644
--- a/drivers/rtc/rtc-pcf85063.c
+++ b/drivers/rtc/rtc-pcf85063.c
@@ -559,12 +559,12 @@ static const struct pcf85063_config config_rv8263 = {
 	.force_cap_7000 = 1,
 };
 
-static int pcf85063_probe(struct i2c_client *client)
+static int pcf85063_probe(struct device *dev, struct regmap *regmap, int irq,
+			  const struct pcf85063_config *config)
 {
 	struct pcf85063 *pcf85063;
 	unsigned int tmp;
 	int err;
-	const struct pcf85063_config *config;
 	struct nvmem_config nvmem_cfg = {
 		.name = "pcf85063_nvram",
 		.reg_read = pcf85063_nvmem_read,
@@ -573,28 +573,22 @@ static int pcf85063_probe(struct i2c_client *client)
 		.size = 1,
 	};
 
-	dev_dbg(&client->dev, "%s\n", __func__);
+	dev_dbg(dev, "%s\n", __func__);
 
-	pcf85063 = devm_kzalloc(&client->dev, sizeof(struct pcf85063),
+	pcf85063 = devm_kzalloc(dev, sizeof(struct pcf85063),
 				GFP_KERNEL);
 	if (!pcf85063)
 		return -ENOMEM;
 
-	config = i2c_get_match_data(client);
-	if (!config)
-		return -ENODEV;
-
-	pcf85063->regmap = devm_regmap_init_i2c(client, &config->regmap);
-	if (IS_ERR(pcf85063->regmap))
-		return PTR_ERR(pcf85063->regmap);
+	pcf85063->regmap = regmap;
 
-	i2c_set_clientdata(client, pcf85063);
+	dev_set_drvdata(dev, pcf85063);
 
 	err = regmap_read(pcf85063->regmap, PCF85063_REG_SC, &tmp);
 	if (err)
-		return dev_err_probe(&client->dev, err, "RTC chip is not present\n");
+		return dev_err_probe(dev, err, "RTC chip is not present\n");
 
-	pcf85063->rtc = devm_rtc_allocate_device(&client->dev);
+	pcf85063->rtc = devm_rtc_allocate_device(dev);
 	if (IS_ERR(pcf85063->rtc))
 		return PTR_ERR(pcf85063->rtc);
 
@@ -605,19 +599,17 @@ static int pcf85063_probe(struct i2c_client *client)
 	 * of the registers after the automatic power-on reset...
 	 */
 	if (tmp & PCF85063_REG_SC_OS) {
-		dev_warn(&client->dev,
-			 "POR issue detected, sending a SW reset\n");
+		dev_warn(dev, "POR issue detected, sending a SW reset\n");
 		err = regmap_write(pcf85063->regmap, PCF85063_REG_CTRL1,
 				   PCF85063_REG_CTRL1_SWR);
 		if (err < 0)
-			dev_warn(&client->dev,
-				 "SW reset failed, trying to continue\n");
+			dev_warn(dev, "SW reset failed, trying to continue\n");
 	}
 
-	err = pcf85063_load_capacitance(pcf85063, client->dev.of_node,
+	err = pcf85063_load_capacitance(pcf85063, dev->of_node,
 					config->force_cap_7000 ? 7000 : 0);
 	if (err < 0)
-		dev_warn(&client->dev, "failed to set xtal load capacitance: %d",
+		dev_warn(dev, "failed to set xtal load capacitance: %d",
 			 err);
 
 	pcf85063->rtc->ops = &pcf85063_rtc_ops;
@@ -627,13 +619,13 @@ static int pcf85063_probe(struct i2c_client *client)
 	clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, pcf85063->rtc->features);
 	clear_bit(RTC_FEATURE_ALARM, pcf85063->rtc->features);
 
-	if (config->has_alarms && client->irq > 0) {
+	if (config->has_alarms && irq > 0) {
 		unsigned long irqflags = IRQF_TRIGGER_LOW;
 
-		if (dev_fwnode(&client->dev))
+		if (dev_fwnode(dev))
 			irqflags = 0;
 
-		err = devm_request_threaded_irq(&client->dev, client->irq,
+		err = devm_request_threaded_irq(dev, irq,
 						NULL, pcf85063_rtc_handle_irq,
 						irqflags | IRQF_ONESHOT,
 						"pcf85063", pcf85063);
@@ -642,8 +634,8 @@ static int pcf85063_probe(struct i2c_client *client)
 				 "unable to request IRQ, alarms disabled\n");
 		} else {
 			set_bit(RTC_FEATURE_ALARM, pcf85063->rtc->features);
-			device_init_wakeup(&client->dev, true);
-			err = dev_pm_set_wake_irq(&client->dev, client->irq);
+			device_init_wakeup(dev, true);
+			err = dev_pm_set_wake_irq(dev, irq);
 			if (err)
 				dev_err(&pcf85063->rtc->dev,
 					"failed to enable irq wake\n");
@@ -661,6 +653,8 @@ static int pcf85063_probe(struct i2c_client *client)
 	return devm_rtc_register_device(pcf85063->rtc);
 }
 
+#if IS_ENABLED(CONFIG_I2C)
+
 static const struct i2c_device_id pcf85063_ids[] = {
 	{ "pca85073a", .driver_data = (kernel_ulong_t)&config_pcf85063a },
 	{ "pcf85063", .driver_data = (kernel_ulong_t)&config_pcf85063 },
@@ -683,16 +677,65 @@ static const struct of_device_id pcf85063_of_match[] = {
 MODULE_DEVICE_TABLE(of, pcf85063_of_match);
 #endif
 
+static int pcf85063_i2c_probe(struct i2c_client *client)
+{
+	const struct pcf85063_config *config;
+	struct regmap *regmap;
+
+	config = i2c_get_match_data(client);
+	if (!config)
+		return -ENODEV;
+
+	regmap = devm_regmap_init_i2c(client, &config->regmap);
+	if (IS_ERR(regmap))
+		return PTR_ERR(regmap);
+
+	return pcf85063_probe(&client->dev, regmap, client->irq, config);
+}
+
 static struct i2c_driver pcf85063_driver = {
 	.driver		= {
 		.name	= "rtc-pcf85063",
 		.of_match_table = of_match_ptr(pcf85063_of_match),
 	},
-	.probe		= pcf85063_probe,
+	.probe		= pcf85063_i2c_probe,
 	.id_table	= pcf85063_ids,
 };
 
-module_i2c_driver(pcf85063_driver);
+static int pcf85063_register_driver(void)
+{
+	return i2c_add_driver(&pcf85063_driver);
+}
+
+static void pcf85063_unregister_driver(void)
+{
+	i2c_del_driver(&pcf85063_driver);
+}
+
+#else
+
+static int pcf85063_register_driver(void)
+{
+	return 0;
+}
+
+static void pcf85063_unregister_driver(void)
+{
+}
+
+#endif /* IS_ENABLED(CONFIG_I2C) */
+
+static int __init pcf85063_init(void)
+{
+	return pcf85063_register_driver();
+}
+module_init(pcf85063_init);
+
+static void __exit pcf85063_exit(void)
+{
+	pcf85063_unregister_driver();
+}
+module_exit(pcf85063_exit);
 
 MODULE_AUTHOR("Søren Andersen <san@rosetechnology.dk>");
 MODULE_DESCRIPTION("PCF85063 RTC driver");
-- 
2.25.1


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

* [PATCH 2/3] rtc: pcf85063: add support for RV8063
  2025-04-07 19:35 [PATCH 0/3] add support for RV8063 SPI rtc Antoni Pokusinski
  2025-04-07 19:35 ` [PATCH 1/3] rtc: pcf85063: create pcf85063_i2c_probe Antoni Pokusinski
@ 2025-04-07 19:35 ` Antoni Pokusinski
  2025-04-08  6:14   ` Krzysztof Kozlowski
  2025-04-07 19:35 ` [PATCH 3/3] dt-bindings: rtc: add binding " Antoni Pokusinski
  2 siblings, 1 reply; 9+ messages in thread
From: Antoni Pokusinski @ 2025-04-07 19:35 UTC (permalink / raw)
  To: alexandre.belloni, krzk+dt, conor+dt, robh, alexander.stein
  Cc: linux-rtc, linux-kernel, devicetree, Antoni Pokusinski

Microcrystal RV8063 is a real-time clock with SPI interface. Its
functionality is very similar to the RV8263 rtc.

Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
---
 drivers/rtc/Kconfig        | 21 ++++++-----
 drivers/rtc/rtc-pcf85063.c | 74 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 85 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 838bdc138ffe..1b9be96faa13 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -483,15 +483,6 @@ config RTC_DRV_PCF8523
 	  This driver can also be built as a module. If so, the module
 	  will be called rtc-pcf8523.
 
-config RTC_DRV_PCF85063
-	tristate "NXP PCF85063"
-	select REGMAP_I2C
-	help
-	  If you say yes here you get support for the PCF85063 RTC chip
-
-	  This driver can also be built as a module. If so, the module
-	  will be called rtc-pcf85063.
-
 config RTC_DRV_PCF85363
 	tristate "NXP PCF85363"
 	select REGMAP_I2C
@@ -971,6 +962,18 @@ config RTC_DRV_PCF2127
 	  This driver can also be built as a module. If so, the module
 	  will be called rtc-pcf2127.
 
+config RTC_DRV_PCF85063
+	tristate "NXP PCF85063"
+	depends on RTC_I2C_AND_SPI
+	select REGMAP_I2C if I2C
+	select REGMAP_SPI if SPI_MASTER
+	help
+	  If you say yes here you get support for the PCF85063 and RV8063
+	  RTC chips.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-pcf85063.
+
 config RTC_DRV_RV3029C2
 	tristate "Micro Crystal RV3029/3049"
 	depends on RTC_I2C_AND_SPI
diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
index 03dfc58f4cd7..512933479dd5 100644
--- a/drivers/rtc/rtc-pcf85063.c
+++ b/drivers/rtc/rtc-pcf85063.c
@@ -17,6 +17,7 @@
 #include <linux/of.h>
 #include <linux/pm_wakeirq.h>
 #include <linux/regmap.h>
+#include <linux/spi/spi.h>
 
 /*
  * Information for this driver was pulled from the following datasheets.
@@ -29,6 +30,9 @@
  *
  *  https://www.microcrystal.com/fileadmin/Media/Products/RTC/App.Manual/RV-8263-C7_App-Manual.pdf
  *  RV8263 -- Rev. 1.0 — January 2019
+ *
+ *  https://www.microcrystal.com/fileadmin/Media/Products/RTC/App.Manual/RV-8063-C7_App-Manual.pdf
+ *  RV8063 -- Rev. 1.1 - October 2018
  */
 
 #define PCF85063_REG_CTRL1		0x00 /* status */
@@ -559,6 +563,18 @@ static const struct pcf85063_config config_rv8263 = {
 	.force_cap_7000 = 1,
 };
 
+static const struct pcf85063_config config_rv8063 = {
+	.regmap = {
+		.reg_bits = 8,
+		.val_bits = 8,
+		.max_register = 0x11,
+		.read_flag_mask = BIT(7) | BIT(5),
+		.write_flag_mask = BIT(5),
+	},
+	.has_alarms = 1,
+	.force_cap_7000 = 1,
+};
+
 static int pcf85063_probe(struct device *dev, struct regmap *regmap, int irq,
 			  const struct pcf85063_config *config)
 {
@@ -725,14 +741,69 @@ static void pcf85063_unregister_driver(void)
 
 #endif /* IS_ENABLED(CONFIG_I2C) */
 
+#if IS_ENABLED(CONFIG_SPI_MASTER)
+
+static int rv8063_probe(struct spi_device *spi)
+{
+	const struct pcf85063_config *config = &config_rv8063;
+	struct regmap *regmap;
+
+	regmap = devm_regmap_init_spi(spi, &config->regmap);
+	if (IS_ERR(regmap))
+		return PTR_ERR(regmap);
+
+	return pcf85063_probe(&spi->dev, regmap, spi->irq, config);
+}
+
+static struct spi_driver rv8063_driver = {
+	.driver         = {
+		.name   = "rv8063",
+	},
+	.probe          = rv8063_probe,
+};
+
+static int __init rv8063_register_driver(void)
+{
+	return spi_register_driver(&rv8063_driver);
+}
+
+static void __exit rv8063_unregister_driver(void)
+{
+	spi_unregister_driver(&rv8063_driver);
+}
+
+#else
+
+static int __init rv8063_register_driver(void)
+{
+	return 0;
+}
+
+static void __exit rv8063_unregister_driver(void)
+{
+}
+
+#endif /* IS_ENABLED(CONFIG_SPI_MASTER) */
+
 static int __init pcf85063_init(void)
 {
-	return pcf85063_register_driver();
+	int ret;
+
+	ret = pcf85063_register_driver();
+	if (ret)
+		return ret;
+
+	ret = rv8063_register_driver();
+	if (ret)
+		pcf85063_unregister_driver();
+
+	return ret;
 }
 module_init(pcf85063_init);
 
 static void __exit pcf85063_exit(void)
 {
+	rv8063_unregister_driver();
 	pcf85063_unregister_driver();
 }
 module_exit(pcf85063_exit);
@@ -740,3 +811,4 @@ module_exit(pcf85063_exit);
 MODULE_AUTHOR("Søren Andersen <san@rosetechnology.dk>");
 MODULE_DESCRIPTION("PCF85063 RTC driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rv8063");
-- 
2.25.1


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

* [PATCH 3/3] dt-bindings: rtc: add binding for RV8063
  2025-04-07 19:35 [PATCH 0/3] add support for RV8063 SPI rtc Antoni Pokusinski
  2025-04-07 19:35 ` [PATCH 1/3] rtc: pcf85063: create pcf85063_i2c_probe Antoni Pokusinski
  2025-04-07 19:35 ` [PATCH 2/3] rtc: pcf85063: add support for RV8063 Antoni Pokusinski
@ 2025-04-07 19:35 ` Antoni Pokusinski
  2025-04-10 21:13   ` Rob Herring
  2 siblings, 1 reply; 9+ messages in thread
From: Antoni Pokusinski @ 2025-04-07 19:35 UTC (permalink / raw)
  To: alexandre.belloni, krzk+dt, conor+dt, robh, alexander.stein
  Cc: linux-rtc, linux-kernel, devicetree, Antoni Pokusinski

Microcrystal RV8063 is a real-time clock module with SPI interface.

Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
---
 .../devicetree/bindings/rtc/nxp,pcf85063.yaml | 33 ++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml b/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml
index 2f892f8640d1..cb31c7619d66 100644
--- a/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml
+++ b/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml
@@ -12,6 +12,7 @@ maintainers:
 properties:
   compatible:
     enum:
+      - microcrystal,rv8063
       - microcrystal,rv8263
       - nxp,pcf85063
       - nxp,pcf85063a
@@ -44,7 +45,12 @@ properties:
 
   wakeup-source: true
 
+  spi-cs-high: true
+
+  spi-3wire: true
+
 allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
   - $ref: rtc.yaml#
   - if:
       properties:
@@ -52,6 +58,7 @@ allOf:
           contains:
             enum:
               - microcrystal,rv8263
+              - microcrystal,rv8063
     then:
       properties:
         quartz-load-femtofarads: false
@@ -65,12 +72,23 @@ allOf:
       properties:
         quartz-load-femtofarads:
           const: 7000
+  - if:
+      properties:
+        compatible:
+          not:
+            contains:
+              enum:
+                - microcrystal,rv8063
+    then:
+      properties:
+        spi-cs-high: false
+        spi-3wire: false
 
 required:
   - compatible
   - reg
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
@@ -90,3 +108,16 @@ examples:
           };
         };
       };
+
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        rtc@0 {
+          compatible = "microcrystal,rv8063";
+          reg = <0>;
+          spi-cs-high;
+          spi-3wire;
+        };
+    };
-- 
2.25.1


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

* Re: [PATCH 2/3] rtc: pcf85063: add support for RV8063
  2025-04-07 19:35 ` [PATCH 2/3] rtc: pcf85063: add support for RV8063 Antoni Pokusinski
@ 2025-04-08  6:14   ` Krzysztof Kozlowski
  2025-04-08  7:36     ` Alexandre Belloni
  2025-04-08 19:00     ` Antoni Pokusinski
  0 siblings, 2 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-08  6:14 UTC (permalink / raw)
  To: Antoni Pokusinski, alexandre.belloni, krzk+dt, conor+dt, robh,
	alexander.stein
  Cc: linux-rtc, linux-kernel, devicetree

On 07/04/2025 21:35, Antoni Pokusinski wrote:
> Microcrystal RV8063 is a real-time clock with SPI interface. Its
> functionality is very similar to the RV8263 rtc.
> 
> Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
> ---
>  drivers/rtc/Kconfig        | 21 ++++++-----
>  drivers/rtc/rtc-pcf85063.c | 74 +++++++++++++++++++++++++++++++++++++-
>  2 files changed, 85 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 838bdc138ffe..1b9be96faa13 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -483,15 +483,6 @@ config RTC_DRV_PCF8523
>  	  This driver can also be built as a module. If so, the module
>  	  will be called rtc-pcf8523.
>  
> -config RTC_DRV_PCF85063
> -	tristate "NXP PCF85063"
> -	select REGMAP_I2C
> -	help
> -	  If you say yes here you get support for the PCF85063 RTC chip
> -
> -	  This driver can also be built as a module. If so, the module
> -	  will be called rtc-pcf85063.
> -
>  config RTC_DRV_PCF85363
>  	tristate "NXP PCF85363"
>  	select REGMAP_I2C
> @@ -971,6 +962,18 @@ config RTC_DRV_PCF2127
>  	  This driver can also be built as a module. If so, the module
>  	  will be called rtc-pcf2127.
>  
> +config RTC_DRV_PCF85063

Why? This breaks the order.

> +	tristate "NXP PCF85063"
> +	depends on RTC_I2C_AND_SPI
> +	select REGMAP_I2C if I2C
> +	select REGMAP_SPI if SPI_MASTER
> +	help
> +	  If you say yes here you get support for the PCF85063 and RV8063
> +	  RTC chips.
> +
> +	  This driver can also be built as a module. If so, the module
> +	  will be called rtc-pcf85063.
> +


...

>  module_exit(pcf85063_exit);
> @@ -740,3 +811,4 @@ module_exit(pcf85063_exit);
>  MODULE_AUTHOR("Søren Andersen <san@rosetechnology.dk>");
>  MODULE_DESCRIPTION("PCF85063 RTC driver");
>  MODULE_LICENSE("GPL");
> +MODULE_ALIAS("spi:rv8063");

Drop and use proper ID tables.


Best regards,
Krzysztof

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

* Re: [PATCH 2/3] rtc: pcf85063: add support for RV8063
  2025-04-08  6:14   ` Krzysztof Kozlowski
@ 2025-04-08  7:36     ` Alexandre Belloni
  2025-04-08 19:00     ` Antoni Pokusinski
  1 sibling, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2025-04-08  7:36 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Antoni Pokusinski, krzk+dt, conor+dt, robh, alexander.stein,
	linux-rtc, linux-kernel, devicetree

On 08/04/2025 08:14:36+0200, Krzysztof Kozlowski wrote:
> On 07/04/2025 21:35, Antoni Pokusinski wrote:
> > Microcrystal RV8063 is a real-time clock with SPI interface. Its
> > functionality is very similar to the RV8263 rtc.
> > 
> > Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
> > ---
> >  drivers/rtc/Kconfig        | 21 ++++++-----
> >  drivers/rtc/rtc-pcf85063.c | 74 +++++++++++++++++++++++++++++++++++++-
> >  2 files changed, 85 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> > index 838bdc138ffe..1b9be96faa13 100644
> > --- a/drivers/rtc/Kconfig
> > +++ b/drivers/rtc/Kconfig
> > @@ -483,15 +483,6 @@ config RTC_DRV_PCF8523
> >  	  This driver can also be built as a module. If so, the module
> >  	  will be called rtc-pcf8523.
> >  
> > -config RTC_DRV_PCF85063
> > -	tristate "NXP PCF85063"
> > -	select REGMAP_I2C
> > -	help
> > -	  If you say yes here you get support for the PCF85063 RTC chip
> > -
> > -	  This driver can also be built as a module. If so, the module
> > -	  will be called rtc-pcf85063.
> > -
> >  config RTC_DRV_PCF85363
> >  	tristate "NXP PCF85363"
> >  	select REGMAP_I2C
> > @@ -971,6 +962,18 @@ config RTC_DRV_PCF2127
> >  	  This driver can also be built as a module. If so, the module
> >  	  will be called rtc-pcf2127.
> >  
> > +config RTC_DRV_PCF85063
> 
> Why? This breaks the order.
> 

I don't think it does but you can't see it from the diff.

> > +	tristate "NXP PCF85063"
> > +	depends on RTC_I2C_AND_SPI
> > +	select REGMAP_I2C if I2C
> > +	select REGMAP_SPI if SPI_MASTER
> > +	help
> > +	  If you say yes here you get support for the PCF85063 and RV8063
> > +	  RTC chips.
> > +
> > +	  This driver can also be built as a module. If so, the module
> > +	  will be called rtc-pcf85063.
> > +
> 
> 
> ...
> 
> >  module_exit(pcf85063_exit);
> > @@ -740,3 +811,4 @@ module_exit(pcf85063_exit);
> >  MODULE_AUTHOR("Søren Andersen <san@rosetechnology.dk>");
> >  MODULE_DESCRIPTION("PCF85063 RTC driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_ALIAS("spi:rv8063");
> 
> Drop and use proper ID tables.
> 
> 
> Best regards,
> Krzysztof

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

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

* Re: [PATCH 2/3] rtc: pcf85063: add support for RV8063
  2025-04-08  6:14   ` Krzysztof Kozlowski
  2025-04-08  7:36     ` Alexandre Belloni
@ 2025-04-08 19:00     ` Antoni Pokusinski
  1 sibling, 0 replies; 9+ messages in thread
From: Antoni Pokusinski @ 2025-04-08 19:00 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-rtc, linux-kernel, devicetree
  Cc: alexandre.belloni

On Tue, Apr 08, 2025 at 08:14:36AM +0200, Krzysztof Kozlowski wrote:
> On 07/04/2025 21:35, Antoni Pokusinski wrote:
> > Microcrystal RV8063 is a real-time clock with SPI interface. Its
> > functionality is very similar to the RV8263 rtc.
> > 
> > Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
> > ---
> >  drivers/rtc/Kconfig        | 21 ++++++-----
> >  drivers/rtc/rtc-pcf85063.c | 74 +++++++++++++++++++++++++++++++++++++-
> >  2 files changed, 85 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> > index 838bdc138ffe..1b9be96faa13 100644
> > --- a/drivers/rtc/Kconfig
> > +++ b/drivers/rtc/Kconfig
> > @@ -483,15 +483,6 @@ config RTC_DRV_PCF8523
> >  	  This driver can also be built as a module. If so, the module
> >  	  will be called rtc-pcf8523.
> >  
> > -config RTC_DRV_PCF85063
> > -	tristate "NXP PCF85063"
> > -	select REGMAP_I2C
> > -	help
> > -	  If you say yes here you get support for the PCF85063 RTC chip
> > -
> > -	  This driver can also be built as a module. If so, the module
> > -	  will be called rtc-pcf85063.
> > -
> >  config RTC_DRV_PCF85363
> >  	tristate "NXP PCF85363"
> >  	select REGMAP_I2C
> > @@ -971,6 +962,18 @@ config RTC_DRV_PCF2127
> >  	  This driver can also be built as a module. If so, the module
> >  	  will be called rtc-pcf2127.
> >  
> > +config RTC_DRV_PCF85063
> 
> Why? This breaks the order.
>
I moved this config entry to the "SPI and I2C RTC drivers" section,
because the driver supports now both I2C and SPI devices.

> > +	tristate "NXP PCF85063"
> > +	depends on RTC_I2C_AND_SPI
> > +	select REGMAP_I2C if I2C
> > +	select REGMAP_SPI if SPI_MASTER
> > +	help
> > +	  If you say yes here you get support for the PCF85063 and RV8063
> > +	  RTC chips.
> > +
> > +	  This driver can also be built as a module. If so, the module
> > +	  will be called rtc-pcf85063.
> > +
> 
> 
> ...
> 
> >  module_exit(pcf85063_exit);
> > @@ -740,3 +811,4 @@ module_exit(pcf85063_exit);
> >  MODULE_AUTHOR("Søren Andersen <san@rosetechnology.dk>");
> >  MODULE_DESCRIPTION("PCF85063 RTC driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_ALIAS("spi:rv8063");
> 
> Drop and use proper ID tables.
> 
Will fix that in v2, thanks.
> 
> Best regards,
> Krzysztof

Kind regards,
Antoni


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

* Re: [PATCH 3/3] dt-bindings: rtc: add binding for RV8063
  2025-04-07 19:35 ` [PATCH 3/3] dt-bindings: rtc: add binding " Antoni Pokusinski
@ 2025-04-10 21:13   ` Rob Herring
  2025-04-11  7:11     ` Antoni Pokusinski
  0 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2025-04-10 21:13 UTC (permalink / raw)
  To: Antoni Pokusinski
  Cc: alexandre.belloni, krzk+dt, conor+dt, alexander.stein, linux-rtc,
	linux-kernel, devicetree

On Mon, Apr 07, 2025 at 09:35:21PM +0200, Antoni Pokusinski wrote:
> Microcrystal RV8063 is a real-time clock module with SPI interface.
> 
> Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
> ---
>  .../devicetree/bindings/rtc/nxp,pcf85063.yaml | 33 ++++++++++++++++++-
>  1 file changed, 32 insertions(+), 1 deletion(-)

Bindings come before users (driver).

> 
> diff --git a/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml b/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml
> index 2f892f8640d1..cb31c7619d66 100644
> --- a/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml
> +++ b/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml
> @@ -12,6 +12,7 @@ maintainers:
>  properties:
>    compatible:
>      enum:
> +      - microcrystal,rv8063
>        - microcrystal,rv8263
>        - nxp,pcf85063
>        - nxp,pcf85063a
> @@ -44,7 +45,12 @@ properties:
>  
>    wakeup-source: true
>  
> +  spi-cs-high: true
> +
> +  spi-3wire: true
> +
>  allOf:
> +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
>    - $ref: rtc.yaml#
>    - if:
>        properties:
> @@ -52,6 +58,7 @@ allOf:
>            contains:
>              enum:
>                - microcrystal,rv8263
> +              - microcrystal,rv8063
>      then:
>        properties:
>          quartz-load-femtofarads: false
> @@ -65,12 +72,23 @@ allOf:
>        properties:
>          quartz-load-femtofarads:
>            const: 7000
> +  - if:
> +      properties:
> +        compatible:
> +          not:
> +            contains:
> +              enum:
> +                - microcrystal,rv8063
> +    then:
> +      properties:
> +        spi-cs-high: false
> +        spi-3wire: false
>  
>  required:
>    - compatible
>    - reg
>  
> -additionalProperties: false
> +unevaluatedProperties: false
>  
>  examples:
>    - |
> @@ -90,3 +108,16 @@ examples:
>            };
>          };
>        };
> +
> +  - |
> +    spi {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        rtc@0 {
> +          compatible = "microcrystal,rv8063";
> +          reg = <0>;
> +          spi-cs-high;
> +          spi-3wire;
> +        };
> +    };
> -- 
> 2.25.1
> 

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

* Re: [PATCH 3/3] dt-bindings: rtc: add binding for RV8063
  2025-04-10 21:13   ` Rob Herring
@ 2025-04-11  7:11     ` Antoni Pokusinski
  0 siblings, 0 replies; 9+ messages in thread
From: Antoni Pokusinski @ 2025-04-11  7:11 UTC (permalink / raw)
  To: Rob Herring
  Cc: alexandre.belloni, krzk+dt, conor+dt, alexander.stein, linux-rtc,
	linux-kernel, devicetree

On Thu, Apr 10, 2025 at 04:13:51PM -0500, Rob Herring wrote:
> On Mon, Apr 07, 2025 at 09:35:21PM +0200, Antoni Pokusinski wrote:
> > Microcrystal RV8063 is a real-time clock module with SPI interface.
> > 
> > Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
> > ---
> >  .../devicetree/bindings/rtc/nxp,pcf85063.yaml | 33 ++++++++++++++++++-
> >  1 file changed, 32 insertions(+), 1 deletion(-)
> 
> Bindings come before users (driver).
> 
Fixed in v3 already.

Kind regards,
Antoni

> > 
> > diff --git a/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml b/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml
> > index 2f892f8640d1..cb31c7619d66 100644
> > --- a/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml
> > +++ b/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml
> > @@ -12,6 +12,7 @@ maintainers:
> >  properties:
> >    compatible:
> >      enum:
> > +      - microcrystal,rv8063
> >        - microcrystal,rv8263
> >        - nxp,pcf85063
> >        - nxp,pcf85063a
> > @@ -44,7 +45,12 @@ properties:
> >  
> >    wakeup-source: true
> >  
> > +  spi-cs-high: true
> > +
> > +  spi-3wire: true
> > +
> >  allOf:
> > +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> >    - $ref: rtc.yaml#
> >    - if:
> >        properties:
> > @@ -52,6 +58,7 @@ allOf:
> >            contains:
> >              enum:
> >                - microcrystal,rv8263
> > +              - microcrystal,rv8063
> >      then:
> >        properties:
> >          quartz-load-femtofarads: false
> > @@ -65,12 +72,23 @@ allOf:
> >        properties:
> >          quartz-load-femtofarads:
> >            const: 7000
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          not:
> > +            contains:
> > +              enum:
> > +                - microcrystal,rv8063
> > +    then:
> > +      properties:
> > +        spi-cs-high: false
> > +        spi-3wire: false
> >  
> >  required:
> >    - compatible
> >    - reg
> >  
> > -additionalProperties: false
> > +unevaluatedProperties: false
> >  
> >  examples:
> >    - |
> > @@ -90,3 +108,16 @@ examples:
> >            };
> >          };
> >        };
> > +
> > +  - |
> > +    spi {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        rtc@0 {
> > +          compatible = "microcrystal,rv8063";
> > +          reg = <0>;
> > +          spi-cs-high;
> > +          spi-3wire;
> > +        };
> > +    };
> > -- 
> > 2.25.1
> > 

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

end of thread, other threads:[~2025-04-11  7:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 19:35 [PATCH 0/3] add support for RV8063 SPI rtc Antoni Pokusinski
2025-04-07 19:35 ` [PATCH 1/3] rtc: pcf85063: create pcf85063_i2c_probe Antoni Pokusinski
2025-04-07 19:35 ` [PATCH 2/3] rtc: pcf85063: add support for RV8063 Antoni Pokusinski
2025-04-08  6:14   ` Krzysztof Kozlowski
2025-04-08  7:36     ` Alexandre Belloni
2025-04-08 19:00     ` Antoni Pokusinski
2025-04-07 19:35 ` [PATCH 3/3] dt-bindings: rtc: add binding " Antoni Pokusinski
2025-04-10 21:13   ` Rob Herring
2025-04-11  7:11     ` Antoni Pokusinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).