linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] rtc: jz4740: Add support for JZ4760 SoC
@ 2020-03-11 18:23 Paul Cercueil
  2020-03-11 18:23 ` [PATCH v2 2/3] rtc: jz4740: Rename vendor-specific DT properties Paul Cercueil
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Paul Cercueil @ 2020-03-11 18:23 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland
  Cc: od, linux-rtc, devicetree, linux-kernel, Paul Cercueil

The WENR feature (set a magic value to enable RTC registers read-write)
first appeared on the JZ4760; the JZ4780 came much later.

Since it would be dangerous to specify a newer SoC's compatible string as
the fallback of an older SoC's compatible string, we add support for the
"ingenic,jz4760-rtc" compatible string in the driver.

This will permit to support the JZ4770 by having:
compatible = "ingenic,jz4770-rtc", "ingenic,jz4760-rtc";

Instead of doing:
compatible = "ingenic,jz4770-rtc", "ingenic,jz4780-rtc";

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/rtc/rtc-jz4740.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
index 18023e472cbc..d764cd525c9a 100644
--- a/drivers/rtc/rtc-jz4740.c
+++ b/drivers/rtc/rtc-jz4740.c
@@ -46,6 +46,7 @@
 
 enum jz4740_rtc_type {
 	ID_JZ4740,
+	ID_JZ4760,
 	ID_JZ4780,
 };
 
@@ -106,7 +107,7 @@ static inline int jz4740_rtc_reg_write(struct jz4740_rtc *rtc, size_t reg,
 {
 	int ret = 0;
 
-	if (rtc->type >= ID_JZ4780)
+	if (rtc->type >= ID_JZ4760)
 		ret = jz4780_rtc_enable_write(rtc);
 	if (ret == 0)
 		ret = jz4740_rtc_wait_write_ready(rtc);
@@ -298,6 +299,7 @@ static void jz4740_rtc_power_off(void)
 
 static const struct of_device_id jz4740_rtc_of_match[] = {
 	{ .compatible = "ingenic,jz4740-rtc", .data = (void *)ID_JZ4740 },
+	{ .compatible = "ingenic,jz4760-rtc", .data = (void *)ID_JZ4760 },
 	{ .compatible = "ingenic,jz4780-rtc", .data = (void *)ID_JZ4780 },
 	{},
 };
-- 
2.25.1


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

* [PATCH v2 2/3] rtc: jz4740: Rename vendor-specific DT properties
  2020-03-11 18:23 [PATCH v2 1/3] rtc: jz4740: Add support for JZ4760 SoC Paul Cercueil
@ 2020-03-11 18:23 ` Paul Cercueil
  2020-03-24 10:10   ` Alexandre Belloni
  2020-03-11 18:23 ` [PATCH v2 3/3] dt-bindings: rtc: Convert and update jz4740-rtc doc to YAML Paul Cercueil
  2020-03-24 10:09 ` [PATCH v2 1/3] rtc: jz4740: Add support for JZ4760 SoC Alexandre Belloni
  2 siblings, 1 reply; 7+ messages in thread
From: Paul Cercueil @ 2020-03-11 18:23 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland
  Cc: od, linux-rtc, devicetree, linux-kernel, Paul Cercueil

These properties are never set anywhere within any of the upstream
devicetree files, so I assume I'm not breaking the ABI with this change.

Rename vendor-specific DT properties to have the 'ingenic,' prefix,
which they should have had from the start.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/rtc/rtc-jz4740.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
index d764cd525c9a..e4c719085c31 100644
--- a/drivers/rtc/rtc-jz4740.c
+++ b/drivers/rtc/rtc-jz4740.c
@@ -374,13 +374,14 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
 		if (!pm_power_off) {
 			/* Default: 60ms */
 			rtc->reset_pin_assert_time = 60;
-			of_property_read_u32(np, "reset-pin-assert-time-ms",
+			of_property_read_u32(np,
+					     "ingenic,reset-pin-assert-time-ms",
 					     &rtc->reset_pin_assert_time);
 
 			/* Default: 100ms */
 			rtc->min_wakeup_pin_assert_time = 100;
 			of_property_read_u32(np,
-					     "min-wakeup-pin-assert-time-ms",
+					     "ingenic,min-wakeup-pin-assert-time-ms",
 					     &rtc->min_wakeup_pin_assert_time);
 
 			dev_for_power_off = &pdev->dev;
-- 
2.25.1


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

* [PATCH v2 3/3] dt-bindings: rtc: Convert and update jz4740-rtc doc to YAML
  2020-03-11 18:23 [PATCH v2 1/3] rtc: jz4740: Add support for JZ4760 SoC Paul Cercueil
  2020-03-11 18:23 ` [PATCH v2 2/3] rtc: jz4740: Rename vendor-specific DT properties Paul Cercueil
@ 2020-03-11 18:23 ` Paul Cercueil
  2020-03-23 22:14   ` Rob Herring
  2020-03-24 10:10   ` Alexandre Belloni
  2020-03-24 10:09 ` [PATCH v2 1/3] rtc: jz4740: Add support for JZ4760 SoC Alexandre Belloni
  2 siblings, 2 replies; 7+ messages in thread
From: Paul Cercueil @ 2020-03-11 18:23 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland
  Cc: od, linux-rtc, devicetree, linux-kernel, Paul Cercueil

Convert the jz4740-rtc doc to YAML, and update it to reflect the new
changes in the driver:
- More compatible strings are specified, with fallbacks if needed,
- The vendor-specific properties are now properly prefixed with the
  'ingenic,' prefix.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 .../bindings/rtc/ingenic,jz4740-rtc.txt       | 37 ---------
 .../devicetree/bindings/rtc/ingenic,rtc.yaml  | 83 +++++++++++++++++++
 2 files changed, 83 insertions(+), 37 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/ingenic,rtc.yaml

diff --git a/Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt b/Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
deleted file mode 100644
index 41c7ae18fd7b..000000000000
--- a/Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-JZ4740 and similar SoCs real-time clock driver
-
-Required properties:
-
-- compatible: One of:
-  - "ingenic,jz4740-rtc" - for use with the JZ4740 SoC
-  - "ingenic,jz4780-rtc" - for use with the JZ4780 SoC
-- reg: Address range of rtc register set
-- interrupts: IRQ number for the alarm interrupt
-- clocks: phandle to the "rtc" clock
-- clock-names: must be "rtc"
-
-Optional properties:
-- system-power-controller: To use this component as the
-  system power controller
-- reset-pin-assert-time-ms: Reset pin low-level assertion
-  time after wakeup (default 60ms; range 0-125ms if RTC clock
-  at 32 kHz)
-- min-wakeup-pin-assert-time-ms: Minimum wakeup pin assertion
-  time (default 100ms; range 0-2s if RTC clock at 32 kHz)
-
-Example:
-
-rtc@10003000 {
-	compatible = "ingenic,jz4740-rtc";
-	reg = <0x10003000 0x40>;
-
-	interrupt-parent = <&intc>;
-	interrupts = <32>;
-
-	clocks = <&rtc_clock>;
-	clock-names = "rtc";
-
-	system-power-controller;
-	reset-pin-assert-time-ms = <60>;
-	min-wakeup-pin-assert-time-ms = <100>;
-};
diff --git a/Documentation/devicetree/bindings/rtc/ingenic,rtc.yaml b/Documentation/devicetree/bindings/rtc/ingenic,rtc.yaml
new file mode 100644
index 000000000000..4206bf8a2469
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/ingenic,rtc.yaml
@@ -0,0 +1,83 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/ingenic,rtc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Ingenic SoCs Real-Time Clock DT bindings
+
+maintainers:
+  - Paul Cercueil <paul@crapouillou.net>
+
+allOf:
+  - $ref: rtc.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+        - ingenic,jz4740-rtc
+        - ingenic,jz4760-rtc
+      - items:
+        - const: ingenic,jz4725b-rtc
+        - const: ingenic,jz4740-rtc
+      - items:
+        - enum:
+          - ingenic,jz4770-rtc
+          - ingenic,jz4780-rtc
+        - const: ingenic,jz4760-rtc
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: rtc
+
+  system-power-controller:
+    description: |
+      Indicates that the RTC is responsible for powering OFF
+      the system.
+    type: boolean
+
+  ingenic,reset-pin-assert-time-ms:
+    minimum: 0
+    maximum: 125
+    default: 60
+    description: |
+      Reset pin low-level assertion time after wakeup
+      (assuming RTC clock at 32 kHz)
+
+  ingenic,min-wakeup-pin-assert-time-ms:
+    minimum: 0
+    maximum: 2000
+    default: 100
+    description: |
+      Minimum wakeup pin assertion time
+      (assuming RTC clock at 32 kHz)
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+
+examples:
+  - |
+    #include <dt-bindings/clock/jz4740-cgu.h>
+    rtc_dev: rtc@10003000 {
+      compatible = "ingenic,jz4740-rtc";
+      reg = <0x10003000 0x40>;
+
+      interrupt-parent = <&intc>;
+      interrupts = <15>;
+
+      clocks = <&cgu JZ4740_CLK_RTC>;
+      clock-names = "rtc";
+    };
-- 
2.25.1


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

* Re: [PATCH v2 3/3] dt-bindings: rtc: Convert and update jz4740-rtc doc to YAML
  2020-03-11 18:23 ` [PATCH v2 3/3] dt-bindings: rtc: Convert and update jz4740-rtc doc to YAML Paul Cercueil
@ 2020-03-23 22:14   ` Rob Herring
  2020-03-24 10:10   ` Alexandre Belloni
  1 sibling, 0 replies; 7+ messages in thread
From: Rob Herring @ 2020-03-23 22:14 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Alessandro Zummo, Alexandre Belloni, Mark Rutland, od, linux-rtc,
	devicetree, linux-kernel, Paul Cercueil

On Wed, 11 Mar 2020 19:23:18 +0100, Paul Cercueil wrote:
> Convert the jz4740-rtc doc to YAML, and update it to reflect the new
> changes in the driver:
> - More compatible strings are specified, with fallbacks if needed,
> - The vendor-specific properties are now properly prefixed with the
>   'ingenic,' prefix.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  .../bindings/rtc/ingenic,jz4740-rtc.txt       | 37 ---------
>  .../devicetree/bindings/rtc/ingenic,rtc.yaml  | 83 +++++++++++++++++++
>  2 files changed, 83 insertions(+), 37 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
>  create mode 100644 Documentation/devicetree/bindings/rtc/ingenic,rtc.yaml
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v2 1/3] rtc: jz4740: Add support for JZ4760 SoC
  2020-03-11 18:23 [PATCH v2 1/3] rtc: jz4740: Add support for JZ4760 SoC Paul Cercueil
  2020-03-11 18:23 ` [PATCH v2 2/3] rtc: jz4740: Rename vendor-specific DT properties Paul Cercueil
  2020-03-11 18:23 ` [PATCH v2 3/3] dt-bindings: rtc: Convert and update jz4740-rtc doc to YAML Paul Cercueil
@ 2020-03-24 10:09 ` Alexandre Belloni
  2 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2020-03-24 10:09 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Alessandro Zummo, Rob Herring, Mark Rutland, od, linux-rtc,
	devicetree, linux-kernel

On 11/03/2020 19:23:16+0100, Paul Cercueil wrote:
> The WENR feature (set a magic value to enable RTC registers read-write)
> first appeared on the JZ4760; the JZ4780 came much later.
> 
> Since it would be dangerous to specify a newer SoC's compatible string as
> the fallback of an older SoC's compatible string, we add support for the
> "ingenic,jz4760-rtc" compatible string in the driver.
> 
> This will permit to support the JZ4770 by having:
> compatible = "ingenic,jz4770-rtc", "ingenic,jz4760-rtc";
> 
> Instead of doing:
> compatible = "ingenic,jz4770-rtc", "ingenic,jz4780-rtc";
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/rtc/rtc-jz4740.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
Applied, thanks.

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

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

* Re: [PATCH v2 2/3] rtc: jz4740: Rename vendor-specific DT properties
  2020-03-11 18:23 ` [PATCH v2 2/3] rtc: jz4740: Rename vendor-specific DT properties Paul Cercueil
@ 2020-03-24 10:10   ` Alexandre Belloni
  0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2020-03-24 10:10 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Alessandro Zummo, Rob Herring, Mark Rutland, od, linux-rtc,
	devicetree, linux-kernel

On 11/03/2020 19:23:17+0100, Paul Cercueil wrote:
> These properties are never set anywhere within any of the upstream
> devicetree files, so I assume I'm not breaking the ABI with this change.
> 
> Rename vendor-specific DT properties to have the 'ingenic,' prefix,
> which they should have had from the start.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/rtc/rtc-jz4740.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
Applied, thanks.

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

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

* Re: [PATCH v2 3/3] dt-bindings: rtc: Convert and update jz4740-rtc doc to YAML
  2020-03-11 18:23 ` [PATCH v2 3/3] dt-bindings: rtc: Convert and update jz4740-rtc doc to YAML Paul Cercueil
  2020-03-23 22:14   ` Rob Herring
@ 2020-03-24 10:10   ` Alexandre Belloni
  1 sibling, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2020-03-24 10:10 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Alessandro Zummo, Rob Herring, Mark Rutland, od, linux-rtc,
	devicetree, linux-kernel

On 11/03/2020 19:23:18+0100, Paul Cercueil wrote:
> Convert the jz4740-rtc doc to YAML, and update it to reflect the new
> changes in the driver:
> - More compatible strings are specified, with fallbacks if needed,
> - The vendor-specific properties are now properly prefixed with the
>   'ingenic,' prefix.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  .../bindings/rtc/ingenic,jz4740-rtc.txt       | 37 ---------
>  .../devicetree/bindings/rtc/ingenic,rtc.yaml  | 83 +++++++++++++++++++
>  2 files changed, 83 insertions(+), 37 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
>  create mode 100644 Documentation/devicetree/bindings/rtc/ingenic,rtc.yaml
> 
Applied, thanks.

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

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

end of thread, other threads:[~2020-03-24 10:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 18:23 [PATCH v2 1/3] rtc: jz4740: Add support for JZ4760 SoC Paul Cercueil
2020-03-11 18:23 ` [PATCH v2 2/3] rtc: jz4740: Rename vendor-specific DT properties Paul Cercueil
2020-03-24 10:10   ` Alexandre Belloni
2020-03-11 18:23 ` [PATCH v2 3/3] dt-bindings: rtc: Convert and update jz4740-rtc doc to YAML Paul Cercueil
2020-03-23 22:14   ` Rob Herring
2020-03-24 10:10   ` Alexandre Belloni
2020-03-24 10:09 ` [PATCH v2 1/3] rtc: jz4740: Add support for JZ4760 SoC Alexandre Belloni

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).