linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5
@ 2022-06-10  9:24 Claudiu Beznea
  2022-06-10  9:24 ` [PATCH v5 1/9] ARM: dts: at91: use generic name for reset controller Claudiu Beznea
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Claudiu Beznea @ 2022-06-10  9:24 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, p.zabel, sre, robh+dt,
	krzysztof.kozlowski+dt
  Cc: linux-arm-kernel, linux-pm, devicetree, linux-kernel, Claudiu Beznea

Hi,

The series adds reset controller support for SAMA7G5 SoCs. Compared with
previous version the reset controller embedded on SAMA7G5 is able to
reset individual on SoC devices (e.g. USB PHY controllers).

Among with this I took the change and converted reset controller
bindings to YAML (patch 2/9) and adapt reset controller nodes in
device tree files to comply with DT specifications (patch 1/9).

Thank you,
Claudiu Beznea

Changes in v5:
- in patch 6/9 added device_reset_min_id, device_reset_max_id to
  struct at91_reset_data; these will be used in at91_reset_of_xlate()
  (patch 7/9) allowing expansion of device reset code for future
  devices; with this member of type const struct at91_reset_data *
  has been added to struct at91_reset and at91_rcdev_init() gets
  now only 2 arguments.
- in patch 8/9 use filled .device_reset_min_id, .device_reset_max_id
- in patch 6/9 use device_get_match_data()
- collected tags

Changes in v4:
- removed patch 10/10 from v3 as it has been taken though at91 tree

Changes in v3:
- use spin_lock_irqsave()/spin_unlock_irqrestore() and lock only
  on update path
- collected tags

Changes in v2:
- added patches 5/10 and 10/10
- in patch 2/10 use my microchip email address
- in patch 4/10 added "SAMA7G5_" in front of macros to cope with file
  naming and used (GPL-2.0-only OR BSD-2-Clause)
- in patch 6/10 documented the structure's members
- in patch 7/10:
	- protect access to reset->dev_base with spin lock
	- check for valid values of reset_spec->args[0] in
	  at91_reset_of_xlate()
	- s/if (IS_ERR(reset->rstc_base))/if (IS_ERR(reset->dev_base))
	- include dt-bindings/reset/sama7g5-reset.h
	- document new added structure's members
- collected tags

Claudiu Beznea (9):
  ARM: dts: at91: use generic name for reset controller
  dt-bindings: reset: convert Atmel/Microchip reset controller to YAML
  dt-bindings: reset: atmel,at91sam9260-reset: add sama7g5 bindings
  dt-bindings: reset: add sama7g5 definitions
  power: reset: at91-reset: document structures and enums
  power: reset: at91-reset: add at91_reset_data
  power: reset: at91-reset: add reset_controller_dev support
  power: reset: at91-reset: add support for SAMA7G5
  ARM: dts: at91: sama7g5: add reset-controller node

 .../devicetree/bindings/arm/atmel-sysregs.txt |  15 --
 .../reset/atmel,at91sam9260-reset.yaml        |  68 +++++++
 arch/arm/boot/dts/at91sam9260.dtsi            |   2 +-
 arch/arm/boot/dts/at91sam9261.dtsi            |   2 +-
 arch/arm/boot/dts/at91sam9263.dtsi            |   2 +-
 arch/arm/boot/dts/at91sam9g45.dtsi            |   2 +-
 arch/arm/boot/dts/at91sam9n12.dtsi            |   2 +-
 arch/arm/boot/dts/at91sam9rl.dtsi             |   2 +-
 arch/arm/boot/dts/at91sam9x5.dtsi             |   2 +-
 arch/arm/boot/dts/sam9x60.dtsi                |   2 +-
 arch/arm/boot/dts/sama5d2.dtsi                |   2 +-
 arch/arm/boot/dts/sama5d3.dtsi                |   2 +-
 arch/arm/boot/dts/sama5d4.dtsi                |   2 +-
 arch/arm/boot/dts/sama7g5.dtsi                |   7 +
 drivers/power/reset/at91-reset.c              | 184 ++++++++++++++++--
 include/dt-bindings/reset/sama7g5-reset.h     |  10 +
 16 files changed, 265 insertions(+), 41 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/reset/atmel,at91sam9260-reset.yaml
 create mode 100644 include/dt-bindings/reset/sama7g5-reset.h

-- 
2.34.1


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

* [PATCH v5 1/9] ARM: dts: at91: use generic name for reset controller
  2022-06-10  9:24 [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Claudiu Beznea
@ 2022-06-10  9:24 ` Claudiu Beznea
  2022-07-04  6:47   ` Claudiu.Beznea
  2022-06-10  9:24 ` [PATCH v5 2/9] dt-bindings: reset: convert Atmel/Microchip reset controller to YAML Claudiu Beznea
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 13+ messages in thread
From: Claudiu Beznea @ 2022-06-10  9:24 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, p.zabel, sre, robh+dt,
	krzysztof.kozlowski+dt
  Cc: linux-arm-kernel, linux-pm, devicetree, linux-kernel,
	Claudiu Beznea, Krzysztof Kozlowski

Use generic name for reset controller of AT91 devices to comply with
DT specifications.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 arch/arm/boot/dts/at91sam9260.dtsi | 2 +-
 arch/arm/boot/dts/at91sam9261.dtsi | 2 +-
 arch/arm/boot/dts/at91sam9263.dtsi | 2 +-
 arch/arm/boot/dts/at91sam9g45.dtsi | 2 +-
 arch/arm/boot/dts/at91sam9n12.dtsi | 2 +-
 arch/arm/boot/dts/at91sam9rl.dtsi  | 2 +-
 arch/arm/boot/dts/at91sam9x5.dtsi  | 2 +-
 arch/arm/boot/dts/sam9x60.dtsi     | 2 +-
 arch/arm/boot/dts/sama5d2.dtsi     | 2 +-
 arch/arm/boot/dts/sama5d3.dtsi     | 2 +-
 arch/arm/boot/dts/sama5d4.dtsi     | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index 7368347c9357..9d9820db9482 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -123,7 +123,7 @@ pmc: pmc@fffffc00 {
 				clock-names = "slow_xtal", "main_xtal";
 			};
 
-			rstc@fffffd00 {
+			reset-controller@fffffd00 {
 				compatible = "atmel,at91sam9260-rstc";
 				reg = <0xfffffd00 0x10>;
 				clocks = <&pmc PMC_TYPE_CORE PMC_SLOW>;
diff --git a/arch/arm/boot/dts/at91sam9261.dtsi b/arch/arm/boot/dts/at91sam9261.dtsi
index 7adc36ca8a46..259aca565305 100644
--- a/arch/arm/boot/dts/at91sam9261.dtsi
+++ b/arch/arm/boot/dts/at91sam9261.dtsi
@@ -603,7 +603,7 @@ pmc: pmc@fffffc00 {
 				clock-names = "slow_xtal", "main_xtal";
 			};
 
-			rstc@fffffd00 {
+			reset-controller@fffffd00 {
 				compatible = "atmel,at91sam9260-rstc";
 				reg = <0xfffffd00 0x10>;
 				clocks = <&slow_xtal>;
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index fe45d96239c9..c080df8c2312 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -151,7 +151,7 @@ tcb0: timer@fff7c000 {
 				clock-names = "t0_clk", "slow_clk";
 			};
 
-			rstc@fffffd00 {
+			reset-controller@fffffd00 {
 				compatible = "atmel,at91sam9260-rstc";
 				reg = <0xfffffd00 0x10>;
 				clocks = <&slow_xtal>;
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index 2ab730fd6472..09794561c7ce 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -137,7 +137,7 @@ pmc: pmc@fffffc00 {
 				clock-names = "slow_clk", "main_xtal";
 			};
 
-			rstc@fffffd00 {
+			reset-controller@fffffd00 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfffffd00 0x10>;
 				clocks = <&clk32k>;
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index 0785389f5507..556f35ce49e3 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -126,7 +126,7 @@ pmc: pmc@fffffc00 {
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
 			};
 
-			rstc@fffffe00 {
+			reset-controller@fffffe00 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfffffe00 0x10>;
 				clocks = <&clk32k>;
diff --git a/arch/arm/boot/dts/at91sam9rl.dtsi b/arch/arm/boot/dts/at91sam9rl.dtsi
index 730d1182c73e..12c634811820 100644
--- a/arch/arm/boot/dts/at91sam9rl.dtsi
+++ b/arch/arm/boot/dts/at91sam9rl.dtsi
@@ -766,7 +766,7 @@ pmc: pmc@fffffc00 {
 				clock-names = "slow_clk", "main_xtal";
 			};
 
-			rstc@fffffd00 {
+			reset-controller@fffffd00 {
 				compatible = "atmel,at91sam9260-rstc";
 				reg = <0xfffffd00 0x10>;
 				clocks = <&clk32k>;
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 395e883644cd..ea3b11336c79 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -134,7 +134,7 @@ pmc: pmc@fffffc00 {
 				clock-names = "slow_clk", "main_xtal";
 			};
 
-			reset_controller: rstc@fffffe00 {
+			reset_controller: reset-controller@fffffe00 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfffffe00 0x10>;
 				clocks = <&clk32k>;
diff --git a/arch/arm/boot/dts/sam9x60.dtsi b/arch/arm/boot/dts/sam9x60.dtsi
index c328b67bea0c..6b1d4492444a 100644
--- a/arch/arm/boot/dts/sam9x60.dtsi
+++ b/arch/arm/boot/dts/sam9x60.dtsi
@@ -667,7 +667,7 @@ pmc: pmc@fffffc00 {
 				clock-names = "td_slck", "md_slck", "main_xtal";
 			};
 
-			reset_controller: rstc@fffffe00 {
+			reset_controller: reset-controller@fffffe00 {
 				compatible = "microchip,sam9x60-rstc";
 				reg = <0xfffffe00 0x10>;
 				clocks = <&clk32k 0>;
diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
index 89c71d419f82..60977bfd8563 100644
--- a/arch/arm/boot/dts/sama5d2.dtsi
+++ b/arch/arm/boot/dts/sama5d2.dtsi
@@ -660,7 +660,7 @@ securam: sram@f8044000 {
 				ranges = <0 0xf8044000 0x1420>;
 			};
 
-			reset_controller: rstc@f8048000 {
+			reset_controller: reset-controller@f8048000 {
 				compatible = "atmel,sama5d3-rstc";
 				reg = <0xf8048000 0x10>;
 				clocks = <&clk32k>;
diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 8fa423c52592..2d0935ad2225 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -1003,7 +1003,7 @@ pmc: pmc@fffffc00 {
 				clock-names = "slow_clk", "main_xtal";
 			};
 
-			reset_controller: rstc@fffffe00 {
+			reset_controller: reset-controller@fffffe00 {
 				compatible = "atmel,sama5d3-rstc", "atmel,at91sam9g45-rstc";
 				reg = <0xfffffe00 0x10>;
 				clocks = <&clk32k>;
diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
index 7b9242664875..1e5c01898ccf 100644
--- a/arch/arm/boot/dts/sama5d4.dtsi
+++ b/arch/arm/boot/dts/sama5d4.dtsi
@@ -726,7 +726,7 @@ pmecc: ecc-engine@ffffc070 {
 				};
 			};
 
-			reset_controller: rstc@fc068600 {
+			reset_controller: reset-controller@fc068600 {
 				compatible = "atmel,sama5d3-rstc", "atmel,at91sam9g45-rstc";
 				reg = <0xfc068600 0x10>;
 				clocks = <&clk32k>;
-- 
2.34.1


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

* [PATCH v5 2/9] dt-bindings: reset: convert Atmel/Microchip reset controller to YAML
  2022-06-10  9:24 [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Claudiu Beznea
  2022-06-10  9:24 ` [PATCH v5 1/9] ARM: dts: at91: use generic name for reset controller Claudiu Beznea
@ 2022-06-10  9:24 ` Claudiu Beznea
  2022-06-10  9:24 ` [PATCH v5 3/9] dt-bindings: reset: atmel,at91sam9260-reset: add sama7g5 bindings Claudiu Beznea
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Claudiu Beznea @ 2022-06-10  9:24 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, p.zabel, sre, robh+dt,
	krzysztof.kozlowski+dt
  Cc: linux-arm-kernel, linux-pm, devicetree, linux-kernel,
	Claudiu Beznea, Rob Herring

Convert Atmel/Microchip reset controller to YAML.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 .../devicetree/bindings/arm/atmel-sysregs.txt | 15 ------
 .../reset/atmel,at91sam9260-reset.yaml        | 49 +++++++++++++++++++
 2 files changed, 49 insertions(+), 15 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/reset/atmel,at91sam9260-reset.yaml

diff --git a/Documentation/devicetree/bindings/arm/atmel-sysregs.txt b/Documentation/devicetree/bindings/arm/atmel-sysregs.txt
index 16eef600d599..ab1b352344ae 100644
--- a/Documentation/devicetree/bindings/arm/atmel-sysregs.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-sysregs.txt
@@ -25,21 +25,6 @@ System Timer (ST) required properties:
 Its subnodes can be:
 - watchdog: compatible should be "atmel,at91rm9200-wdt"
 
-RSTC Reset Controller required properties:
-- compatible: Should be "atmel,<chip>-rstc".
-  <chip> can be "at91sam9260", "at91sam9g45", "sama5d3" or "samx7"
-  it also can be "microchip,sam9x60-rstc"
-- reg: Should contain registers location and length
-- clocks: phandle to input clock.
-
-Example:
-
-	rstc@fffffd00 {
-		compatible = "atmel,at91sam9260-rstc";
-		reg = <0xfffffd00 0x10>;
-		clocks = <&clk32k>;
-	};
-
 RAMC SDRAM/DDR Controller required properties:
 - compatible: Should be "atmel,at91rm9200-sdramc", "syscon"
 			"atmel,at91sam9260-sdramc",
diff --git a/Documentation/devicetree/bindings/reset/atmel,at91sam9260-reset.yaml b/Documentation/devicetree/bindings/reset/atmel,at91sam9260-reset.yaml
new file mode 100644
index 000000000000..34c40b875e20
--- /dev/null
+++ b/Documentation/devicetree/bindings/reset/atmel,at91sam9260-reset.yaml
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/reset/atmel,at91sam9260-reset.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel/Microchip System Reset Controller
+
+maintainers:
+  - Claudiu Beznea <claudiu.beznea@microchip.com>
+
+description: |
+  The system reset controller can be used to reset the CPU.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - atmel,at91sam9260-rstc
+              - atmel,at91sam9g45-rstc
+              - atmel,sama5d3-rstc
+              - microchip,sam9x60-rstc
+      - items:
+          - const: atmel,sama5d3-rstc
+          - const: atmel,at91sam9g45-rstc
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/at91.h>
+
+    reset-controller@fffffd00 {
+        compatible = "atmel,at91sam9260-rstc";
+        reg = <0xfffffd00 0x10>;
+        clocks = <&pmc PMC_TYPE_CORE PMC_SLOW>;
+    };
-- 
2.34.1


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

* [PATCH v5 3/9] dt-bindings: reset: atmel,at91sam9260-reset: add sama7g5 bindings
  2022-06-10  9:24 [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Claudiu Beznea
  2022-06-10  9:24 ` [PATCH v5 1/9] ARM: dts: at91: use generic name for reset controller Claudiu Beznea
  2022-06-10  9:24 ` [PATCH v5 2/9] dt-bindings: reset: convert Atmel/Microchip reset controller to YAML Claudiu Beznea
@ 2022-06-10  9:24 ` Claudiu Beznea
  2022-06-10  9:24 ` [PATCH v5 4/9] dt-bindings: reset: add sama7g5 definitions Claudiu Beznea
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Claudiu Beznea @ 2022-06-10  9:24 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, p.zabel, sre, robh+dt,
	krzysztof.kozlowski+dt
  Cc: linux-arm-kernel, linux-pm, devicetree, linux-kernel,
	Claudiu Beznea, Rob Herring

Add documentation for SAMA7G5 reset controller. Compared with previous
versions of reset controllers this one contains support for resetting
in SoC devices (e.g. USB PHYs).

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 .../reset/atmel,at91sam9260-reset.yaml        | 23 +++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/reset/atmel,at91sam9260-reset.yaml b/Documentation/devicetree/bindings/reset/atmel,at91sam9260-reset.yaml
index 34c40b875e20..98465d26949e 100644
--- a/Documentation/devicetree/bindings/reset/atmel,at91sam9260-reset.yaml
+++ b/Documentation/devicetree/bindings/reset/atmel,at91sam9260-reset.yaml
@@ -10,7 +10,8 @@ maintainers:
   - Claudiu Beznea <claudiu.beznea@microchip.com>
 
 description: |
-  The system reset controller can be used to reset the CPU.
+  The system reset controller can be used to reset the CPU. In case of
+  SAMA7G5 it can also reset some devices (e.g. USB PHYs).
 
 properties:
   compatible:
@@ -21,21 +22,39 @@ properties:
               - atmel,at91sam9g45-rstc
               - atmel,sama5d3-rstc
               - microchip,sam9x60-rstc
+              - microchip,sama7g5-rstc
       - items:
           - const: atmel,sama5d3-rstc
           - const: atmel,at91sam9g45-rstc
 
   reg:
-    maxItems: 1
+    minItems: 1
+    items:
+      - description: base registers for system reset control
+      - description: registers for device specific reset control
 
   clocks:
     maxItems: 1
 
+  "#reset-cells":
+    const: 1
+
 required:
   - compatible
   - reg
   - clocks
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - microchip,sama7g5-rstc
+    then:
+      required:
+        - "#reset-cells"
+
 additionalProperties: false
 
 examples:
-- 
2.34.1


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

* [PATCH v5 4/9] dt-bindings: reset: add sama7g5 definitions
  2022-06-10  9:24 [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Claudiu Beznea
                   ` (2 preceding siblings ...)
  2022-06-10  9:24 ` [PATCH v5 3/9] dt-bindings: reset: atmel,at91sam9260-reset: add sama7g5 bindings Claudiu Beznea
@ 2022-06-10  9:24 ` Claudiu Beznea
  2022-06-10  9:24 ` [PATCH v5 5/9] power: reset: at91-reset: document structures and enums Claudiu Beznea
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Claudiu Beznea @ 2022-06-10  9:24 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, p.zabel, sre, robh+dt,
	krzysztof.kozlowski+dt
  Cc: linux-arm-kernel, linux-pm, devicetree, linux-kernel,
	Claudiu Beznea, Rob Herring

Add reset bindings for SAMA7G5. At the moment only USB PHYs are
included.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Rob Herring <robh@kernel.org>
---
 include/dt-bindings/reset/sama7g5-reset.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 include/dt-bindings/reset/sama7g5-reset.h

diff --git a/include/dt-bindings/reset/sama7g5-reset.h b/include/dt-bindings/reset/sama7g5-reset.h
new file mode 100644
index 000000000000..2116f41d04e0
--- /dev/null
+++ b/include/dt-bindings/reset/sama7g5-reset.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+
+#ifndef __DT_BINDINGS_RESET_SAMA7G5_H
+#define __DT_BINDINGS_RESET_SAMA7G5_H
+
+#define SAMA7G5_RESET_USB_PHY1		4
+#define SAMA7G5_RESET_USB_PHY2		5
+#define SAMA7G5_RESET_USB_PHY3		6
+
+#endif /* __DT_BINDINGS_RESET_SAMA7G5_H */
-- 
2.34.1


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

* [PATCH v5 5/9] power: reset: at91-reset: document structures and enums
  2022-06-10  9:24 [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Claudiu Beznea
                   ` (3 preceding siblings ...)
  2022-06-10  9:24 ` [PATCH v5 4/9] dt-bindings: reset: add sama7g5 definitions Claudiu Beznea
@ 2022-06-10  9:24 ` Claudiu Beznea
  2022-06-10  9:24 ` [PATCH v5 6/9] power: reset: at91-reset: add at91_reset_data Claudiu Beznea
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Claudiu Beznea @ 2022-06-10  9:24 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, p.zabel, sre, robh+dt,
	krzysztof.kozlowski+dt
  Cc: linux-arm-kernel, linux-pm, devicetree, linux-kernel, Claudiu Beznea

Document structures and enums.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/power/reset/at91-reset.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index 64def79d557a..e62798750b6b 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -39,6 +39,17 @@
 #define AT91_RSTC_URSTIEN	BIT(4)		/* User Reset Interrupt Enable */
 #define AT91_RSTC_ERSTL		GENMASK(11, 8)	/* External Reset Length */
 
+/**
+ * enum reset_type - reset types
+ * @RESET_TYPE_GENERAL:		first power-up reset
+ * @RESET_TYPE_WAKEUP:		return from backup mode
+ * @RESET_TYPE_WATCHDOG:	watchdog fault
+ * @RESET_TYPE_SOFTWARE:	processor reset required by software
+ * @RESET_TYPE_USER:		NRST pin detected low
+ * @RESET_TYPE_CPU_FAIL:	CPU clock failure detection
+ * @RESET_TYPE_XTAL_FAIL:	32KHz crystal failure dectection fault
+ * @RESET_TYPE_ULP2:		ULP2 reset
+ */
 enum reset_type {
 	RESET_TYPE_GENERAL	= 0,
 	RESET_TYPE_WAKEUP	= 1,
@@ -50,6 +61,15 @@ enum reset_type {
 	RESET_TYPE_ULP2		= 8,
 };
 
+/**
+ * struct at91_reset - AT91 reset specific data structure
+ * @rstc_base:		base address for system reset
+ * @ramc_base:		array with base addresses of RAM controllers
+ * @sclk:		slow clock
+ * @nb:			reset notifier block
+ * @args:		SoC specific system reset arguments
+ * @ramc_lpr:		SDRAM Controller Low Power Register
+ */
 struct at91_reset {
 	void __iomem *rstc_base;
 	void __iomem *ramc_base[2];
-- 
2.34.1


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

* [PATCH v5 6/9] power: reset: at91-reset: add at91_reset_data
  2022-06-10  9:24 [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Claudiu Beznea
                   ` (4 preceding siblings ...)
  2022-06-10  9:24 ` [PATCH v5 5/9] power: reset: at91-reset: document structures and enums Claudiu Beznea
@ 2022-06-10  9:24 ` Claudiu Beznea
  2022-06-10  9:24 ` [PATCH v5 7/9] power: reset: at91-reset: add reset_controller_dev support Claudiu Beznea
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Claudiu Beznea @ 2022-06-10  9:24 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, p.zabel, sre, robh+dt,
	krzysztof.kozlowski+dt
  Cc: linux-arm-kernel, linux-pm, devicetree, linux-kernel, Claudiu Beznea

Add struct at91_reset_data to keep per platform related information.
This is a prerequisite for adding reset_controller_dev support.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/power/reset/at91-reset.c | 45 ++++++++++++++++++++++++--------
 1 file changed, 34 insertions(+), 11 deletions(-)

diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index e62798750b6b..bb073aba816f 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -66,6 +66,7 @@ enum reset_type {
  * @rstc_base:		base address for system reset
  * @ramc_base:		array with base addresses of RAM controllers
  * @sclk:		slow clock
+ * @data:		platform specific reset data
  * @nb:			reset notifier block
  * @args:		SoC specific system reset arguments
  * @ramc_lpr:		SDRAM Controller Low Power Register
@@ -74,11 +75,26 @@ struct at91_reset {
 	void __iomem *rstc_base;
 	void __iomem *ramc_base[2];
 	struct clk *sclk;
+	const struct at91_reset_data *data;
 	struct notifier_block nb;
 	u32 args;
 	u32 ramc_lpr;
 };
 
+/**
+ * struct at91_reset_data - AT91 reset data
+ * @reset_args:			SoC specific system reset arguments
+ * @n_device_reset:		number of device resets
+ * @device_reset_min_id:	min id for device reset
+ * @device_reset_max_id:	max id for device reset
+ */
+struct at91_reset_data {
+	u32 reset_args;
+	u32 n_device_reset;
+	u8 device_reset_min_id;
+	u8 device_reset_max_id;
+};
+
 /*
 * unless the SDRAM is cleanly shutdown before we hit the
 * reset register it can be left driving the data bus and
@@ -115,7 +131,7 @@ static int at91_reset(struct notifier_block *this, unsigned long mode,
 		  "r" (reset->rstc_base),
 		  "r" (1),
 		  "r" cpu_to_le32(AT91_DDRSDRC_LPCB_POWER_DOWN),
-		  "r" (reset->args),
+		  "r" (reset->data->reset_args),
 		  "r" (reset->ramc_lpr)
 		: "r4");
 
@@ -173,29 +189,34 @@ static const struct of_device_id at91_ramc_of_match[] = {
 	{ /* sentinel */ }
 };
 
+static const struct at91_reset_data sam9260 = {
+	.reset_args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST,
+};
+
+static const struct at91_reset_data samx7 = {
+	.reset_args = AT91_RSTC_KEY | AT91_RSTC_PROCRST,
+};
+
 static const struct of_device_id at91_reset_of_match[] = {
 	{
 		.compatible = "atmel,at91sam9260-rstc",
-		.data = (void *)(AT91_RSTC_KEY | AT91_RSTC_PERRST |
-				 AT91_RSTC_PROCRST),
+		.data = &sam9260,
 	},
 	{
 		.compatible = "atmel,at91sam9g45-rstc",
-		.data = (void *)(AT91_RSTC_KEY | AT91_RSTC_PERRST |
-				 AT91_RSTC_PROCRST)
+		.data = &sam9260,
 	},
 	{
 		.compatible = "atmel,sama5d3-rstc",
-		.data = (void *)(AT91_RSTC_KEY | AT91_RSTC_PERRST |
-				 AT91_RSTC_PROCRST)
+		.data = &sam9260,
 	},
 	{
 		.compatible = "atmel,samx7-rstc",
-		.data = (void *)(AT91_RSTC_KEY | AT91_RSTC_PROCRST)
+		.data = &samx7,
 	},
 	{
 		.compatible = "microchip,sam9x60-rstc",
-		.data = (void *)(AT91_RSTC_KEY | AT91_RSTC_PROCRST)
+		.data = &samx7,
 	},
 	{ /* sentinel */ }
 };
@@ -232,10 +253,12 @@ static int __init at91_reset_probe(struct platform_device *pdev)
 		}
 	}
 
-	match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
+	reset->data = device_get_match_data(&pdev->dev);
+	if (!reset->data)
+		return -ENODEV;
+
 	reset->nb.notifier_call = at91_reset;
 	reset->nb.priority = 192;
-	reset->args = (u32)match->data;
 
 	reset->sclk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(reset->sclk))
-- 
2.34.1


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

* [PATCH v5 7/9] power: reset: at91-reset: add reset_controller_dev support
  2022-06-10  9:24 [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Claudiu Beznea
                   ` (5 preceding siblings ...)
  2022-06-10  9:24 ` [PATCH v5 6/9] power: reset: at91-reset: add at91_reset_data Claudiu Beznea
@ 2022-06-10  9:24 ` Claudiu Beznea
  2022-06-10  9:24 ` [PATCH v5 8/9] power: reset: at91-reset: add support for SAMA7G5 Claudiu Beznea
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Claudiu Beznea @ 2022-06-10  9:24 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, p.zabel, sre, robh+dt,
	krzysztof.kozlowski+dt
  Cc: linux-arm-kernel, linux-pm, devicetree, linux-kernel, Claudiu Beznea

SAMA7G5 reset controller has 5 extra lines that goes to different devices
(3 lines to USB PHYs, 1 line to DDR controller, 1 line to DDR PHY
controller). These reset lines could be requested by different controller
drivers (e.g. USB PHY driver) and these controllers' drivers could
assert/deassert these lines when necessary. Thus add support for
reset_controller_dev which brings this functionality.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/power/reset/at91-reset.c | 106 +++++++++++++++++++++++++++++--
 1 file changed, 102 insertions(+), 4 deletions(-)

diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index bb073aba816f..bc9f1d9e7867 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -17,6 +17,7 @@
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 #include <linux/reboot.h>
+#include <linux/reset-controller.h>
 
 #include <soc/at91/at91sam9_ddrsdr.h>
 #include <soc/at91/at91sam9_sdramc.h>
@@ -65,8 +66,11 @@ enum reset_type {
  * struct at91_reset - AT91 reset specific data structure
  * @rstc_base:		base address for system reset
  * @ramc_base:		array with base addresses of RAM controllers
+ * @dev_base:		base address for devices reset
  * @sclk:		slow clock
  * @data:		platform specific reset data
+ * @rcdev:		reset controller device
+ * @lock:		lock for devices reset register access
  * @nb:			reset notifier block
  * @args:		SoC specific system reset arguments
  * @ramc_lpr:		SDRAM Controller Low Power Register
@@ -74,13 +78,18 @@ enum reset_type {
 struct at91_reset {
 	void __iomem *rstc_base;
 	void __iomem *ramc_base[2];
+	void __iomem *dev_base;
 	struct clk *sclk;
 	const struct at91_reset_data *data;
+	struct reset_controller_dev rcdev;
+	spinlock_t lock;
 	struct notifier_block nb;
 	u32 args;
 	u32 ramc_lpr;
 };
 
+#define to_at91_reset(r)	container_of(r, struct at91_reset, rcdev)
+
 /**
  * struct at91_reset_data - AT91 reset data
  * @reset_args:			SoC specific system reset arguments
@@ -222,6 +231,89 @@ static const struct of_device_id at91_reset_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, at91_reset_of_match);
 
+static int at91_reset_update(struct reset_controller_dev *rcdev,
+			     unsigned long id, bool assert)
+{
+	struct at91_reset *reset = to_at91_reset(rcdev);
+	unsigned long flags;
+	u32 val;
+
+	spin_lock_irqsave(&reset->lock, flags);
+	val = readl_relaxed(reset->dev_base);
+	if (assert)
+		val |= BIT(id);
+	else
+		val &= ~BIT(id);
+	writel_relaxed(val, reset->dev_base);
+	spin_unlock_irqrestore(&reset->lock, flags);
+
+	return 0;
+}
+
+static int at91_reset_assert(struct reset_controller_dev *rcdev,
+			     unsigned long id)
+{
+	return at91_reset_update(rcdev, id, true);
+}
+
+static int at91_reset_deassert(struct reset_controller_dev *rcdev,
+			       unsigned long id)
+{
+	return at91_reset_update(rcdev, id, false);
+}
+
+static int at91_reset_dev_status(struct reset_controller_dev *rcdev,
+				 unsigned long id)
+{
+	struct at91_reset *reset = to_at91_reset(rcdev);
+	u32 val;
+
+	val = readl_relaxed(reset->dev_base);
+
+	return !!(val & BIT(id));
+}
+
+static const struct reset_control_ops at91_reset_ops = {
+	.assert = at91_reset_assert,
+	.deassert = at91_reset_deassert,
+	.status = at91_reset_dev_status,
+};
+
+static int at91_reset_of_xlate(struct reset_controller_dev *rcdev,
+			       const struct of_phandle_args *reset_spec)
+{
+	struct at91_reset *reset = to_at91_reset(rcdev);
+
+	if (!reset->data->n_device_reset ||
+	    (reset_spec->args[0] < reset->data->device_reset_min_id ||
+	     reset_spec->args[0] > reset->data->device_reset_max_id))
+		return -EINVAL;
+
+	return reset_spec->args[0];
+}
+
+static int at91_rcdev_init(struct at91_reset *reset,
+			   struct platform_device *pdev)
+{
+	if (!reset->data->n_device_reset)
+		return 0;
+
+	reset->dev_base = devm_of_iomap(&pdev->dev, pdev->dev.of_node, 1,
+					NULL);
+	if (IS_ERR(reset->dev_base))
+		return -ENODEV;
+
+	spin_lock_init(&reset->lock);
+	reset->rcdev.ops = &at91_reset_ops;
+	reset->rcdev.owner = THIS_MODULE;
+	reset->rcdev.of_node = pdev->dev.of_node;
+	reset->rcdev.nr_resets = reset->data->n_device_reset;
+	reset->rcdev.of_reset_n_cells = 1;
+	reset->rcdev.of_xlate = at91_reset_of_xlate;
+
+	return devm_reset_controller_register(&pdev->dev, &reset->rcdev);
+}
+
 static int __init at91_reset_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *match;
@@ -272,6 +364,10 @@ static int __init at91_reset_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, reset);
 
+	ret = at91_rcdev_init(reset, pdev);
+	if (ret)
+		goto disable_clk;
+
 	if (of_device_is_compatible(pdev->dev.of_node, "microchip,sam9x60-rstc")) {
 		u32 val = readl(reset->rstc_base + AT91_RSTC_MR);
 
@@ -280,14 +376,16 @@ static int __init at91_reset_probe(struct platform_device *pdev)
 	}
 
 	ret = register_restart_handler(&reset->nb);
-	if (ret) {
-		clk_disable_unprepare(reset->sclk);
-		return ret;
-	}
+	if (ret)
+		goto disable_clk;
 
 	at91_reset_status(pdev, reset->rstc_base);
 
 	return 0;
+
+disable_clk:
+	clk_disable_unprepare(reset->sclk);
+	return ret;
 }
 
 static int __exit at91_reset_remove(struct platform_device *pdev)
-- 
2.34.1


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

* [PATCH v5 8/9] power: reset: at91-reset: add support for SAMA7G5
  2022-06-10  9:24 [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Claudiu Beznea
                   ` (6 preceding siblings ...)
  2022-06-10  9:24 ` [PATCH v5 7/9] power: reset: at91-reset: add reset_controller_dev support Claudiu Beznea
@ 2022-06-10  9:24 ` Claudiu Beznea
  2022-06-10  9:24 ` [PATCH v5 9/9] ARM: dts: at91: sama7g5: add reset-controller node Claudiu Beznea
  2022-06-17 15:39 ` [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Sebastian Reichel
  9 siblings, 0 replies; 13+ messages in thread
From: Claudiu Beznea @ 2022-06-10  9:24 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, p.zabel, sre, robh+dt,
	krzysztof.kozlowski+dt
  Cc: linux-arm-kernel, linux-pm, devicetree, linux-kernel, Claudiu Beznea

Add support for SAMA7G5 including reset_controller_dev support for 3 lines
(which are USB PHYs).

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/power/reset/at91-reset.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index bc9f1d9e7867..741e44a017c3 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -22,6 +22,8 @@
 #include <soc/at91/at91sam9_ddrsdr.h>
 #include <soc/at91/at91sam9_sdramc.h>
 
+#include <dt-bindings/reset/sama7g5-reset.h>
+
 #define AT91_RSTC_CR	0x00		/* Reset Controller Control Register */
 #define AT91_RSTC_PROCRST	BIT(0)		/* Processor Reset */
 #define AT91_RSTC_PERRST	BIT(2)		/* Peripheral Reset */
@@ -206,6 +208,13 @@ static const struct at91_reset_data samx7 = {
 	.reset_args = AT91_RSTC_KEY | AT91_RSTC_PROCRST,
 };
 
+static const struct at91_reset_data sama7g5 = {
+	.reset_args = AT91_RSTC_KEY | AT91_RSTC_PROCRST,
+	.n_device_reset = 3,
+	.device_reset_min_id = SAMA7G5_RESET_USB_PHY1,
+	.device_reset_max_id = SAMA7G5_RESET_USB_PHY3,
+};
+
 static const struct of_device_id at91_reset_of_match[] = {
 	{
 		.compatible = "atmel,at91sam9260-rstc",
@@ -227,6 +236,10 @@ static const struct of_device_id at91_reset_of_match[] = {
 		.compatible = "microchip,sam9x60-rstc",
 		.data = &samx7,
 	},
+	{
+		.compatible = "microchip,sama7g5-rstc",
+		.data = &sama7g5,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, at91_reset_of_match);
-- 
2.34.1


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

* [PATCH v5 9/9] ARM: dts: at91: sama7g5: add reset-controller node
  2022-06-10  9:24 [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Claudiu Beznea
                   ` (7 preceding siblings ...)
  2022-06-10  9:24 ` [PATCH v5 8/9] power: reset: at91-reset: add support for SAMA7G5 Claudiu Beznea
@ 2022-06-10  9:24 ` Claudiu Beznea
  2022-07-04  6:47   ` Claudiu.Beznea
  2022-06-17 15:39 ` [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Sebastian Reichel
  9 siblings, 1 reply; 13+ messages in thread
From: Claudiu Beznea @ 2022-06-10  9:24 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, p.zabel, sre, robh+dt,
	krzysztof.kozlowski+dt
  Cc: linux-arm-kernel, linux-pm, devicetree, linux-kernel, Claudiu Beznea

Add reset controller node.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/boot/dts/sama7g5.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/sama7g5.dtsi b/arch/arm/boot/dts/sama7g5.dtsi
index a37e3a80392d..bb6d71e6dfeb 100644
--- a/arch/arm/boot/dts/sama7g5.dtsi
+++ b/arch/arm/boot/dts/sama7g5.dtsi
@@ -198,6 +198,13 @@ pmc: pmc@e0018000 {
 			clock-names = "td_slck", "md_slck", "main_xtal";
 		};
 
+		reset_controller: reset-controller@e001d000 {
+			compatible = "microchip,sama7g5-rstc";
+			reg = <0xe001d000 0xc>, <0xe001d0e4 0x4>;
+			#reset-cells = <1>;
+			clocks = <&clk32k 0>;
+		};
+
 		shdwc: shdwc@e001d010 {
 			compatible = "microchip,sama7g5-shdwc", "syscon";
 			reg = <0xe001d010 0x10>;
-- 
2.34.1


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

* Re: [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5
  2022-06-10  9:24 [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Claudiu Beznea
                   ` (8 preceding siblings ...)
  2022-06-10  9:24 ` [PATCH v5 9/9] ARM: dts: at91: sama7g5: add reset-controller node Claudiu Beznea
@ 2022-06-17 15:39 ` Sebastian Reichel
  9 siblings, 0 replies; 13+ messages in thread
From: Sebastian Reichel @ 2022-06-17 15:39 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: nicolas.ferre, alexandre.belloni, p.zabel, robh+dt,
	krzysztof.kozlowski+dt, linux-arm-kernel, linux-pm, devicetree,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2804 bytes --]

Hi,

On Fri, Jun 10, 2022 at 12:24:05PM +0300, Claudiu Beznea wrote:
> Hi,
> 
> The series adds reset controller support for SAMA7G5 SoCs. Compared with
> previous version the reset controller embedded on SAMA7G5 is able to
> reset individual on SoC devices (e.g. USB PHY controllers).
> 
> Among with this I took the change and converted reset controller
> bindings to YAML (patch 2/9) and adapt reset controller nodes in
> device tree files to comply with DT specifications (patch 1/9).
> 
> Thank you,
> Claudiu Beznea

Thanks, I queued patches 2-8 (i.e. skipping the DT patches). The DT
patches can go through the ARM tree. In case you plan to use the
dt-binding include I queued the patches via an immutable branch
that can be pulled into the ARM tree:

-----------------------------------------------------------------------------

The following changes since commit f2906aa863381afb0015a9eb7fefad885d4e5a56:

  Linux 5.19-rc1 (2022-06-05 17:18:54 -0700)

are available in the Git repository at:

  ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git tags/at91-reset-sama7g5-signed

for you to fetch changes up to a22c8e8834bcc55e44d0bae738f0915df7e6f573:

  power: reset: at91-reset: add support for SAMA7G5 (2022-06-17 17:20:00 +0200)

----------------------------------------------------------------
power: reset: at91-reset: add support for sama7g5

This adds reset controller support for SAMA7G5 SoCs. Compared with
previous version the reset controller embedded on SAMA7G5 is able to
reset individual on SoC devices (e.g. USB PHY controllers).

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

----------------------------------------------------------------
Claudiu Beznea (7):
      dt-bindings: reset: convert Atmel/Microchip reset controller to YAML
      dt-bindings: reset: atmel,at91sam9260-reset: add sama7g5 bindings
      dt-bindings: reset: add sama7g5 definitions
      power: reset: at91-reset: document structures and enums
      power: reset: at91-reset: add at91_reset_data
      power: reset: at91-reset: add reset_controller_dev support
      power: reset: at91-reset: add support for SAMA7G5

 .../devicetree/bindings/arm/atmel-sysregs.txt      |  15 --
 .../bindings/reset/atmel,at91sam9260-reset.yaml    |  68 ++++++++
 drivers/power/reset/at91-reset.c                   | 184 +++++++++++++++++++--
 include/dt-bindings/reset/sama7g5-reset.h          |  10 ++
 4 files changed, 247 insertions(+), 30 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/reset/atmel,at91sam9260-reset.yaml
 create mode 100644 include/dt-bindings/reset/sama7g5-reset.h

-----------------------------------------------------------------------------

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v5 1/9] ARM: dts: at91: use generic name for reset controller
  2022-06-10  9:24 ` [PATCH v5 1/9] ARM: dts: at91: use generic name for reset controller Claudiu Beznea
@ 2022-07-04  6:47   ` Claudiu.Beznea
  0 siblings, 0 replies; 13+ messages in thread
From: Claudiu.Beznea @ 2022-07-04  6:47 UTC (permalink / raw)
  To: Nicolas.Ferre, alexandre.belloni, p.zabel, sre, robh+dt,
	krzysztof.kozlowski+dt
  Cc: linux-arm-kernel, linux-pm, devicetree, linux-kernel,
	krzysztof.kozlowski

On 10.06.2022 12:24, Claudiu Beznea wrote:
> Use generic name for reset controller of AT91 devices to comply with
> DT specifications.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Applied to at91-dt, thanks!

> ---
>  arch/arm/boot/dts/at91sam9260.dtsi | 2 +-
>  arch/arm/boot/dts/at91sam9261.dtsi | 2 +-
>  arch/arm/boot/dts/at91sam9263.dtsi | 2 +-
>  arch/arm/boot/dts/at91sam9g45.dtsi | 2 +-
>  arch/arm/boot/dts/at91sam9n12.dtsi | 2 +-
>  arch/arm/boot/dts/at91sam9rl.dtsi  | 2 +-
>  arch/arm/boot/dts/at91sam9x5.dtsi  | 2 +-
>  arch/arm/boot/dts/sam9x60.dtsi     | 2 +-
>  arch/arm/boot/dts/sama5d2.dtsi     | 2 +-
>  arch/arm/boot/dts/sama5d3.dtsi     | 2 +-
>  arch/arm/boot/dts/sama5d4.dtsi     | 2 +-
>  11 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
> index 7368347c9357..9d9820db9482 100644
> --- a/arch/arm/boot/dts/at91sam9260.dtsi
> +++ b/arch/arm/boot/dts/at91sam9260.dtsi
> @@ -123,7 +123,7 @@ pmc: pmc@fffffc00 {
>  				clock-names = "slow_xtal", "main_xtal";
>  			};
>  
> -			rstc@fffffd00 {
> +			reset-controller@fffffd00 {
>  				compatible = "atmel,at91sam9260-rstc";
>  				reg = <0xfffffd00 0x10>;
>  				clocks = <&pmc PMC_TYPE_CORE PMC_SLOW>;
> diff --git a/arch/arm/boot/dts/at91sam9261.dtsi b/arch/arm/boot/dts/at91sam9261.dtsi
> index 7adc36ca8a46..259aca565305 100644
> --- a/arch/arm/boot/dts/at91sam9261.dtsi
> +++ b/arch/arm/boot/dts/at91sam9261.dtsi
> @@ -603,7 +603,7 @@ pmc: pmc@fffffc00 {
>  				clock-names = "slow_xtal", "main_xtal";
>  			};
>  
> -			rstc@fffffd00 {
> +			reset-controller@fffffd00 {
>  				compatible = "atmel,at91sam9260-rstc";
>  				reg = <0xfffffd00 0x10>;
>  				clocks = <&slow_xtal>;
> diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
> index fe45d96239c9..c080df8c2312 100644
> --- a/arch/arm/boot/dts/at91sam9263.dtsi
> +++ b/arch/arm/boot/dts/at91sam9263.dtsi
> @@ -151,7 +151,7 @@ tcb0: timer@fff7c000 {
>  				clock-names = "t0_clk", "slow_clk";
>  			};
>  
> -			rstc@fffffd00 {
> +			reset-controller@fffffd00 {
>  				compatible = "atmel,at91sam9260-rstc";
>  				reg = <0xfffffd00 0x10>;
>  				clocks = <&slow_xtal>;
> diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
> index 2ab730fd6472..09794561c7ce 100644
> --- a/arch/arm/boot/dts/at91sam9g45.dtsi
> +++ b/arch/arm/boot/dts/at91sam9g45.dtsi
> @@ -137,7 +137,7 @@ pmc: pmc@fffffc00 {
>  				clock-names = "slow_clk", "main_xtal";
>  			};
>  
> -			rstc@fffffd00 {
> +			reset-controller@fffffd00 {
>  				compatible = "atmel,at91sam9g45-rstc";
>  				reg = <0xfffffd00 0x10>;
>  				clocks = <&clk32k>;
> diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
> index 0785389f5507..556f35ce49e3 100644
> --- a/arch/arm/boot/dts/at91sam9n12.dtsi
> +++ b/arch/arm/boot/dts/at91sam9n12.dtsi
> @@ -126,7 +126,7 @@ pmc: pmc@fffffc00 {
>  				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
>  			};
>  
> -			rstc@fffffe00 {
> +			reset-controller@fffffe00 {
>  				compatible = "atmel,at91sam9g45-rstc";
>  				reg = <0xfffffe00 0x10>;
>  				clocks = <&clk32k>;
> diff --git a/arch/arm/boot/dts/at91sam9rl.dtsi b/arch/arm/boot/dts/at91sam9rl.dtsi
> index 730d1182c73e..12c634811820 100644
> --- a/arch/arm/boot/dts/at91sam9rl.dtsi
> +++ b/arch/arm/boot/dts/at91sam9rl.dtsi
> @@ -766,7 +766,7 @@ pmc: pmc@fffffc00 {
>  				clock-names = "slow_clk", "main_xtal";
>  			};
>  
> -			rstc@fffffd00 {
> +			reset-controller@fffffd00 {
>  				compatible = "atmel,at91sam9260-rstc";
>  				reg = <0xfffffd00 0x10>;
>  				clocks = <&clk32k>;
> diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
> index 395e883644cd..ea3b11336c79 100644
> --- a/arch/arm/boot/dts/at91sam9x5.dtsi
> +++ b/arch/arm/boot/dts/at91sam9x5.dtsi
> @@ -134,7 +134,7 @@ pmc: pmc@fffffc00 {
>  				clock-names = "slow_clk", "main_xtal";
>  			};
>  
> -			reset_controller: rstc@fffffe00 {
> +			reset_controller: reset-controller@fffffe00 {
>  				compatible = "atmel,at91sam9g45-rstc";
>  				reg = <0xfffffe00 0x10>;
>  				clocks = <&clk32k>;
> diff --git a/arch/arm/boot/dts/sam9x60.dtsi b/arch/arm/boot/dts/sam9x60.dtsi
> index c328b67bea0c..6b1d4492444a 100644
> --- a/arch/arm/boot/dts/sam9x60.dtsi
> +++ b/arch/arm/boot/dts/sam9x60.dtsi
> @@ -667,7 +667,7 @@ pmc: pmc@fffffc00 {
>  				clock-names = "td_slck", "md_slck", "main_xtal";
>  			};
>  
> -			reset_controller: rstc@fffffe00 {
> +			reset_controller: reset-controller@fffffe00 {
>  				compatible = "microchip,sam9x60-rstc";
>  				reg = <0xfffffe00 0x10>;
>  				clocks = <&clk32k 0>;
> diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> index 89c71d419f82..60977bfd8563 100644
> --- a/arch/arm/boot/dts/sama5d2.dtsi
> +++ b/arch/arm/boot/dts/sama5d2.dtsi
> @@ -660,7 +660,7 @@ securam: sram@f8044000 {
>  				ranges = <0 0xf8044000 0x1420>;
>  			};
>  
> -			reset_controller: rstc@f8048000 {
> +			reset_controller: reset-controller@f8048000 {
>  				compatible = "atmel,sama5d3-rstc";
>  				reg = <0xf8048000 0x10>;
>  				clocks = <&clk32k>;
> diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
> index 8fa423c52592..2d0935ad2225 100644
> --- a/arch/arm/boot/dts/sama5d3.dtsi
> +++ b/arch/arm/boot/dts/sama5d3.dtsi
> @@ -1003,7 +1003,7 @@ pmc: pmc@fffffc00 {
>  				clock-names = "slow_clk", "main_xtal";
>  			};
>  
> -			reset_controller: rstc@fffffe00 {
> +			reset_controller: reset-controller@fffffe00 {
>  				compatible = "atmel,sama5d3-rstc", "atmel,at91sam9g45-rstc";
>  				reg = <0xfffffe00 0x10>;
>  				clocks = <&clk32k>;
> diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
> index 7b9242664875..1e5c01898ccf 100644
> --- a/arch/arm/boot/dts/sama5d4.dtsi
> +++ b/arch/arm/boot/dts/sama5d4.dtsi
> @@ -726,7 +726,7 @@ pmecc: ecc-engine@ffffc070 {
>  				};
>  			};
>  
> -			reset_controller: rstc@fc068600 {
> +			reset_controller: reset-controller@fc068600 {
>  				compatible = "atmel,sama5d3-rstc", "atmel,at91sam9g45-rstc";
>  				reg = <0xfc068600 0x10>;
>  				clocks = <&clk32k>;


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

* Re: [PATCH v5 9/9] ARM: dts: at91: sama7g5: add reset-controller node
  2022-06-10  9:24 ` [PATCH v5 9/9] ARM: dts: at91: sama7g5: add reset-controller node Claudiu Beznea
@ 2022-07-04  6:47   ` Claudiu.Beznea
  0 siblings, 0 replies; 13+ messages in thread
From: Claudiu.Beznea @ 2022-07-04  6:47 UTC (permalink / raw)
  To: Nicolas.Ferre, alexandre.belloni, p.zabel, sre, robh+dt,
	krzysztof.kozlowski+dt
  Cc: linux-arm-kernel, linux-pm, devicetree, linux-kernel

On 10.06.2022 12:24, Claudiu Beznea wrote:
> Add reset controller node.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Applied to at91-dt, thanks!

> ---
>  arch/arm/boot/dts/sama7g5.dtsi | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sama7g5.dtsi b/arch/arm/boot/dts/sama7g5.dtsi
> index a37e3a80392d..bb6d71e6dfeb 100644
> --- a/arch/arm/boot/dts/sama7g5.dtsi
> +++ b/arch/arm/boot/dts/sama7g5.dtsi
> @@ -198,6 +198,13 @@ pmc: pmc@e0018000 {
>  			clock-names = "td_slck", "md_slck", "main_xtal";
>  		};
>  
> +		reset_controller: reset-controller@e001d000 {
> +			compatible = "microchip,sama7g5-rstc";
> +			reg = <0xe001d000 0xc>, <0xe001d0e4 0x4>;
> +			#reset-cells = <1>;
> +			clocks = <&clk32k 0>;
> +		};
> +
>  		shdwc: shdwc@e001d010 {
>  			compatible = "microchip,sama7g5-shdwc", "syscon";
>  			reg = <0xe001d010 0x10>;


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

end of thread, other threads:[~2022-07-04  6:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10  9:24 [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Claudiu Beznea
2022-06-10  9:24 ` [PATCH v5 1/9] ARM: dts: at91: use generic name for reset controller Claudiu Beznea
2022-07-04  6:47   ` Claudiu.Beznea
2022-06-10  9:24 ` [PATCH v5 2/9] dt-bindings: reset: convert Atmel/Microchip reset controller to YAML Claudiu Beznea
2022-06-10  9:24 ` [PATCH v5 3/9] dt-bindings: reset: atmel,at91sam9260-reset: add sama7g5 bindings Claudiu Beznea
2022-06-10  9:24 ` [PATCH v5 4/9] dt-bindings: reset: add sama7g5 definitions Claudiu Beznea
2022-06-10  9:24 ` [PATCH v5 5/9] power: reset: at91-reset: document structures and enums Claudiu Beznea
2022-06-10  9:24 ` [PATCH v5 6/9] power: reset: at91-reset: add at91_reset_data Claudiu Beznea
2022-06-10  9:24 ` [PATCH v5 7/9] power: reset: at91-reset: add reset_controller_dev support Claudiu Beznea
2022-06-10  9:24 ` [PATCH v5 8/9] power: reset: at91-reset: add support for SAMA7G5 Claudiu Beznea
2022-06-10  9:24 ` [PATCH v5 9/9] ARM: dts: at91: sama7g5: add reset-controller node Claudiu Beznea
2022-07-04  6:47   ` Claudiu.Beznea
2022-06-17 15:39 ` [PATCH v5 0/9] power: reset: at91-reset: add support for sama7g5 Sebastian Reichel

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