diff mbox

[v4,1/2] Documentation: Add GPIO reset binding to reset binding documentation

Message ID 1397463709-19405-1-git-send-email-p.zabel@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Philipp Zabel April 14, 2014, 8:21 a.m. UTC
This patch adds documentation clarifying the reset GPIO bindings most
commonly in use (reset-gpios and <name>-reset-gpios properties).

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 Documentation/devicetree/bindings/reset/reset.txt | 26 +++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

Comments

Maxime Ripard April 17, 2014, 11:58 a.m. UTC | #1
On Mon, Apr 14, 2014 at 10:21:48AM +0200, Philipp Zabel wrote:
> This patch adds documentation clarifying the reset GPIO bindings most
> commonly in use (reset-gpios and <name>-reset-gpios properties).
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  Documentation/devicetree/bindings/reset/reset.txt | 26 +++++++++++++++++++++--
>  1 file changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/reset/reset.txt b/Documentation/devicetree/bindings/reset/reset.txt
> index 31db6ff..51f9e35 100644
> --- a/Documentation/devicetree/bindings/reset/reset.txt
> +++ b/Documentation/devicetree/bindings/reset/reset.txt
> @@ -2,8 +2,8 @@
>  
>  This binding is intended to represent the hardware reset signals present
>  internally in most IC (SoC, FPGA, ...) designs. Reset signals for whole
> -standalone chips are most likely better represented as GPIOs, although there
> -are likely to be exceptions to this rule.
> +standalone chips are most likely better represented as GPIOs, ideally using a
> +common scheme as described below.
>  
>  Hardware blocks typically receive a reset signal. This signal is generated by
>  a reset provider (e.g. power management or clock module) and received by a
> @@ -56,6 +56,20 @@ reset-names:	List of reset signal name strings sorted in the same order as
>  		the resets property. Consumers drivers will use reset-names to
>  		match reset signal names with reset specifiers.
>  
> += GPIO Reset consumers =
> +
> +For the common case of reset lines controlled by GPIOs, the GPIO binding
> +documented in devicetree/bindings/gpio/gpio.txt should be used:
> +
> +Required properties:
> +reset-gpios or		Reset GPIO using standard GPIO bindings,
> +<name>-reset-gpios:	optionally named to specify the reset line
> +
> +Optional properties:
> +reset-boot-asserted or		Boolean. If set, the corresponding reset is
> +<name>-reset-boot-asserted:	initially asserted and should be kept that way
> +				until released by the driver.
> +

I still feel like we should really treat gpios like just another reset
controller, ie. using the resets property.

I understand that you chose this pattern to be pretty much compatible
with what have been done so fare, bu I don't see how to fulfill that
goal completely, since most of the devices are actually using
reset-gpios, but some are using other names too (including
reset-gpio).

So if we can't be fully backward compatible, I don't see the benefit
of being inconsistent with how reset controllers are used in general,
and more globally on how gpios are tied for regulators for example.

That would also make reset-gpio a regular reset driver, instead of
adding logic to the core itself to handle this special case.

Maxime
Philipp Zabel April 30, 2014, 8:54 a.m. UTC | #2
Hi Maxime,

Am Donnerstag, den 17.04.2014, 13:58 +0200 schrieb Maxime Ripard:
> I still feel like we should really treat gpios like just another reset
> controller, ie. using the resets property.

I now feel like we really shouldn't. If we do anything but use the
generic gpio bindings for reset gpios, we might force every OS or
bootloader using the device tree to implement some kind of reset
controller framework, even for hardware that only has gpio resets.

> I understand that you chose this pattern to be pretty much compatible
> with what have been done so fare, bu I don't see how to fulfill that
> goal completely, since most of the devices are actually using
> reset-gpios, but some are using other names too (including
> reset-gpio).

Yes, that is a problem that applies to all gpios, not only to reset
gpios, though.

> So if we can't be fully backward compatible, I don't see the benefit
> of being inconsistent with how reset controllers are used in general,

See above.

> and more globally on how gpios are tied for regulators for example.

Reset controllers are rather more similar to gpio or interrupt
controllers. Those also have a number of entities per device node,
as opposed to regulators.

> That would also make reset-gpio a regular reset driver, instead of
> adding logic to the core itself to handle this special case.

Which is what I initially tried and moved away from.

regards
Philipp
Maxime Ripard April 30, 2014, 6:29 p.m. UTC | #3
On Wed, Apr 30, 2014 at 10:54:22AM +0200, Philipp Zabel wrote:
> Hi Maxime,
> 
> Am Donnerstag, den 17.04.2014, 13:58 +0200 schrieb Maxime Ripard:
> > I still feel like we should really treat gpios like just another reset
> > controller, ie. using the resets property.
> 
> I now feel like we really shouldn't. If we do anything but use the
> generic gpio bindings for reset gpios, we might force every OS or
> bootloader using the device tree to implement some kind of reset
> controller framework, even for hardware that only has gpio resets.

Well, we pretty much introduced that requirement already whenever we
got this framework in the first place.

You can now expect pretty much anything, even a CPU or a timer to have
a reset property, so you have to handle them anyway.

So I'd be much more in favor of consistency both with other frameworks
and within the reset framework itself.

> > I understand that you chose this pattern to be pretty much compatible
> > with what have been done so fare, bu I don't see how to fulfill that
> > goal completely, since most of the devices are actually using
> > reset-gpios, but some are using other names too (including
> > reset-gpio).
> 
> Yes, that is a problem that applies to all gpios, not only to reset
> gpios, though.

Indeed, but you're the only one I can think of that have tried to
factor the gpio handling in the framework after the facts. All the
other either have no standards and let the driver deal with it, or
have explicitly asked for a given property name.

> > So if we can't be fully backward compatible, I don't see the benefit
> > of being inconsistent with how reset controllers are used in general,
> 
> See above.
> 
> > and more globally on how gpios are tied for regulators for example.
> 
> Reset controllers are rather more similar to gpio or interrupt
> controllers. Those also have a number of entities per device node,
> as opposed to regulators.

Well, that depends on the bindings actually. The fact that the reset
controller can handle several reset lines is dependent of the
controller itself. And I believe we can say pretty much the same about
the regulators.

> > That would also make reset-gpio a regular reset driver, instead of
> > adding logic to the core itself to handle this special case.
> 
> Which is what I initially tried and moved away from.

Yeah, I know.

Overall, I'd very much like the DT maintainers to step in on
this. Especially after the discussion we had again yesterday about the
stable DT bindings things.

Stable DT bindings only works if the DT maintainers can do some
arbitration in this case.

Mark? Ping?
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/reset/reset.txt b/Documentation/devicetree/bindings/reset/reset.txt
index 31db6ff..51f9e35 100644
--- a/Documentation/devicetree/bindings/reset/reset.txt
+++ b/Documentation/devicetree/bindings/reset/reset.txt
@@ -2,8 +2,8 @@ 
 
 This binding is intended to represent the hardware reset signals present
 internally in most IC (SoC, FPGA, ...) designs. Reset signals for whole
-standalone chips are most likely better represented as GPIOs, although there
-are likely to be exceptions to this rule.
+standalone chips are most likely better represented as GPIOs, ideally using a
+common scheme as described below.
 
 Hardware blocks typically receive a reset signal. This signal is generated by
 a reset provider (e.g. power management or clock module) and received by a
@@ -56,6 +56,20 @@  reset-names:	List of reset signal name strings sorted in the same order as
 		the resets property. Consumers drivers will use reset-names to
 		match reset signal names with reset specifiers.
 
+= GPIO Reset consumers =
+
+For the common case of reset lines controlled by GPIOs, the GPIO binding
+documented in devicetree/bindings/gpio/gpio.txt should be used:
+
+Required properties:
+reset-gpios or		Reset GPIO using standard GPIO bindings,
+<name>-reset-gpios:	optionally named to specify the reset line
+
+Optional properties:
+reset-boot-asserted or		Boolean. If set, the corresponding reset is
+<name>-reset-boot-asserted:	initially asserted and should be kept that way
+				until released by the driver.
+
 For example:
 
 	device {
@@ -65,6 +79,14 @@  For example:
 
 This represents a device with a single reset signal named "reset".
 
+	device2 {
+		reset-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>;
+		reset-boot-asserted;
+	};
+
+This represents a device with a single reset signal, controlled
+by an active-low GPIO, which is initally kept in reset.
+
 	bus {
 		resets = <&rst 10> <&rst 11> <&rst 12> <&rst 11>;
 		reset-names = "i2s1", "i2s2", "dma", "mixer";