Skip to contentSkip to conversation

Add support for SYSCON reset

PATCH Superseded Andrew F. Davis 3 participants 6 messages Mar 10, 2016 – Apr 5, 2016

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add support for SYSCON reset

Some SoCs contain reset controls for modules that are memory-mapped to areas shared with other module configuration settings. This requires synchronization across all drivers accessing this memory area. This series adds a generic SYSCON reset driver to allow resets toggled by bits in memory-mapped registers through SYSCON.

Changes from v1:
- Reset control information is now described in the reset node, this keeps the reset information centralized for easy verification
- Other small fixups

Andrew F. Davis (2):
Documentation: dt: reset: Add syscon reset binding
reset: add a SYSCON based reset driver

 .../devicetree/bindings/reset/syscon-reset.txt     | 114 +++++++++
 drivers/reset/Kconfig                              |  10 +
 drivers/reset/Makefile                             |   1 +
 drivers/reset/reset-syscon.c                       | 283 +++++++++++++++++++++
 include/dt-bindings/reset/syscon.h                 |  23 ++
 5 files changed, 431 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/syscon-reset.txt
 create mode 100644 drivers/reset/reset-syscon.c
 create mode 100644 include/dt-bindings/reset/syscon.h
Signature · 6 lines
2.7.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

PATCH v2 1/2 Documentation: dt: reset: Add syscon reset binding

Add syscon reset controller binding. This will hook to the reset framework and use syscon/regmap to set reset bits. This allows reset control of individual SoC subsytems and devices with memory-mapped reset registers in a common register memory space.

[[email protected]: revise the binding format]
---
 .../devicetree/bindings/reset/syscon-reset.txt     | 114 +++++++++++++++++++++
 include/dt-bindings/reset/syscon.h                 |  23 +++++
 2 files changed, 137 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/syscon-reset.txt
 create mode 100644 include/dt-bindings/reset/syscon.h
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +114 -0
new file mode 100644
index 0000000..02bc9e3
@@ -0,0 +1,114 @@
+SysCon Reset Controller
+=======================
+
+Almost all SoCs have hardware modules that require reset control in addition
+to clock and power control for their functionality. The reset control is
+typically provided by means of memory-mapped I/O registers. These registers are
+sometimes a part of a larger register space region implementing various
+functionalities. This register range is best represented as a syscon node to
+allow multiple entities to access their relevant registers in the common
+register space.
+
+A SysCon Reset Controller node defines a device that uses a syscon node
+and provides reset management functionality for various hardware modules
+present on the SoC.
+
+SysCon Reset Controller Node
+============================
+Each of the reset provider/controller nodes should be a child of a syscon
+node and have the following properties.
+
+Required properties:
+--------------------
+ - compatible		: Should be "syscon-reset"
+ - #reset-cells		: Should be 1. Please see the reset consumer node below
+			  for usage details
+ - #address-cells	: Should be 1
+ - #size-cells		: Should be 0
+
+SysCon Reset Child Node
+============================
+Each reset provider/controller node should have a child node for each reset
+it would like to expose to consumers.
+
+Required properties:
+--------------------
+ - reg			: This reset's number, this will be used to reference
+			  this reset by consumers of this reset
+ - reset-control	: Contains the reset control register information
+			  Should contain 3 cells defined as:
+			    Cell #1 : register offset of the reset
+			              control/status register from the syscon
+			              register base
+			    Cell #2 : bit shift value for the reset in the
+			              respective reset control/status register
+			    Cell #3 : polarity of the reset bit. Should be 1 or
+				      RESET_ASSERT_SET for resets that are
+				      asserted when the bit is set, 0 or
+				      RESET_ASSERT_CLEAR for resets that are
+				      asserted when the bit is cleared
+
+Optional properties:
+--------------------
+ - reset-status		: Contains the reset status register information. The
+			  contents of this property are the equivalent to
+			  reset-control as defined above. If this property is
+			  not present and the toggle flag is not set, the
+			  reset register is assumed to be the same as the
+			  control register
+ - toggle		: Mark this reset as a toggle only reset, this is used
+			  when no status register is available.
+
+SysCon Reset Consumer Nodes
+===========================
+Each of the reset consumer nodes should have the following properties,
+in addition to their own properties.
+
+Required properties:
+--------------------
+ - resets	: A phandle and a reset specifier, the reset specifier should
+		  be a numerical address matching the desired reset as set
+		  by the reg property defined above.
+
+Please also refer to Documentation/devicetree/bindings/reset/reset.txt for
+common reset controller usage by consumers.
+
+Example:
+--------
+The following example demonstrates a syscon node, the reset controller node
+using the syscon node, and a consumer (a DSP device) on the TI Keystone 2
+Hawking SoC.
+
+/ {
+	soc {
+		psc: power-sleep-controller@02350000 {
+			compatible = "syscon", "simple-mfd";
+			reg = <0x02350000 0x1000>;
+
+			pscrst: psc-reset {
+				compatible = "syscon-reset";
+				#reset-cells = <1>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				dsp@0 {
+					reg = <0>;
+					reset-control = <0xa3c 8 RESET_ASSERT_CLEAR>;
+					reset-status = <0x83c 8 RESET_ASSERT_CLEAR>;
+				};
+
+				imu@1 {
+					reg = <1>;
+					reset-control = <0xa40 5 RESET_ASSERT_SET>;
+					toggle;
+				};
+			};
+		};
+
+		dsp0: dsp0 {
+			...
+			resets = <&pscrst 0>;
+			...
+		};
+	};
+};
include/dt-bindings/reset/syscon.h new file +23 -0
new file mode 100644
index 0000000..9927779
@@ -0,0 +1,23 @@
+/*
+ * Syscon Reset definitions
+ *
+ * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __DT_BINDINGS_RESET_SYSCON_H__
+#define __DT_BINDINGS_RESET_SYSCON_H__
+
+#define RESET_ASSERT_CLEAR	0x0
+#define RESET_ASSERT_SET	0x1
+
+#endif
Signature · 1 line
2.7.2
maintainer
#2 lore raw

Re: [PATCH v2 1/2] Documentation: dt: reset: Add syscon reset binding

Quoted 44 lines · Andrew F. Davis

Add syscon reset controller binding. This will hook to the reset framework and use syscon/regmap to set reset bits. This allows reset control of individual SoC subsytems and devices with memory-mapped reset registers in a common register memory space.

[[email protected]: revise the binding format]
---
 .../devicetree/bindings/reset/syscon-reset.txt     | 114 +++++++++++++++++++++
 include/dt-bindings/reset/syscon.h                 |  23 +++++
 2 files changed, 137 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/syscon-reset.txt
 create mode 100644 include/dt-bindings/reset/syscon.h
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +22 -0
new file mode 100644
index 0000000..02bc9e3
@@ -0,0 +1,114 @@
+SysCon Reset Controller
+=======================
+
+Almost all SoCs have hardware modules that require reset control in addition
+to clock and power control for their functionality. The reset control is
+typically provided by means of memory-mapped I/O registers. These registers are
+sometimes a part of a larger register space region implementing various
+functionalities. This register range is best represented as a syscon node to
+allow multiple entities to access their relevant registers in the common
+register space.
+
+A SysCon Reset Controller node defines a device that uses a syscon node
+and provides reset management functionality for various hardware modules
+present on the SoC.
+
+SysCon Reset Controller Node
+============================
+Each of the reset provider/controller nodes should be a child of a syscon
+node and have the following properties.
+
+Required properties:
+--------------------

Documentation/devicetree/bindings/reset/syscon-reset.txt line 32

Quoted 10 lines
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +10 -0
+ - compatible		: Should be "syscon-reset"
+ - #reset-cells		: Should be 1. Please see the reset consumer node below
+			  for usage details
+ - #address-cells	: Should be 1
+ - #size-cells		: Should be 0
+
+SysCon Reset Child Node
+============================
+Each reset provider/controller node should have a child node for each reset
+it would like to expose to consumers.

A node per register bit... Now I'm only more convinced this is too low level.

Documentation/devicetree/bindings/reset/syscon-reset.txt line 37

Quoted 5 lines
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +5 -0
+
+Required properties:
+--------------------
+ - reg			: This reset's number, this will be used to reference
+			  this reset by consumers of this reset

Now you have a made up index unrelated to anything in the h/w. Sometimes that's unavoidable, but your prior version did.

Quoted 23 lines
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +23 -0
+ - reset-control	: Contains the reset control register information
+			  Should contain 3 cells defined as:
+			    Cell #1 : register offset of the reset
+			              control/status register from the syscon
+			              register base
+			    Cell #2 : bit shift value for the reset in the
+			              respective reset control/status register
+			    Cell #3 : polarity of the reset bit. Should be 1 or
+				      RESET_ASSERT_SET for resets that are
+				      asserted when the bit is set, 0 or
+				      RESET_ASSERT_CLEAR for resets that are
+				      asserted when the bit is cleared
+
+Optional properties:
+--------------------
+ - reset-status		: Contains the reset status register information. The
+			  contents of this property are the equivalent to
+			  reset-control as defined above. If this property is
+			  not present and the toggle flag is not set, the
+			  reset register is assumed to be the same as the
+			  control register
+ - toggle		: Mark this reset as a toggle only reset, this is used
+			  when no status register is available.
#3 lore raw

Re: [PATCH v2 1/2] Documentation: dt: reset: Add syscon reset binding

Hi Rob,

Quoted 50 lines · Rob Herring
Quoted 49 lines · Andrew F. Davis

Add syscon reset controller binding. This will hook to the reset framework and use syscon/regmap to set reset bits. This allows reset control of individual SoC subsytems and devices with memory-mapped reset registers in a common register memory space.

[[email protected]: revise the binding format]
---
 .../devicetree/bindings/reset/syscon-reset.txt     | 114 +++++++++++++++++++++
 include/dt-bindings/reset/syscon.h                 |  23 +++++
 2 files changed, 137 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/syscon-reset.txt
 create mode 100644 include/dt-bindings/reset/syscon.h
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +27 -0
new file mode 100644
index 0000000..02bc9e3
@@ -0,0 +1,114 @@
+SysCon Reset Controller
+=======================
+
+Almost all SoCs have hardware modules that require reset control in addition
+to clock and power control for their functionality. The reset control is
+typically provided by means of memory-mapped I/O registers. These registers are
+sometimes a part of a larger register space region implementing various
+functionalities. This register range is best represented as a syscon node to
+allow multiple entities to access their relevant registers in the common
+register space.
+
+A SysCon Reset Controller node defines a device that uses a syscon node
+and provides reset management functionality for various hardware modules
+present on the SoC.
+
+SysCon Reset Controller Node
+============================
+Each of the reset provider/controller nodes should be a child of a syscon
+node and have the following properties.
+
+Required properties:
+--------------------
+ - compatible		: Should be "syscon-reset"
+ - #reset-cells		: Should be 1. Please see the reset consumer node below
+			  for usage details
+ - #address-cells	: Should be 1
+ - #size-cells		: Should be 0
Quoted 8 lines

Documentation/devicetree/bindings/reset/syscon-reset.txt line 32

Quoted 5 lines
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +5 -0
+
+SysCon Reset Child Node
+============================
+Each reset provider/controller node should have a child node for each reset
+it would like to expose to consumers.

A node per register bit... Now I'm only more convinced this is too low level.

Thanks for the review/comments. So, what's your recommendation here - add the reset info to driver match data and use SoC-specific compatibles? That will also work, we just didn't go that route as it appeared to be adding hardware data to a driver.

Quoted 8 lines

Documentation/devicetree/bindings/reset/syscon-reset.txt line 37

Quoted 5 lines
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +5 -0
+
+Required properties:
+--------------------
+ - reg			: This reset's number, this will be used to reference
+			  this reset by consumers of this reset

Now you have a made up index unrelated to anything in the h/w. Sometimes that's unavoidable, but your prior version did.

We have made this change to avoid adding the reset data in the consumer nodes as was done in v1, and provide it in the controller node itself. We still need a way for consumers to match a specific reset. This is unavoidable if the controller were to encode all the reset data (even if we go with coding up the resets in the driver using SoC-specific compatibles, and use a dt-include header file to mark the indices).

regards
Suman

Quoted 16 lines
Quoted 16 lines
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +15 -0
+ - reset-control	: Contains the reset control register information
+			  Should contain 3 cells defined as:
+			    Cell #1 : register offset of the reset
+			              control/status register from the syscon
+			              register base
+			    Cell #2 : bit shift value for the reset in the
+			              respective reset control/status register
+			    Cell #3 : polarity of the reset bit. Should be 1 or
+				      RESET_ASSERT_SET for resets that are
+				      asserted when the bit is set, 0 or
+				      RESET_ASSERT_CLEAR for resets that are
+				      asserted when the bit is cleared
+
+Optional properties:
+--------------------
Quoted 9 lines

Documentation/devicetree/bindings/reset/syscon-reset.txt line 60

Quoted 8 lines
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +8 -0
+ - reset-status		: Contains the reset status register information. The
+			  contents of this property are the equivalent to
+			  reset-control as defined above. If this property is
+			  not present and the toggle flag is not set, the
+			  reset register is assumed to be the same as the
+			  control register
+ - toggle		: Mark this reset as a toggle only reset, this is used
+			  when no status register is available.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH v2 1/2] Documentation: dt: reset: Add syscon reset binding

Quoted 76 lines · Suman Anna

Hi Rob,

Quoted 50 lines · Rob Herring
Quoted 49 lines · Andrew F. Davis

Add syscon reset controller binding. This will hook to the reset framework and use syscon/regmap to set reset bits. This allows reset control of individual SoC subsytems and devices with memory-mapped reset registers in a common register memory space.

[[email protected]: revise the binding format]
---
 .../devicetree/bindings/reset/syscon-reset.txt     | 114 +++++++++++++++++++++
 include/dt-bindings/reset/syscon.h                 |  23 +++++
 2 files changed, 137 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/syscon-reset.txt
 create mode 100644 include/dt-bindings/reset/syscon.h
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +27 -0
new file mode 100644
index 0000000..02bc9e3
@@ -0,0 +1,114 @@
+SysCon Reset Controller
+=======================
+
+Almost all SoCs have hardware modules that require reset control in addition
+to clock and power control for their functionality. The reset control is
+typically provided by means of memory-mapped I/O registers. These registers are
+sometimes a part of a larger register space region implementing various
+functionalities. This register range is best represented as a syscon node to
+allow multiple entities to access their relevant registers in the common
+register space.
+
+A SysCon Reset Controller node defines a device that uses a syscon node
+and provides reset management functionality for various hardware modules
+present on the SoC.
+
+SysCon Reset Controller Node
+============================
+Each of the reset provider/controller nodes should be a child of a syscon
+node and have the following properties.
+
+Required properties:
+--------------------
+ - compatible		: Should be "syscon-reset"
+ - #reset-cells		: Should be 1. Please see the reset consumer node below
+			  for usage details
+ - #address-cells	: Should be 1
+ - #size-cells		: Should be 0
Quoted 8 lines

Documentation/devicetree/bindings/reset/syscon-reset.txt line 32

Quoted 5 lines
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +5 -0
+
+SysCon Reset Child Node
+============================
+Each reset provider/controller node should have a child node for each reset
+it would like to expose to consumers.

A node per register bit... Now I'm only more convinced this is too low level.

Thanks for the review/comments. So, what's your recommendation here - add the reset info to driver match data and use SoC-specific compatibles? That will also work, we just didn't go that route as it appeared to be adding hardware data to a driver.

Quoted 8 lines

Documentation/devicetree/bindings/reset/syscon-reset.txt line 37

Quoted 5 lines
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +5 -0
+
+Required properties:
+--------------------
+ - reg			: This reset's number, this will be used to reference
+			  this reset by consumers of this reset

Now you have a made up index unrelated to anything in the h/w. Sometimes that's unavoidable, but your prior version did.

Quoted 6 lines

We have made this change to avoid adding the reset data in the consumer nodes as was done in v1, and provide it in the controller node itself. We still need a way for consumers to match a specific reset. This is unavoidable if the controller were to encode all the reset data (even if we go with coding up the resets in the driver using SoC-specific compatibles, and use a dt-include header file to mark the indices).

Hi Rob, Philipp,

Any more comments on this series? If you don't have any, we will repost with some minor cleanups/updates against 4.6-rc1 for the next merge window. Or do you feel that the generic driver is still not the way to go and restrict this to a keystone specific driver?

regards
Suman

Quoted 30 lines

regards
Suman

Quoted 25 lines
Quoted 24 lines
Documentation/devicetree/bindings/reset/syscon-reset.txt new file +23 -0
+ - reset-control	: Contains the reset control register information
+			  Should contain 3 cells defined as:
+			    Cell #1 : register offset of the reset
+			              control/status register from the syscon
+			              register base
+			    Cell #2 : bit shift value for the reset in the
+			              respective reset control/status register
+			    Cell #3 : polarity of the reset bit. Should be 1 or
+				      RESET_ASSERT_SET for resets that are
+				      asserted when the bit is set, 0 or
+				      RESET_ASSERT_CLEAR for resets that are
+				      asserted when the bit is cleared
+
+Optional properties:
+--------------------
+ - reset-status		: Contains the reset status register information. The
+			  contents of this property are the equivalent to
+			  reset-control as defined above. If this property is
+			  not present and the toggle flag is not set, the
+			  reset register is assumed to be the same as the
+			  control register
+ - toggle		: Mark this reset as a toggle only reset, this is used
+			  when no status register is available.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

PATCH v2 2/2 reset: add a SYSCON based reset driver

In reply to Andrew F. Davis

Add a reset-controller driver for performing reset management of various devices present on the SoC, with the reset registers shared between devices in a common register memory space. This driver uses the syscon/regmap frameworks to actually implement the various reset functionalities needed by the reset consumer devices.

[[email protected]: add documentation, syscon name change]
---
 drivers/reset/Kconfig        |  10 ++
 drivers/reset/Makefile       |   1 +
 drivers/reset/reset-syscon.c | 283 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 294 insertions(+)
 create mode 100644 drivers/reset/reset-syscon.c
drivers/reset/Kconfig +10 -0
index df37212..5f26755 100644
@@ -12,5 +12,15 @@ menuconfig RESET_CONTROLLER
 
 	  If unsure, say no.
 
+config SYSCON_RESET
+	tristate "SYSCON Reset Driver"
+	depends on RESET_CONTROLLER
+	select MFD_SYSCON
+	help
+	  This enables the reset driver support for devices with memory-mapped
+	  reset registers as part of a syscon device node. If you wish to use
+	  the reset framework for such memory-mapped devices, say Y here.
+	  Otherwise, say N.
+
 source "drivers/reset/sti/Kconfig"
 source "drivers/reset/hisilicon/Kconfig"
drivers/reset/Makefile +1 -0
index 4d7178e..6b3f6e3 100644
@@ -7,3 +7,4 @@ obj-$(CONFIG_ARCH_STI) += sti/
 obj-$(CONFIG_ARCH_HISI) += hisilicon/
 obj-$(CONFIG_ARCH_ZYNQ) += reset-zynq.o
 obj-$(CONFIG_ATH79) += reset-ath79.o
+obj-$(CONFIG_SYSCON_RESET) += reset-syscon.o
drivers/reset/reset-syscon.c new file +283 -0

283 lines not on this page · raw message

Signature · 1 line
2.7.2