All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Various fixes on STM32 RTC
@ 2018-04-19 13:21 ` Amelie Delaunay
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue
  Cc: linux-rtc, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This series makes some corrections on STM32 RTC:
- update copyright and adopt SPDX identifier
- fix alarm interrupt flags
- rework DBP (Disable Backup domain Protection) management.

This series is a preamble to the serie which will introduce next STM32 RTC
version.

Amelie Delaunay (4):
  rtc: stm32: fix copyright and adopt SPDX identifier
  rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING
  dt-bindings: rtc: update stm32-rtc documentation for st,syscfg
    property
  rtc: stm32: get DBP register and mask from DT st,syscfg property

 .../devicetree/bindings/rtc/st,stm32-rtc.txt       | 10 ++--
 drivers/rtc/rtc-stm32.c                            | 68 +++++++++++++---------
 2 files changed, 47 insertions(+), 31 deletions(-)

-- 
2.7.4

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

* [PATCH 0/4] Various fixes on STM32 RTC
@ 2018-04-19 13:21 ` Amelie Delaunay
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue
  Cc: linux-rtc, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This series makes some corrections on STM32 RTC:
- update copyright and adopt SPDX identifier
- fix alarm interrupt flags
- rework DBP (Disable Backup domain Protection) management.

This series is a preamble to the serie which will introduce next STM32 RTC
version.

Amelie Delaunay (4):
  rtc: stm32: fix copyright and adopt SPDX identifier
  rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING
  dt-bindings: rtc: update stm32-rtc documentation for st,syscfg
    property
  rtc: stm32: get DBP register and mask from DT st,syscfg property

 .../devicetree/bindings/rtc/st,stm32-rtc.txt       | 10 ++--
 drivers/rtc/rtc-stm32.c                            | 68 +++++++++++++---------
 2 files changed, 47 insertions(+), 31 deletions(-)

-- 
2.7.4

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

* [PATCH 0/4] Various fixes on STM32 RTC
@ 2018-04-19 13:21 ` Amelie Delaunay
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: linux-arm-kernel

This series makes some corrections on STM32 RTC:
- update copyright and adopt SPDX identifier
- fix alarm interrupt flags
- rework DBP (Disable Backup domain Protection) management.

This series is a preamble to the serie which will introduce next STM32 RTC
version.

Amelie Delaunay (4):
  rtc: stm32: fix copyright and adopt SPDX identifier
  rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING
  dt-bindings: rtc: update stm32-rtc documentation for st,syscfg
    property
  rtc: stm32: get DBP register and mask from DT st,syscfg property

 .../devicetree/bindings/rtc/st,stm32-rtc.txt       | 10 ++--
 drivers/rtc/rtc-stm32.c                            | 68 +++++++++++++---------
 2 files changed, 47 insertions(+), 31 deletions(-)

-- 
2.7.4

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

* [PATCH 1/4] rtc: stm32: fix copyright and adopt SPDX identifier
  2018-04-19 13:21 ` Amelie Delaunay
  (?)
@ 2018-04-19 13:21   ` Amelie Delaunay
  -1 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue
  Cc: linux-rtc, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

Fix copyright by removing "SA" and "for STMicroelectronics", not required.
Adopt SPDX identifier.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/rtc/rtc-stm32.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index f25dabe..79d9e86 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (C) STMicroelectronics SA 2017
- * Author:  Amelie Delaunay <amelie.delaunay@st.com> for STMicroelectronics.
- * License terms:  GNU General Public License (GPL), version 2
+ * Copyright (C) STMicroelectronics 2017
+ * Author:  Amelie Delaunay <amelie.delaunay@st.com>
  */
 
 #include <linux/bcd.h>
-- 
2.7.4

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

* [PATCH 1/4] rtc: stm32: fix copyright and adopt SPDX identifier
@ 2018-04-19 13:21   ` Amelie Delaunay
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue
  Cc: linux-rtc, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

Fix copyright by removing "SA" and "for STMicroelectronics", not required.
Adopt SPDX identifier.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/rtc/rtc-stm32.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index f25dabe..79d9e86 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (C) STMicroelectronics SA 2017
- * Author:  Amelie Delaunay <amelie.delaunay@st.com> for STMicroelectronics.
- * License terms:  GNU General Public License (GPL), version 2
+ * Copyright (C) STMicroelectronics 2017
+ * Author:  Amelie Delaunay <amelie.delaunay@st.com>
  */
 
 #include <linux/bcd.h>
-- 
2.7.4

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

* [PATCH 1/4] rtc: stm32: fix copyright and adopt SPDX identifier
@ 2018-04-19 13:21   ` Amelie Delaunay
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: linux-arm-kernel

Fix copyright by removing "SA" and "for STMicroelectronics", not required.
Adopt SPDX identifier.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/rtc/rtc-stm32.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index f25dabe..79d9e86 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (C) STMicroelectronics SA 2017
- * Author:  Amelie Delaunay <amelie.delaunay@st.com> for STMicroelectronics.
- * License terms:  GNU General Public License (GPL), version 2
+ * Copyright (C) STMicroelectronics 2017
+ * Author:  Amelie Delaunay <amelie.delaunay@st.com>
  */
 
 #include <linux/bcd.h>
-- 
2.7.4

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

* [PATCH 2/4] rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING
  2018-04-19 13:21 ` Amelie Delaunay
  (?)
@ 2018-04-19 13:21   ` Amelie Delaunay
  -1 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue
  Cc: linux-rtc, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

RTC alarm interrupt is active high and already configured by device tree.
So remove IRQF_TRIGGER_RISING from driver.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/rtc/rtc-stm32.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index 79d9e86..6a06078 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -663,8 +663,7 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 
 	/* Handle RTC alarm interrupts */
 	ret = devm_request_threaded_irq(&pdev->dev, rtc->irq_alarm, NULL,
-					stm32_rtc_alarm_irq,
-					IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+					stm32_rtc_alarm_irq, IRQF_ONESHOT,
 					pdev->name, rtc);
 	if (ret) {
 		dev_err(&pdev->dev, "IRQ%d (alarm interrupt) already claimed\n",
-- 
2.7.4

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

* [PATCH 2/4] rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING
@ 2018-04-19 13:21   ` Amelie Delaunay
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue
  Cc: linux-rtc, devicetree, Amelie Delaunay, linux-kernel, linux-arm-kernel

RTC alarm interrupt is active high and already configured by device tree.
So remove IRQF_TRIGGER_RISING from driver.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/rtc/rtc-stm32.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index 79d9e86..6a06078 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -663,8 +663,7 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 
 	/* Handle RTC alarm interrupts */
 	ret = devm_request_threaded_irq(&pdev->dev, rtc->irq_alarm, NULL,
-					stm32_rtc_alarm_irq,
-					IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+					stm32_rtc_alarm_irq, IRQF_ONESHOT,
 					pdev->name, rtc);
 	if (ret) {
 		dev_err(&pdev->dev, "IRQ%d (alarm interrupt) already claimed\n",
-- 
2.7.4

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

* [PATCH 2/4] rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING
@ 2018-04-19 13:21   ` Amelie Delaunay
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: linux-arm-kernel

RTC alarm interrupt is active high and already configured by device tree.
So remove IRQF_TRIGGER_RISING from driver.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/rtc/rtc-stm32.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index 79d9e86..6a06078 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -663,8 +663,7 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 
 	/* Handle RTC alarm interrupts */
 	ret = devm_request_threaded_irq(&pdev->dev, rtc->irq_alarm, NULL,
-					stm32_rtc_alarm_irq,
-					IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+					stm32_rtc_alarm_irq, IRQF_ONESHOT,
 					pdev->name, rtc);
 	if (ret) {
 		dev_err(&pdev->dev, "IRQ%d (alarm interrupt) already claimed\n",
-- 
2.7.4

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

* [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
  2018-04-19 13:21 ` Amelie Delaunay
  (?)
@ 2018-04-19 13:21   ` Amelie Delaunay
  -1 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue
  Cc: linux-rtc, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

RTC driver should not be aware of the PWR registers offset and bits
position. Furthermore, we can imagine that Disable Backup Protection (DBP)
relative register and bit mask could change depending on the SoC. So this
patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
phandle/offset/mask triplet.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
index a66692a..00f8b5d 100644
--- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
+++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
@@ -14,8 +14,10 @@ Required properties:
     It is required only on stm32h7.
 - interrupt-parent: phandle for the interrupt controller.
 - interrupts: rtc alarm interrupt.
-- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup domain
-  (RTC registers) write protection.
+- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg used to
+  access control register at offset, and change the dbp (Disable Backup
+  Protection) bit represented by the mask, mandatory to disable/enable backup
+  domain (RTC registers) write protection.
 
 Optional properties (to override default rtc_ck parent clock):
 - assigned-clocks: reference to the rtc_ck clock entry.
@@ -31,7 +33,7 @@ Example:
 		assigned-clock-parents = <&rcc 1 CLK_LSE>;
 		interrupt-parent = <&exti>;
 		interrupts = <17 1>;
-		st,syscfg = <&pwrcfg>;
+		st,syscfg = <&pwrcfg 0x00 0x100>;
 	};
 
 	rtc: rtc@58004000 {
@@ -44,5 +46,5 @@ Example:
 		interrupt-parent = <&exti>;
 		interrupts = <17 1>;
 		interrupt-names = "alarm";
-		st,syscfg = <&pwrcfg>;
+		st,syscfg = <&pwrcfg 0x00 0x100>;
 	};
-- 
2.7.4

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

* [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
@ 2018-04-19 13:21   ` Amelie Delaunay
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue
  Cc: linux-rtc, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

RTC driver should not be aware of the PWR registers offset and bits
position. Furthermore, we can imagine that Disable Backup Protection (DBP)
relative register and bit mask could change depending on the SoC. So this
patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
phandle/offset/mask triplet.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
index a66692a..00f8b5d 100644
--- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
+++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
@@ -14,8 +14,10 @@ Required properties:
     It is required only on stm32h7.
 - interrupt-parent: phandle for the interrupt controller.
 - interrupts: rtc alarm interrupt.
-- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup domain
-  (RTC registers) write protection.
+- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg used to
+  access control register at offset, and change the dbp (Disable Backup
+  Protection) bit represented by the mask, mandatory to disable/enable backup
+  domain (RTC registers) write protection.
 
 Optional properties (to override default rtc_ck parent clock):
 - assigned-clocks: reference to the rtc_ck clock entry.
@@ -31,7 +33,7 @@ Example:
 		assigned-clock-parents = <&rcc 1 CLK_LSE>;
 		interrupt-parent = <&exti>;
 		interrupts = <17 1>;
-		st,syscfg = <&pwrcfg>;
+		st,syscfg = <&pwrcfg 0x00 0x100>;
 	};
 
 	rtc: rtc@58004000 {
@@ -44,5 +46,5 @@ Example:
 		interrupt-parent = <&exti>;
 		interrupts = <17 1>;
 		interrupt-names = "alarm";
-		st,syscfg = <&pwrcfg>;
+		st,syscfg = <&pwrcfg 0x00 0x100>;
 	};
-- 
2.7.4

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

* [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st, syscfg property
@ 2018-04-19 13:21   ` Amelie Delaunay
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: linux-arm-kernel

RTC driver should not be aware of the PWR registers offset and bits
position. Furthermore, we can imagine that Disable Backup Protection (DBP)
relative register and bit mask could change depending on the SoC. So this
patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
phandle/offset/mask triplet.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
index a66692a..00f8b5d 100644
--- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
+++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
@@ -14,8 +14,10 @@ Required properties:
     It is required only on stm32h7.
 - interrupt-parent: phandle for the interrupt controller.
 - interrupts: rtc alarm interrupt.
-- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup domain
-  (RTC registers) write protection.
+- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg used to
+  access control register at offset, and change the dbp (Disable Backup
+  Protection) bit represented by the mask, mandatory to disable/enable backup
+  domain (RTC registers) write protection.
 
 Optional properties (to override default rtc_ck parent clock):
 - assigned-clocks: reference to the rtc_ck clock entry.
@@ -31,7 +33,7 @@ Example:
 		assigned-clock-parents = <&rcc 1 CLK_LSE>;
 		interrupt-parent = <&exti>;
 		interrupts = <17 1>;
-		st,syscfg = <&pwrcfg>;
+		st,syscfg = <&pwrcfg 0x00 0x100>;
 	};
 
 	rtc: rtc at 58004000 {
@@ -44,5 +46,5 @@ Example:
 		interrupt-parent = <&exti>;
 		interrupts = <17 1>;
 		interrupt-names = "alarm";
-		st,syscfg = <&pwrcfg>;
+		st,syscfg = <&pwrcfg 0x00 0x100>;
 	};
-- 
2.7.4

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

* [PATCH 4/4] rtc: stm32: get DBP register and mask from DT st,syscfg property
  2018-04-19 13:21 ` Amelie Delaunay
  (?)
@ 2018-04-19 13:21   ` Amelie Delaunay
  -1 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue
  Cc: linux-rtc, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

RTC driver should not be aware of the PWR registers offset and bits
position. Furthermore, we can imagine that DBP relative register and bit
mask could change depending on the SoC.
So this patch introduces 2 parameters, dbp_reg and dbp_mask, allowing to
get PWR_CR and PWR_CR_DBP from device tree. And it prepares next RTC
version, backup domain write protection is disabled only if needed.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/rtc/rtc-stm32.c | 59 +++++++++++++++++++++++++++++++------------------
 1 file changed, 37 insertions(+), 22 deletions(-)

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index 6a06078..de49b5b 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -85,23 +85,17 @@
 #define RTC_WPR_2ND_KEY			0x53
 #define RTC_WPR_WRONG_KEY		0xFF
 
-/*
- * RTC registers are protected against parasitic write access.
- * PWR_CR_DBP bit must be set to enable write access to RTC registers.
- */
-/* STM32_PWR_CR */
-#define PWR_CR				0x00
-/* STM32_PWR_CR bit field */
-#define PWR_CR_DBP			BIT(8)
-
 struct stm32_rtc_data {
 	bool has_pclk;
+	bool need_dbp;
 };
 
 struct stm32_rtc {
 	struct rtc_device *rtc_dev;
 	void __iomem *base;
 	struct regmap *dbp;
+	unsigned int dbp_reg;
+	unsigned int dbp_mask;
 	struct stm32_rtc_data *data;
 	struct clk *pclk;
 	struct clk *rtc_ck;
@@ -498,10 +492,12 @@ static const struct rtc_class_ops stm32_rtc_ops = {
 
 static const struct stm32_rtc_data stm32_rtc_data = {
 	.has_pclk = false,
+	.need_dbp = true,
 };
 
 static const struct stm32_rtc_data stm32h7_rtc_data = {
 	.has_pclk = true,
+	.need_dbp = true,
 };
 
 static const struct of_device_id stm32_rtc_of_match[] = {
@@ -576,7 +572,6 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 {
 	struct stm32_rtc *rtc;
 	struct resource *res;
-	const struct of_device_id *match;
 	int ret;
 
 	rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
@@ -588,15 +583,31 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 	if (IS_ERR(rtc->base))
 		return PTR_ERR(rtc->base);
 
-	rtc->dbp = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
-						   "st,syscfg");
-	if (IS_ERR(rtc->dbp)) {
-		dev_err(&pdev->dev, "no st,syscfg\n");
-		return PTR_ERR(rtc->dbp);
-	}
+	rtc->data = (struct stm32_rtc_data *)
+		    of_device_get_match_data(&pdev->dev);
+
+	if (rtc->data->need_dbp) {
+		rtc->dbp = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+							   "st,syscfg");
+		if (IS_ERR(rtc->dbp)) {
+			dev_err(&pdev->dev, "no st,syscfg\n");
+			return PTR_ERR(rtc->dbp);
+		}
 
-	match = of_match_device(stm32_rtc_of_match, &pdev->dev);
-	rtc->data = (struct stm32_rtc_data *)match->data;
+		ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg",
+						 1, &rtc->dbp_reg);
+		if (ret) {
+			dev_err(&pdev->dev, "can't read DBP register offset\n");
+			return ret;
+		}
+
+		ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg",
+						 2, &rtc->dbp_mask);
+		if (ret) {
+			dev_err(&pdev->dev, "can't read DBP register mask\n");
+			return ret;
+		}
+	}
 
 	if (!rtc->data->has_pclk) {
 		rtc->pclk = NULL;
@@ -624,7 +635,9 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 	if (ret)
 		goto err;
 
-	regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, PWR_CR_DBP);
+	if (rtc->data->need_dbp)
+		regmap_update_bits(rtc->dbp, rtc->dbp_reg,
+				   rtc->dbp_mask, rtc->dbp_mask);
 
 	/*
 	 * After a system reset, RTC_ISR.INITS flag can be read to check if
@@ -684,7 +697,8 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 		clk_disable_unprepare(rtc->pclk);
 	clk_disable_unprepare(rtc->rtc_ck);
 
-	regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, 0);
+	if (rtc->data->need_dbp)
+		regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0);
 
 	device_init_wakeup(&pdev->dev, false);
 
@@ -707,8 +721,9 @@ static int stm32_rtc_remove(struct platform_device *pdev)
 	if (rtc->data->has_pclk)
 		clk_disable_unprepare(rtc->pclk);
 
-	/* Enable backup domain write protection */
-	regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, 0);
+	/* Enable backup domain write protection if needed */
+	if (rtc->data->need_dbp)
+		regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0);
 
 	device_init_wakeup(&pdev->dev, false);
 
-- 
2.7.4

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

* [PATCH 4/4] rtc: stm32: get DBP register and mask from DT st,syscfg property
@ 2018-04-19 13:21   ` Amelie Delaunay
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue
  Cc: linux-rtc, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

RTC driver should not be aware of the PWR registers offset and bits
position. Furthermore, we can imagine that DBP relative register and bit
mask could change depending on the SoC.
So this patch introduces 2 parameters, dbp_reg and dbp_mask, allowing to
get PWR_CR and PWR_CR_DBP from device tree. And it prepares next RTC
version, backup domain write protection is disabled only if needed.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/rtc/rtc-stm32.c | 59 +++++++++++++++++++++++++++++++------------------
 1 file changed, 37 insertions(+), 22 deletions(-)

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index 6a06078..de49b5b 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -85,23 +85,17 @@
 #define RTC_WPR_2ND_KEY			0x53
 #define RTC_WPR_WRONG_KEY		0xFF
 
-/*
- * RTC registers are protected against parasitic write access.
- * PWR_CR_DBP bit must be set to enable write access to RTC registers.
- */
-/* STM32_PWR_CR */
-#define PWR_CR				0x00
-/* STM32_PWR_CR bit field */
-#define PWR_CR_DBP			BIT(8)
-
 struct stm32_rtc_data {
 	bool has_pclk;
+	bool need_dbp;
 };
 
 struct stm32_rtc {
 	struct rtc_device *rtc_dev;
 	void __iomem *base;
 	struct regmap *dbp;
+	unsigned int dbp_reg;
+	unsigned int dbp_mask;
 	struct stm32_rtc_data *data;
 	struct clk *pclk;
 	struct clk *rtc_ck;
@@ -498,10 +492,12 @@ static const struct rtc_class_ops stm32_rtc_ops = {
 
 static const struct stm32_rtc_data stm32_rtc_data = {
 	.has_pclk = false,
+	.need_dbp = true,
 };
 
 static const struct stm32_rtc_data stm32h7_rtc_data = {
 	.has_pclk = true,
+	.need_dbp = true,
 };
 
 static const struct of_device_id stm32_rtc_of_match[] = {
@@ -576,7 +572,6 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 {
 	struct stm32_rtc *rtc;
 	struct resource *res;
-	const struct of_device_id *match;
 	int ret;
 
 	rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
@@ -588,15 +583,31 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 	if (IS_ERR(rtc->base))
 		return PTR_ERR(rtc->base);
 
-	rtc->dbp = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
-						   "st,syscfg");
-	if (IS_ERR(rtc->dbp)) {
-		dev_err(&pdev->dev, "no st,syscfg\n");
-		return PTR_ERR(rtc->dbp);
-	}
+	rtc->data = (struct stm32_rtc_data *)
+		    of_device_get_match_data(&pdev->dev);
+
+	if (rtc->data->need_dbp) {
+		rtc->dbp = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+							   "st,syscfg");
+		if (IS_ERR(rtc->dbp)) {
+			dev_err(&pdev->dev, "no st,syscfg\n");
+			return PTR_ERR(rtc->dbp);
+		}
 
-	match = of_match_device(stm32_rtc_of_match, &pdev->dev);
-	rtc->data = (struct stm32_rtc_data *)match->data;
+		ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg",
+						 1, &rtc->dbp_reg);
+		if (ret) {
+			dev_err(&pdev->dev, "can't read DBP register offset\n");
+			return ret;
+		}
+
+		ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg",
+						 2, &rtc->dbp_mask);
+		if (ret) {
+			dev_err(&pdev->dev, "can't read DBP register mask\n");
+			return ret;
+		}
+	}
 
 	if (!rtc->data->has_pclk) {
 		rtc->pclk = NULL;
@@ -624,7 +635,9 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 	if (ret)
 		goto err;
 
-	regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, PWR_CR_DBP);
+	if (rtc->data->need_dbp)
+		regmap_update_bits(rtc->dbp, rtc->dbp_reg,
+				   rtc->dbp_mask, rtc->dbp_mask);
 
 	/*
 	 * After a system reset, RTC_ISR.INITS flag can be read to check if
@@ -684,7 +697,8 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 		clk_disable_unprepare(rtc->pclk);
 	clk_disable_unprepare(rtc->rtc_ck);
 
-	regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, 0);
+	if (rtc->data->need_dbp)
+		regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0);
 
 	device_init_wakeup(&pdev->dev, false);
 
@@ -707,8 +721,9 @@ static int stm32_rtc_remove(struct platform_device *pdev)
 	if (rtc->data->has_pclk)
 		clk_disable_unprepare(rtc->pclk);
 
-	/* Enable backup domain write protection */
-	regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, 0);
+	/* Enable backup domain write protection if needed */
+	if (rtc->data->need_dbp)
+		regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0);
 
 	device_init_wakeup(&pdev->dev, false);
 
-- 
2.7.4

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

* [PATCH 4/4] rtc: stm32: get DBP register and mask from DT st, syscfg property
@ 2018-04-19 13:21   ` Amelie Delaunay
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie Delaunay @ 2018-04-19 13:21 UTC (permalink / raw)
  To: linux-arm-kernel

RTC driver should not be aware of the PWR registers offset and bits
position. Furthermore, we can imagine that DBP relative register and bit
mask could change depending on the SoC.
So this patch introduces 2 parameters, dbp_reg and dbp_mask, allowing to
get PWR_CR and PWR_CR_DBP from device tree. And it prepares next RTC
version, backup domain write protection is disabled only if needed.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/rtc/rtc-stm32.c | 59 +++++++++++++++++++++++++++++++------------------
 1 file changed, 37 insertions(+), 22 deletions(-)

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index 6a06078..de49b5b 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -85,23 +85,17 @@
 #define RTC_WPR_2ND_KEY			0x53
 #define RTC_WPR_WRONG_KEY		0xFF
 
-/*
- * RTC registers are protected against parasitic write access.
- * PWR_CR_DBP bit must be set to enable write access to RTC registers.
- */
-/* STM32_PWR_CR */
-#define PWR_CR				0x00
-/* STM32_PWR_CR bit field */
-#define PWR_CR_DBP			BIT(8)
-
 struct stm32_rtc_data {
 	bool has_pclk;
+	bool need_dbp;
 };
 
 struct stm32_rtc {
 	struct rtc_device *rtc_dev;
 	void __iomem *base;
 	struct regmap *dbp;
+	unsigned int dbp_reg;
+	unsigned int dbp_mask;
 	struct stm32_rtc_data *data;
 	struct clk *pclk;
 	struct clk *rtc_ck;
@@ -498,10 +492,12 @@ static const struct rtc_class_ops stm32_rtc_ops = {
 
 static const struct stm32_rtc_data stm32_rtc_data = {
 	.has_pclk = false,
+	.need_dbp = true,
 };
 
 static const struct stm32_rtc_data stm32h7_rtc_data = {
 	.has_pclk = true,
+	.need_dbp = true,
 };
 
 static const struct of_device_id stm32_rtc_of_match[] = {
@@ -576,7 +572,6 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 {
 	struct stm32_rtc *rtc;
 	struct resource *res;
-	const struct of_device_id *match;
 	int ret;
 
 	rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
@@ -588,15 +583,31 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 	if (IS_ERR(rtc->base))
 		return PTR_ERR(rtc->base);
 
-	rtc->dbp = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
-						   "st,syscfg");
-	if (IS_ERR(rtc->dbp)) {
-		dev_err(&pdev->dev, "no st,syscfg\n");
-		return PTR_ERR(rtc->dbp);
-	}
+	rtc->data = (struct stm32_rtc_data *)
+		    of_device_get_match_data(&pdev->dev);
+
+	if (rtc->data->need_dbp) {
+		rtc->dbp = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+							   "st,syscfg");
+		if (IS_ERR(rtc->dbp)) {
+			dev_err(&pdev->dev, "no st,syscfg\n");
+			return PTR_ERR(rtc->dbp);
+		}
 
-	match = of_match_device(stm32_rtc_of_match, &pdev->dev);
-	rtc->data = (struct stm32_rtc_data *)match->data;
+		ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg",
+						 1, &rtc->dbp_reg);
+		if (ret) {
+			dev_err(&pdev->dev, "can't read DBP register offset\n");
+			return ret;
+		}
+
+		ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg",
+						 2, &rtc->dbp_mask);
+		if (ret) {
+			dev_err(&pdev->dev, "can't read DBP register mask\n");
+			return ret;
+		}
+	}
 
 	if (!rtc->data->has_pclk) {
 		rtc->pclk = NULL;
@@ -624,7 +635,9 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 	if (ret)
 		goto err;
 
-	regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, PWR_CR_DBP);
+	if (rtc->data->need_dbp)
+		regmap_update_bits(rtc->dbp, rtc->dbp_reg,
+				   rtc->dbp_mask, rtc->dbp_mask);
 
 	/*
 	 * After a system reset, RTC_ISR.INITS flag can be read to check if
@@ -684,7 +697,8 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 		clk_disable_unprepare(rtc->pclk);
 	clk_disable_unprepare(rtc->rtc_ck);
 
-	regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, 0);
+	if (rtc->data->need_dbp)
+		regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0);
 
 	device_init_wakeup(&pdev->dev, false);
 
@@ -707,8 +721,9 @@ static int stm32_rtc_remove(struct platform_device *pdev)
 	if (rtc->data->has_pclk)
 		clk_disable_unprepare(rtc->pclk);
 
-	/* Enable backup domain write protection */
-	regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, 0);
+	/* Enable backup domain write protection if needed */
+	if (rtc->data->need_dbp)
+		regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0);
 
 	device_init_wakeup(&pdev->dev, false);
 
-- 
2.7.4

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

* Re: [PATCH 0/4] Various fixes on STM32 RTC
  2018-04-19 13:21 ` Amelie Delaunay
@ 2018-04-19 13:43   ` Alexandre Belloni
  -1 siblings, 0 replies; 32+ messages in thread
From: Alexandre Belloni @ 2018-04-19 13:43 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Alessandro Zummo, Rob Herring, Mark Rutland, Maxime Coquelin,
	Alexandre Torgue, linux-rtc, devicetree, linux-arm-kernel,
	linux-kernel

Hi,

Both series were not sent to the correct email address. I would suggest
rebasing on top of v4.17-rc1 ;). No need to resend just for that.

On 19/04/2018 15:21:39+0200, Amelie Delaunay wrote:
> This series makes some corrections on STM32 RTC:
> - update copyright and adopt SPDX identifier
> - fix alarm interrupt flags
> - rework DBP (Disable Backup domain Protection) management.
> 
> This series is a preamble to the serie which will introduce next STM32 RTC
> version.
> 
> Amelie Delaunay (4):
>   rtc: stm32: fix copyright and adopt SPDX identifier
>   rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING
>   dt-bindings: rtc: update stm32-rtc documentation for st,syscfg
>     property
>   rtc: stm32: get DBP register and mask from DT st,syscfg property
> 
>  .../devicetree/bindings/rtc/st,stm32-rtc.txt       | 10 ++--
>  drivers/rtc/rtc-stm32.c                            | 68 +++++++++++++---------
>  2 files changed, 47 insertions(+), 31 deletions(-)
> 
> -- 
> 2.7.4
> 

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [PATCH 0/4] Various fixes on STM32 RTC
@ 2018-04-19 13:43   ` Alexandre Belloni
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Belloni @ 2018-04-19 13:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Both series were not sent to the correct email address. I would suggest
rebasing on top of v4.17-rc1 ;). No need to resend just for that.

On 19/04/2018 15:21:39+0200, Amelie Delaunay wrote:
> This series makes some corrections on STM32 RTC:
> - update copyright and adopt SPDX identifier
> - fix alarm interrupt flags
> - rework DBP (Disable Backup domain Protection) management.
> 
> This series is a preamble to the serie which will introduce next STM32 RTC
> version.
> 
> Amelie Delaunay (4):
>   rtc: stm32: fix copyright and adopt SPDX identifier
>   rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING
>   dt-bindings: rtc: update stm32-rtc documentation for st,syscfg
>     property
>   rtc: stm32: get DBP register and mask from DT st,syscfg property
> 
>  .../devicetree/bindings/rtc/st,stm32-rtc.txt       | 10 ++--
>  drivers/rtc/rtc-stm32.c                            | 68 +++++++++++++---------
>  2 files changed, 47 insertions(+), 31 deletions(-)
> 
> -- 
> 2.7.4
> 

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* RE: [PATCH 0/4] Various fixes on STM32 RTC
  2018-04-19 13:43   ` Alexandre Belloni
@ 2018-04-19 14:14     ` Amelie DELAUNAY
  -1 siblings, 0 replies; 32+ messages in thread
From: Amelie DELAUNAY @ 2018-04-19 14:14 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Alessandro Zummo, Rob Herring, Mark Rutland, Maxime Coquelin,
	Alexandre TORGUE, linux-rtc, devicetree, linux-arm-kernel,
	linux-kernel

Hi,

Sorry for that! I take note of your new email address. Thanks for your highlight.

Regards,
Amelie

> -----Original Message-----
> From: Alexandre Belloni [mailto:alexandre.belloni@bootlin.com]
> Sent: jeudi 19 avril 2018 15:43
> To: Amelie DELAUNAY <amelie.delaunay@st.com>
> Cc: Alessandro Zummo <a.zummo@towertech.it>; Rob Herring
> <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>; Maxime
> Coquelin <mcoquelin.stm32@gmail.com>; Alexandre TORGUE
> <alexandre.torgue@st.com>; linux-rtc@vger.kernel.org;
> devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH 0/4] Various fixes on STM32 RTC
> 
> Hi,
> 
> Both series were not sent to the correct email address. I would suggest
> rebasing on top of v4.17-rc1 ;). No need to resend just for that.
> 
> On 19/04/2018 15:21:39+0200, Amelie Delaunay wrote:
> > This series makes some corrections on STM32 RTC:
> > - update copyright and adopt SPDX identifier
> > - fix alarm interrupt flags
> > - rework DBP (Disable Backup domain Protection) management.
> >
> > This series is a preamble to the serie which will introduce next STM32
> > RTC version.
> >
> > Amelie Delaunay (4):
> >   rtc: stm32: fix copyright and adopt SPDX identifier
> >   rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING
> >   dt-bindings: rtc: update stm32-rtc documentation for st,syscfg
> >     property
> >   rtc: stm32: get DBP register and mask from DT st,syscfg property
> >
> >  .../devicetree/bindings/rtc/st,stm32-rtc.txt       | 10 ++--
> >  drivers/rtc/rtc-stm32.c                            | 68 +++++++++++++---------
> >  2 files changed, 47 insertions(+), 31 deletions(-)
> >
> > --
> > 2.7.4
> >
> 
> --
> Alexandre Belloni, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> https://bootlin.com

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

* [PATCH 0/4] Various fixes on STM32 RTC
@ 2018-04-19 14:14     ` Amelie DELAUNAY
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie DELAUNAY @ 2018-04-19 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Sorry for that! I take note of your new email address. Thanks for your highlight.

Regards,
Amelie

> -----Original Message-----
> From: Alexandre Belloni [mailto:alexandre.belloni at bootlin.com]
> Sent: jeudi 19 avril 2018 15:43
> To: Amelie DELAUNAY <amelie.delaunay@st.com>
> Cc: Alessandro Zummo <a.zummo@towertech.it>; Rob Herring
> <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>; Maxime
> Coquelin <mcoquelin.stm32@gmail.com>; Alexandre TORGUE
> <alexandre.torgue@st.com>; linux-rtc at vger.kernel.org;
> devicetree at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-
> kernel at vger.kernel.org
> Subject: Re: [PATCH 0/4] Various fixes on STM32 RTC
> 
> Hi,
> 
> Both series were not sent to the correct email address. I would suggest
> rebasing on top of v4.17-rc1 ;). No need to resend just for that.
> 
> On 19/04/2018 15:21:39+0200, Amelie Delaunay wrote:
> > This series makes some corrections on STM32 RTC:
> > - update copyright and adopt SPDX identifier
> > - fix alarm interrupt flags
> > - rework DBP (Disable Backup domain Protection) management.
> >
> > This series is a preamble to the serie which will introduce next STM32
> > RTC version.
> >
> > Amelie Delaunay (4):
> >   rtc: stm32: fix copyright and adopt SPDX identifier
> >   rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING
> >   dt-bindings: rtc: update stm32-rtc documentation for st,syscfg
> >     property
> >   rtc: stm32: get DBP register and mask from DT st,syscfg property
> >
> >  .../devicetree/bindings/rtc/st,stm32-rtc.txt       | 10 ++--
> >  drivers/rtc/rtc-stm32.c                            | 68 +++++++++++++---------
> >  2 files changed, 47 insertions(+), 31 deletions(-)
> >
> > --
> > 2.7.4
> >
> 
> --
> Alexandre Belloni, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> https://bootlin.com

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

* Re: [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
  2018-04-19 13:21   ` [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property Amelie Delaunay
@ 2018-04-27  2:58     ` Rob Herring
  -1 siblings, 0 replies; 32+ messages in thread
From: Rob Herring @ 2018-04-27  2:58 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Alessandro Zummo, Alexandre Belloni, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue, linux-rtc, devicetree,
	linux-arm-kernel, linux-kernel

On Thu, Apr 19, 2018 at 03:21:42PM +0200, Amelie Delaunay wrote:
> RTC driver should not be aware of the PWR registers offset and bits
> position. Furthermore, we can imagine that Disable Backup Protection (DBP)
> relative register and bit mask could change depending on the SoC. So this
> patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
> phandle/offset/mask triplet.
> 
> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
> ---
>  Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
> index a66692a..00f8b5d 100644
> --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
> +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
> @@ -14,8 +14,10 @@ Required properties:
>      It is required only on stm32h7.
>  - interrupt-parent: phandle for the interrupt controller.
>  - interrupts: rtc alarm interrupt.
> -- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup domain
> -  (RTC registers) write protection.
> +- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg used to
> +  access control register at offset, and change the dbp (Disable Backup
> +  Protection) bit represented by the mask, mandatory to disable/enable backup
> +  domain (RTC registers) write protection.

It's fine to add this, but you are breaking compatibility in the driver 
with existing DTBs by requiring these new fields.

Rob

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

* [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
@ 2018-04-27  2:58     ` Rob Herring
  0 siblings, 0 replies; 32+ messages in thread
From: Rob Herring @ 2018-04-27  2:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 19, 2018 at 03:21:42PM +0200, Amelie Delaunay wrote:
> RTC driver should not be aware of the PWR registers offset and bits
> position. Furthermore, we can imagine that Disable Backup Protection (DBP)
> relative register and bit mask could change depending on the SoC. So this
> patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
> phandle/offset/mask triplet.
> 
> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
> ---
>  Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
> index a66692a..00f8b5d 100644
> --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
> +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
> @@ -14,8 +14,10 @@ Required properties:
>      It is required only on stm32h7.
>  - interrupt-parent: phandle for the interrupt controller.
>  - interrupts: rtc alarm interrupt.
> -- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup domain
> -  (RTC registers) write protection.
> +- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg used to
> +  access control register at offset, and change the dbp (Disable Backup
> +  Protection) bit represented by the mask, mandatory to disable/enable backup
> +  domain (RTC registers) write protection.

It's fine to add this, but you are breaking compatibility in the driver 
with existing DTBs by requiring these new fields.

Rob

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

* Re: [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
  2018-04-27  2:58     ` Rob Herring
@ 2018-05-03 20:53       ` Alexandre Belloni
  -1 siblings, 0 replies; 32+ messages in thread
From: Alexandre Belloni @ 2018-05-03 20:53 UTC (permalink / raw)
  To: Rob Herring
  Cc: Amelie Delaunay, Alessandro Zummo, Mark Rutland, Maxime Coquelin,
	Alexandre Torgue, linux-rtc, devicetree, linux-arm-kernel,
	linux-kernel

Amelie,

On 26/04/2018 21:58:03-0500, Rob Herring wrote:
> On Thu, Apr 19, 2018 at 03:21:42PM +0200, Amelie Delaunay wrote:
> > RTC driver should not be aware of the PWR registers offset and bits
> > position. Furthermore, we can imagine that Disable Backup Protection (DBP)
> > relative register and bit mask could change depending on the SoC. So this
> > patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
> > phandle/offset/mask triplet.
> > 
> > Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
> > ---
> >  Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
> > index a66692a..00f8b5d 100644
> > --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
> > +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
> > @@ -14,8 +14,10 @@ Required properties:
> >      It is required only on stm32h7.
> >  - interrupt-parent: phandle for the interrupt controller.
> >  - interrupts: rtc alarm interrupt.
> > -- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup domain
> > -  (RTC registers) write protection.
> > +- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg used to
> > +  access control register at offset, and change the dbp (Disable Backup
> > +  Protection) bit represented by the mask, mandatory to disable/enable backup
> > +  domain (RTC registers) write protection.
> 
> It's fine to add this, but you are breaking compatibility in the driver 
> with existing DTBs by requiring these new fields.
> 

I'm fine with that change but I would like confirmation that this has
been well thought. Maybe Maxime or Alexandre could give their ack.

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
@ 2018-05-03 20:53       ` Alexandre Belloni
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Belloni @ 2018-05-03 20:53 UTC (permalink / raw)
  To: linux-arm-kernel

Amelie,

On 26/04/2018 21:58:03-0500, Rob Herring wrote:
> On Thu, Apr 19, 2018 at 03:21:42PM +0200, Amelie Delaunay wrote:
> > RTC driver should not be aware of the PWR registers offset and bits
> > position. Furthermore, we can imagine that Disable Backup Protection (DBP)
> > relative register and bit mask could change depending on the SoC. So this
> > patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
> > phandle/offset/mask triplet.
> > 
> > Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
> > ---
> >  Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
> > index a66692a..00f8b5d 100644
> > --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
> > +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
> > @@ -14,8 +14,10 @@ Required properties:
> >      It is required only on stm32h7.
> >  - interrupt-parent: phandle for the interrupt controller.
> >  - interrupts: rtc alarm interrupt.
> > -- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup domain
> > -  (RTC registers) write protection.
> > +- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg used to
> > +  access control register at offset, and change the dbp (Disable Backup
> > +  Protection) bit represented by the mask, mandatory to disable/enable backup
> > +  domain (RTC registers) write protection.
> 
> It's fine to add this, but you are breaking compatibility in the driver 
> with existing DTBs by requiring these new fields.
> 

I'm fine with that change but I would like confirmation that this has
been well thought. Maybe Maxime or Alexandre could give their ack.

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
  2018-05-03 20:53       ` Alexandre Belloni
  (?)
@ 2018-05-04  7:40         ` Alexandre Torgue
  -1 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2018-05-04  7:40 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring
  Cc: Amelie Delaunay, Alessandro Zummo, Mark Rutland, Maxime Coquelin,
	linux-rtc, devicetree, linux-arm-kernel, linux-kernel

Hi Alexandre,

On 05/03/2018 10:53 PM, Alexandre Belloni wrote:
> Amelie,
> 
> On 26/04/2018 21:58:03-0500, Rob Herring wrote:
>> On Thu, Apr 19, 2018 at 03:21:42PM +0200, Amelie Delaunay wrote:
>>> RTC driver should not be aware of the PWR registers offset and bits
>>> position. Furthermore, we can imagine that Disable Backup Protection (DBP)
>>> relative register and bit mask could change depending on the SoC. So this
>>> patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
>>> phandle/offset/mask triplet.
>>>
>>> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
>>> ---
>>>   Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 ++++++----
>>>   1 file changed, 6 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>> index a66692a..00f8b5d 100644
>>> --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>> +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>> @@ -14,8 +14,10 @@ Required properties:
>>>       It is required only on stm32h7.
>>>   - interrupt-parent: phandle for the interrupt controller.
>>>   - interrupts: rtc alarm interrupt.
>>> -- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup domain
>>> -  (RTC registers) write protection.
>>> +- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg used to
>>> +  access control register at offset, and change the dbp (Disable Backup
>>> +  Protection) bit represented by the mask, mandatory to disable/enable backup
>>> +  domain (RTC registers) write protection.
>>
>> It's fine to add this, but you are breaking compatibility in the driver
>> with existing DTBs by requiring these new fields.
>>
> 
> I'm fine with that change but I would like confirmation that this has
> been well thought. Maybe Maxime or Alexandre could give their ack.
> 

It's a good thing to remove PWR registers information from RTC driver. 
My only concern was the compatibility with old DT but we can accept it. 
Indeed, Kernel will continue to boot fine, only RTC will not probe if we 
use old DT.

Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>

Regards
alex

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

* Re: [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
@ 2018-05-04  7:40         ` Alexandre Torgue
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2018-05-04  7:40 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring
  Cc: Amelie Delaunay, Alessandro Zummo, Mark Rutland, Maxime Coquelin,
	linux-rtc, devicetree, linux-arm-kernel, linux-kernel

Hi Alexandre,

On 05/03/2018 10:53 PM, Alexandre Belloni wrote:
> Amelie,
> 
> On 26/04/2018 21:58:03-0500, Rob Herring wrote:
>> On Thu, Apr 19, 2018 at 03:21:42PM +0200, Amelie Delaunay wrote:
>>> RTC driver should not be aware of the PWR registers offset and bits
>>> position. Furthermore, we can imagine that Disable Backup Protection (DBP)
>>> relative register and bit mask could change depending on the SoC. So this
>>> patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
>>> phandle/offset/mask triplet.
>>>
>>> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
>>> ---
>>>   Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 ++++++----
>>>   1 file changed, 6 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>> index a66692a..00f8b5d 100644
>>> --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>> +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>> @@ -14,8 +14,10 @@ Required properties:
>>>       It is required only on stm32h7.
>>>   - interrupt-parent: phandle for the interrupt controller.
>>>   - interrupts: rtc alarm interrupt.
>>> -- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup domain
>>> -  (RTC registers) write protection.
>>> +- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg used to
>>> +  access control register at offset, and change the dbp (Disable Backup
>>> +  Protection) bit represented by the mask, mandatory to disable/enable backup
>>> +  domain (RTC registers) write protection.
>>
>> It's fine to add this, but you are breaking compatibility in the driver
>> with existing DTBs by requiring these new fields.
>>
> 
> I'm fine with that change but I would like confirmation that this has
> been well thought. Maybe Maxime or Alexandre could give their ack.
> 

It's a good thing to remove PWR registers information from RTC driver. 
My only concern was the compatibility with old DT but we can accept it. 
Indeed, Kernel will continue to boot fine, only RTC will not probe if we 
use old DT.

Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>

Regards
alex

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

* [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
@ 2018-05-04  7:40         ` Alexandre Torgue
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2018-05-04  7:40 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Alexandre,

On 05/03/2018 10:53 PM, Alexandre Belloni wrote:
> Amelie,
> 
> On 26/04/2018 21:58:03-0500, Rob Herring wrote:
>> On Thu, Apr 19, 2018 at 03:21:42PM +0200, Amelie Delaunay wrote:
>>> RTC driver should not be aware of the PWR registers offset and bits
>>> position. Furthermore, we can imagine that Disable Backup Protection (DBP)
>>> relative register and bit mask could change depending on the SoC. So this
>>> patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
>>> phandle/offset/mask triplet.
>>>
>>> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
>>> ---
>>>   Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 ++++++----
>>>   1 file changed, 6 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>> index a66692a..00f8b5d 100644
>>> --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>> +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>> @@ -14,8 +14,10 @@ Required properties:
>>>       It is required only on stm32h7.
>>>   - interrupt-parent: phandle for the interrupt controller.
>>>   - interrupts: rtc alarm interrupt.
>>> -- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup domain
>>> -  (RTC registers) write protection.
>>> +- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg used to
>>> +  access control register at offset, and change the dbp (Disable Backup
>>> +  Protection) bit represented by the mask, mandatory to disable/enable backup
>>> +  domain (RTC registers) write protection.
>>
>> It's fine to add this, but you are breaking compatibility in the driver
>> with existing DTBs by requiring these new fields.
>>
> 
> I'm fine with that change but I would like confirmation that this has
> been well thought. Maybe Maxime or Alexandre could give their ack.
> 

It's a good thing to remove PWR registers information from RTC driver. 
My only concern was the compatibility with old DT but we can accept it. 
Indeed, Kernel will continue to boot fine, only RTC will not probe if we 
use old DT.

Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>

Regards
alex

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

* Re: [PATCH 0/4] Various fixes on STM32 RTC
  2018-04-19 13:21 ` Amelie Delaunay
@ 2018-05-06 20:27   ` Alexandre Belloni
  -1 siblings, 0 replies; 32+ messages in thread
From: Alexandre Belloni @ 2018-05-06 20:27 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Alessandro Zummo, Rob Herring, Mark Rutland, Maxime Coquelin,
	Alexandre Torgue, linux-rtc, devicetree, linux-arm-kernel,
	linux-kernel

On 19/04/2018 15:21:39+0200, Amelie Delaunay wrote:
> This series makes some corrections on STM32 RTC:
> - update copyright and adopt SPDX identifier
> - fix alarm interrupt flags
> - rework DBP (Disable Backup domain Protection) management.
> 
> This series is a preamble to the serie which will introduce next STM32 RTC
> version.
> 
> Amelie Delaunay (4):
>   rtc: stm32: fix copyright and adopt SPDX identifier
>   rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING
>   dt-bindings: rtc: update stm32-rtc documentation for st,syscfg
>     property
>   rtc: stm32: get DBP register and mask from DT st,syscfg property
> 
>  .../devicetree/bindings/rtc/st,stm32-rtc.txt       | 10 ++--
>  drivers/rtc/rtc-stm32.c                            | 68 +++++++++++++---------
>  2 files changed, 47 insertions(+), 31 deletions(-)
> 

Applied, thanks.

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [PATCH 0/4] Various fixes on STM32 RTC
@ 2018-05-06 20:27   ` Alexandre Belloni
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Belloni @ 2018-05-06 20:27 UTC (permalink / raw)
  To: linux-arm-kernel

On 19/04/2018 15:21:39+0200, Amelie Delaunay wrote:
> This series makes some corrections on STM32 RTC:
> - update copyright and adopt SPDX identifier
> - fix alarm interrupt flags
> - rework DBP (Disable Backup domain Protection) management.
> 
> This series is a preamble to the serie which will introduce next STM32 RTC
> version.
> 
> Amelie Delaunay (4):
>   rtc: stm32: fix copyright and adopt SPDX identifier
>   rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING
>   dt-bindings: rtc: update stm32-rtc documentation for st,syscfg
>     property
>   rtc: stm32: get DBP register and mask from DT st,syscfg property
> 
>  .../devicetree/bindings/rtc/st,stm32-rtc.txt       | 10 ++--
>  drivers/rtc/rtc-stm32.c                            | 68 +++++++++++++---------
>  2 files changed, 47 insertions(+), 31 deletions(-)
> 

Applied, thanks.

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
  2018-05-04  7:40         ` Alexandre Torgue
  (?)
  (?)
@ 2018-05-09  7:21           ` Amelie DELAUNAY
  -1 siblings, 0 replies; 32+ messages in thread
From: Amelie DELAUNAY @ 2018-05-09  7:21 UTC (permalink / raw)
  To: Alexandre TORGUE, Alexandre Belloni, Rob Herring
  Cc: Alessandro Zummo, Mark Rutland, Maxime Coquelin, linux-rtc,
	devicetree, linux-arm-kernel, linux-kernel

Hi,

On 05/04/2018 09:40 AM, Alexandre Torgue wrote:
> Hi Alexandre,
> 
> On 05/03/2018 10:53 PM, Alexandre Belloni wrote:
>> Amelie,
>>
>> On 26/04/2018 21:58:03-0500, Rob Herring wrote:
>>> On Thu, Apr 19, 2018 at 03:21:42PM +0200, Amelie Delaunay wrote:
>>>> RTC driver should not be aware of the PWR registers offset and bits
>>>> position. Furthermore, we can imagine that Disable Backup Protection 
>>>> (DBP)
>>>> relative register and bit mask could change depending on the SoC. So 
>>>> this
>>>> patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
>>>> phandle/offset/mask triplet.
>>>>
>>>> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
>>>> ---
>>>>   Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 
>>>> ++++++----
>>>>   1 file changed, 6 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt 
>>>> b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>>> index a66692a..00f8b5d 100644
>>>> --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>>> +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>>> @@ -14,8 +14,10 @@ Required properties:
>>>>       It is required only on stm32h7.
>>>>   - interrupt-parent: phandle for the interrupt controller.
>>>>   - interrupts: rtc alarm interrupt.
>>>> -- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup 
>>>> domain
>>>> -  (RTC registers) write protection.
>>>> +- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg 
>>>> used to
>>>> +  access control register at offset, and change the dbp (Disable 
>>>> Backup
>>>> +  Protection) bit represented by the mask, mandatory to 
>>>> disable/enable backup
>>>> +  domain (RTC registers) write protection.
>>>
>>> It's fine to add this, but you are breaking compatibility in the driver
>>> with existing DTBs by requiring these new fields.
>>>
>>
>> I'm fine with that change but I would like confirmation that this has
>> been well thought. Maybe Maxime or Alexandre could give their ack.
>>
> 
> It's a good thing to remove PWR registers information from RTC driver. 
> My only concern was the compatibility with old DT but we can accept it. 
> Indeed, Kernel will continue to boot fine, only RTC will not probe if we 
> use old DT.
> 
> Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>
> 
> Regards
> alex

I am going to send a series to update st,syscfg property in 
stm32f429/stm32f746/stm32h743 RTC node.

Thanks,
Amelie

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

* Re: [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
@ 2018-05-09  7:21           ` Amelie DELAUNAY
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie DELAUNAY @ 2018-05-09  7:21 UTC (permalink / raw)
  To: Alexandre TORGUE, Alexandre Belloni, Rob Herring
  Cc: Alessandro Zummo, Mark Rutland, Maxime Coquelin, linux-rtc,
	devicetree, linux-arm-kernel, linux-kernel

SGksDQoNCk9uIDA1LzA0LzIwMTggMDk6NDAgQU0sIEFsZXhhbmRyZSBUb3JndWUgd3JvdGU6DQo+
IEhpIEFsZXhhbmRyZSwNCj4gDQo+IE9uIDA1LzAzLzIwMTggMTA6NTMgUE0sIEFsZXhhbmRyZSBC
ZWxsb25pIHdyb3RlOg0KPj4gQW1lbGllLA0KPj4NCj4+IE9uIDI2LzA0LzIwMTggMjE6NTg6MDMt
MDUwMCwgUm9iIEhlcnJpbmcgd3JvdGU6DQo+Pj4gT24gVGh1LCBBcHIgMTksIDIwMTggYXQgMDM6
MjE6NDJQTSArMDIwMCwgQW1lbGllIERlbGF1bmF5IHdyb3RlOg0KPj4+PiBSVEMgZHJpdmVyIHNo
b3VsZCBub3QgYmUgYXdhcmUgb2YgdGhlIFBXUiByZWdpc3RlcnMgb2Zmc2V0IGFuZCBiaXRzDQo+
Pj4+IHBvc2l0aW9uLiBGdXJ0aGVybW9yZSwgd2UgY2FuIGltYWdpbmUgdGhhdCBEaXNhYmxlIEJh
Y2t1cCBQcm90ZWN0aW9uIA0KPj4+PiAoREJQKQ0KPj4+PiByZWxhdGl2ZSByZWdpc3RlciBhbmQg
Yml0IG1hc2sgY291bGQgY2hhbmdlIGRlcGVuZGluZyBvbiB0aGUgU29DLiBTbyANCj4+Pj4gdGhp
cw0KPj4+PiBwYXRjaCBtb3ZlcyBzdCxzeXNjZmcgcHJvcGVydHkgZnJvbSBzaW5nbGUgcHdyY2Zn
IHBoYW5kbGUgdG8gcHdyY2ZnDQo+Pj4+IHBoYW5kbGUvb2Zmc2V0L21hc2sgdHJpcGxldC4NCj4+
Pj4NCj4+Pj4gU2lnbmVkLW9mZi1ieTogQW1lbGllIERlbGF1bmF5IDxhbWVsaWUuZGVsYXVuYXlA
c3QuY29tPg0KPj4+PiAtLS0NCj4+Pj4gwqAgRG9jdW1lbnRhdGlvbi9kZXZpY2V0cmVlL2JpbmRp
bmdzL3J0Yy9zdCxzdG0zMi1ydGMudHh0IHwgMTAgDQo+Pj4+ICsrKysrKy0tLS0NCj4+Pj4gwqAg
MSBmaWxlIGNoYW5nZWQsIDYgaW5zZXJ0aW9ucygrKSwgNCBkZWxldGlvbnMoLSkNCj4+Pj4NCj4+
Pj4gZGlmZiAtLWdpdCBhL0RvY3VtZW50YXRpb24vZGV2aWNldHJlZS9iaW5kaW5ncy9ydGMvc3Qs
c3RtMzItcnRjLnR4dCANCj4+Pj4gYi9Eb2N1bWVudGF0aW9uL2RldmljZXRyZWUvYmluZGluZ3Mv
cnRjL3N0LHN0bTMyLXJ0Yy50eHQNCj4+Pj4gaW5kZXggYTY2NjkyYS4uMDBmOGI1ZCAxMDA2NDQN
Cj4+Pj4gLS0tIGEvRG9jdW1lbnRhdGlvbi9kZXZpY2V0cmVlL2JpbmRpbmdzL3J0Yy9zdCxzdG0z
Mi1ydGMudHh0DQo+Pj4+ICsrKyBiL0RvY3VtZW50YXRpb24vZGV2aWNldHJlZS9iaW5kaW5ncy9y
dGMvc3Qsc3RtMzItcnRjLnR4dA0KPj4+PiBAQCAtMTQsOCArMTQsMTAgQEAgUmVxdWlyZWQgcHJv
cGVydGllczoNCj4+Pj4gwqDCoMKgwqDCoCBJdCBpcyByZXF1aXJlZCBvbmx5IG9uIHN0bTMyaDcu
DQo+Pj4+IMKgIC0gaW50ZXJydXB0LXBhcmVudDogcGhhbmRsZSBmb3IgdGhlIGludGVycnVwdCBj
b250cm9sbGVyLg0KPj4+PiDCoCAtIGludGVycnVwdHM6IHJ0YyBhbGFybSBpbnRlcnJ1cHQuDQo+
Pj4+IC0tIHN0LHN5c2NmZzogcGhhbmRsZSBmb3IgcHdyY2ZnLCBtYW5kYXRvcnkgdG8gZGlzYWJs
ZS9lbmFibGUgYmFja3VwIA0KPj4+PiBkb21haW4NCj4+Pj4gLcKgIChSVEMgcmVnaXN0ZXJzKSB3
cml0ZSBwcm90ZWN0aW9uLg0KPj4+PiArLSBzdCxzeXNjZmc6IHBoYW5kbGUvb2Zmc2V0L21hc2sg
dHJpcGxldC4gVGhlIHBoYW5kbGUgdG8gcHdyY2ZnIA0KPj4+PiB1c2VkIHRvDQo+Pj4+ICvCoCBh
Y2Nlc3MgY29udHJvbCByZWdpc3RlciBhdCBvZmZzZXQsIGFuZCBjaGFuZ2UgdGhlIGRicCAoRGlz
YWJsZSANCj4+Pj4gQmFja3VwDQo+Pj4+ICvCoCBQcm90ZWN0aW9uKSBiaXQgcmVwcmVzZW50ZWQg
YnkgdGhlIG1hc2ssIG1hbmRhdG9yeSB0byANCj4+Pj4gZGlzYWJsZS9lbmFibGUgYmFja3VwDQo+
Pj4+ICvCoCBkb21haW4gKFJUQyByZWdpc3RlcnMpIHdyaXRlIHByb3RlY3Rpb24uDQo+Pj4NCj4+
PiBJdCdzIGZpbmUgdG8gYWRkIHRoaXMsIGJ1dCB5b3UgYXJlIGJyZWFraW5nIGNvbXBhdGliaWxp
dHkgaW4gdGhlIGRyaXZlcg0KPj4+IHdpdGggZXhpc3RpbmcgRFRCcyBieSByZXF1aXJpbmcgdGhl
c2UgbmV3IGZpZWxkcy4NCj4+Pg0KPj4NCj4+IEknbSBmaW5lIHdpdGggdGhhdCBjaGFuZ2UgYnV0
IEkgd291bGQgbGlrZSBjb25maXJtYXRpb24gdGhhdCB0aGlzIGhhcw0KPj4gYmVlbiB3ZWxsIHRo
b3VnaHQuIE1heWJlIE1heGltZSBvciBBbGV4YW5kcmUgY291bGQgZ2l2ZSB0aGVpciBhY2suDQo+
Pg0KPiANCj4gSXQncyBhIGdvb2QgdGhpbmcgdG8gcmVtb3ZlIFBXUiByZWdpc3RlcnMgaW5mb3Jt
YXRpb24gZnJvbSBSVEMgZHJpdmVyLiANCj4gTXkgb25seSBjb25jZXJuIHdhcyB0aGUgY29tcGF0
aWJpbGl0eSB3aXRoIG9sZCBEVCBidXQgd2UgY2FuIGFjY2VwdCBpdC4gDQo+IEluZGVlZCwgS2Vy
bmVsIHdpbGwgY29udGludWUgdG8gYm9vdCBmaW5lLCBvbmx5IFJUQyB3aWxsIG5vdCBwcm9iZSBp
ZiB3ZSANCj4gdXNlIG9sZCBEVC4NCj4gDQo+IEFja2VkLWJ5OiBBbGV4YW5kcmUgVE9SR1VFIDxh
bGV4YW5kcmUudG9yZ3VlQHN0LmNvbT4NCj4gDQo+IFJlZ2FyZHMNCj4gYWxleA0KDQpJIGFtIGdv
aW5nIHRvIHNlbmQgYSBzZXJpZXMgdG8gdXBkYXRlIHN0LHN5c2NmZyBwcm9wZXJ0eSBpbiANCnN0
bTMyZjQyOS9zdG0zMmY3NDYvc3RtMzJoNzQzIFJUQyBub2RlLg0KDQpUaGFua3MsDQpBbWVsaWU=

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

* Re: [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
@ 2018-05-09  7:21           ` Amelie DELAUNAY
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie DELAUNAY @ 2018-05-09  7:21 UTC (permalink / raw)
  To: Alexandre TORGUE, Alexandre Belloni, Rob Herring
  Cc: Mark Rutland, Alessandro Zummo, devicetree, linux-kernel,
	Maxime Coquelin, linux-arm-kernel, linux-rtc

Hi,

On 05/04/2018 09:40 AM, Alexandre Torgue wrote:
> Hi Alexandre,
> 
> On 05/03/2018 10:53 PM, Alexandre Belloni wrote:
>> Amelie,
>>
>> On 26/04/2018 21:58:03-0500, Rob Herring wrote:
>>> On Thu, Apr 19, 2018 at 03:21:42PM +0200, Amelie Delaunay wrote:
>>>> RTC driver should not be aware of the PWR registers offset and bits
>>>> position. Furthermore, we can imagine that Disable Backup Protection 
>>>> (DBP)
>>>> relative register and bit mask could change depending on the SoC. So 
>>>> this
>>>> patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
>>>> phandle/offset/mask triplet.
>>>>
>>>> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
>>>> ---
>>>>   Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 
>>>> ++++++----
>>>>   1 file changed, 6 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt 
>>>> b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>>> index a66692a..00f8b5d 100644
>>>> --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>>> +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>>> @@ -14,8 +14,10 @@ Required properties:
>>>>       It is required only on stm32h7.
>>>>   - interrupt-parent: phandle for the interrupt controller.
>>>>   - interrupts: rtc alarm interrupt.
>>>> -- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup 
>>>> domain
>>>> -  (RTC registers) write protection.
>>>> +- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg 
>>>> used to
>>>> +  access control register at offset, and change the dbp (Disable 
>>>> Backup
>>>> +  Protection) bit represented by the mask, mandatory to 
>>>> disable/enable backup
>>>> +  domain (RTC registers) write protection.
>>>
>>> It's fine to add this, but you are breaking compatibility in the driver
>>> with existing DTBs by requiring these new fields.
>>>
>>
>> I'm fine with that change but I would like confirmation that this has
>> been well thought. Maybe Maxime or Alexandre could give their ack.
>>
> 
> It's a good thing to remove PWR registers information from RTC driver. 
> My only concern was the compatibility with old DT but we can accept it. 
> Indeed, Kernel will continue to boot fine, only RTC will not probe if we 
> use old DT.
> 
> Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>
> 
> Regards
> alex

I am going to send a series to update st,syscfg property in 
stm32f429/stm32f746/stm32h743 RTC node.

Thanks,
Amelie
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property
@ 2018-05-09  7:21           ` Amelie DELAUNAY
  0 siblings, 0 replies; 32+ messages in thread
From: Amelie DELAUNAY @ 2018-05-09  7:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 05/04/2018 09:40 AM, Alexandre Torgue wrote:
> Hi Alexandre,
> 
> On 05/03/2018 10:53 PM, Alexandre Belloni wrote:
>> Amelie,
>>
>> On 26/04/2018 21:58:03-0500, Rob Herring wrote:
>>> On Thu, Apr 19, 2018 at 03:21:42PM +0200, Amelie Delaunay wrote:
>>>> RTC driver should not be aware of the PWR registers offset and bits
>>>> position. Furthermore, we can imagine that Disable Backup Protection 
>>>> (DBP)
>>>> relative register and bit mask could change depending on the SoC. So 
>>>> this
>>>> patch moves st,syscfg property from single pwrcfg phandle to pwrcfg
>>>> phandle/offset/mask triplet.
>>>>
>>>> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
>>>> ---
>>>> ? Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt | 10 
>>>> ++++++----
>>>> ? 1 file changed, 6 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt 
>>>> b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>>> index a66692a..00f8b5d 100644
>>>> --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>>> +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>>>> @@ -14,8 +14,10 @@ Required properties:
>>>> ????? It is required only on stm32h7.
>>>> ? - interrupt-parent: phandle for the interrupt controller.
>>>> ? - interrupts: rtc alarm interrupt.
>>>> -- st,syscfg: phandle for pwrcfg, mandatory to disable/enable backup 
>>>> domain
>>>> -? (RTC registers) write protection.
>>>> +- st,syscfg: phandle/offset/mask triplet. The phandle to pwrcfg 
>>>> used to
>>>> +? access control register at offset, and change the dbp (Disable 
>>>> Backup
>>>> +? Protection) bit represented by the mask, mandatory to 
>>>> disable/enable backup
>>>> +? domain (RTC registers) write protection.
>>>
>>> It's fine to add this, but you are breaking compatibility in the driver
>>> with existing DTBs by requiring these new fields.
>>>
>>
>> I'm fine with that change but I would like confirmation that this has
>> been well thought. Maybe Maxime or Alexandre could give their ack.
>>
> 
> It's a good thing to remove PWR registers information from RTC driver. 
> My only concern was the compatibility with old DT but we can accept it. 
> Indeed, Kernel will continue to boot fine, only RTC will not probe if we 
> use old DT.
> 
> Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>
> 
> Regards
> alex

I am going to send a series to update st,syscfg property in 
stm32f429/stm32f746/stm32h743 RTC node.

Thanks,
Amelie

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

end of thread, other threads:[~2018-05-09  7:21 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19 13:21 [PATCH 0/4] Various fixes on STM32 RTC Amelie Delaunay
2018-04-19 13:21 ` Amelie Delaunay
2018-04-19 13:21 ` Amelie Delaunay
2018-04-19 13:21 ` [PATCH 1/4] rtc: stm32: fix copyright and adopt SPDX identifier Amelie Delaunay
2018-04-19 13:21   ` Amelie Delaunay
2018-04-19 13:21   ` Amelie Delaunay
2018-04-19 13:21 ` [PATCH 2/4] rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISING Amelie Delaunay
2018-04-19 13:21   ` Amelie Delaunay
2018-04-19 13:21   ` Amelie Delaunay
2018-04-19 13:21 ` [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property Amelie Delaunay
2018-04-19 13:21   ` [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st, syscfg property Amelie Delaunay
2018-04-19 13:21   ` [PATCH 3/4] dt-bindings: rtc: update stm32-rtc documentation for st,syscfg property Amelie Delaunay
2018-04-27  2:58   ` Rob Herring
2018-04-27  2:58     ` Rob Herring
2018-05-03 20:53     ` Alexandre Belloni
2018-05-03 20:53       ` Alexandre Belloni
2018-05-04  7:40       ` Alexandre Torgue
2018-05-04  7:40         ` Alexandre Torgue
2018-05-04  7:40         ` Alexandre Torgue
2018-05-09  7:21         ` Amelie DELAUNAY
2018-05-09  7:21           ` Amelie DELAUNAY
2018-05-09  7:21           ` Amelie DELAUNAY
2018-05-09  7:21           ` Amelie DELAUNAY
2018-04-19 13:21 ` [PATCH 4/4] rtc: stm32: get DBP register and mask from DT " Amelie Delaunay
2018-04-19 13:21   ` [PATCH 4/4] rtc: stm32: get DBP register and mask from DT st, syscfg property Amelie Delaunay
2018-04-19 13:21   ` [PATCH 4/4] rtc: stm32: get DBP register and mask from DT st,syscfg property Amelie Delaunay
2018-04-19 13:43 ` [PATCH 0/4] Various fixes on STM32 RTC Alexandre Belloni
2018-04-19 13:43   ` Alexandre Belloni
2018-04-19 14:14   ` Amelie DELAUNAY
2018-04-19 14:14     ` Amelie DELAUNAY
2018-05-06 20:27 ` Alexandre Belloni
2018-05-06 20:27   ` Alexandre Belloni

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.