Commit 3a8e53e2 authored by Thierry Reding's avatar Thierry Reding Committed by Rob Herring
Browse files

dt-bindings: power: reset: gpio-restart: Convert to json-schema



Convert the GPIO restart bindings from the free-form text format to
json-schema.

Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211217170042.2740058-1-thierry.reding@gmail.com
parent f91030ed
Loading
Loading
Loading
Loading
+0 −54
Original line number Diff line number Diff line
Drive a GPIO line that can be used to restart the system from a restart
handler.

This binding supports level and edge triggered reset.  At driver load
time, the driver will request the given gpio line and install a restart
handler. If the optional properties 'open-source' is not found, the GPIO line
will be driven in the inactive state.  Otherwise its not driven until
the restart is initiated.

When the system is restarted, the restart handler will be invoked in
priority order.  The gpio is configured as an output, and driven active,
triggering a level triggered reset condition. This will also cause an
inactive->active edge condition, triggering positive edge triggered
reset. After a delay specified by active-delay, the GPIO is set to
inactive, thus causing an active->inactive edge, triggering negative edge
triggered reset. After a delay specified by inactive-delay, the GPIO
is driven active again.  After a delay specified by wait-delay, the
restart handler completes allowing other restart handlers to be attempted.

Required properties:
- compatible : should be "gpio-restart".
- gpios : The GPIO to set high/low, see "gpios property" in
  Documentation/devicetree/bindings/gpio/gpio.txt. If the pin should be
  low to reset the board set it to "Active Low", otherwise set
  gpio to "Active High".

Optional properties:
- open-source : Treat the GPIO as being open source and defer driving
  it to when the restart is initiated.  If this optional property is not
  specified, the GPIO is initialized as an output in its inactive state.
- priority : A priority ranging from 0 to 255 (default 128) according to
  the following guidelines:
	0:	Restart handler of last resort, with limited restart
		capabilities
	128:	Default restart handler; use if no other restart handler is
		expected to be available, and/or if restart functionality is
		sufficient to restart the entire system
	255:	Highest priority restart handler, will preempt all other
		restart handlers
- active-delay: Delay (default 100) to wait after driving gpio active [ms]
- inactive-delay: Delay (default 100) to wait after driving gpio inactive [ms]
- wait-delay: Delay (default 3000) to wait after completing restart
  sequence [ms]

Examples:

gpio-restart {
	compatible = "gpio-restart";
	gpios = <&gpio 4 0>;
	priority = <128>;
	active-delay = <100>;
	inactive-delay = <100>;
	wait-delay = <3000>;
};
+86 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/reset/gpio-restart.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: GPIO controlled reset

maintainers:
  - Sebastian Reichel <sre@kernel.org>

description: >
  Drive a GPIO line that can be used to restart the system from a restart handler.

  This binding supports level and edge triggered reset.  At driver load time, the driver will
  request the given gpio line and install a restart handler. If the optional properties
  'open-source' is not found, the GPIO line will be driven in the inactive state.  Otherwise its
  not driven until the restart is initiated.

  When the system is restarted, the restart handler will be invoked in priority order.  The GPIO
  is configured as an output, and driven active, triggering a level triggered reset condition.
  This will also cause an inactive->active edge condition, triggering positive edge triggered
  reset. After a delay specified by active-delay, the GPIO is set to inactive, thus causing an
  active->inactive edge, triggering negative edge triggered reset. After a delay specified by
  inactive-delay, the GPIO is driven active again.  After a delay specified by wait-delay, the
  restart handler completes allowing other restart handlers to be attempted.

properties:
  compatible:
    const: gpio-restart

  gpios:
    description: The GPIO to set high/low, see "gpios property" in
      Documentation/devicetree/bindings/gpio/gpio.txt. If the pin should be low to reset the board
      set it to "Active Low", otherwise set GPIO to "Active High".

  open-source:
    $ref: /schemas/types.yaml#/definitions/flag
    description: Treat the GPIO as being open source and defer driving it to when the restart is
      initiated.  If this optional property is not specified, the GPIO is initialized as an output
      in its inactive state.

  priority:
    $ref: /schemas/types.yaml#/definitions/uint32
    description: |
      A priority ranging from 0 to 255 (default 128) according to the following guidelines:

        0:   Restart handler of last resort, with limited restart capabilities.
        128: Default restart handler; use if no other restart handler is expected to be available,
             and/or if restart functionality is sufficient to restart the entire system.
        255: Highest priority restart handler, will preempt all other restart handlers.
    minimum: 0
    maximum: 255
    default: 128

  active-delay:
    $ref: /schemas/types.yaml#/definitions/uint32
    description: Delay (default 100) to wait after driving gpio active [ms]
    default: 100

  inactive-delay:
    $ref: /schemas/types.yaml#/definitions/uint32
    description: Delay (default 100) to wait after driving gpio inactive [ms]
    default: 100

  wait-delay:
    $ref: /schemas/types.yaml#/definitions/uint32
    description: Delay (default 3000) to wait after completing restart sequence [ms]
    default: 100

additionalProperties: false

required:
  - compatible
  - gpios

examples:
  - |
    gpio-restart {
      compatible = "gpio-restart";
      gpios = <&gpio 4 0>;
      priority = <128>;
      active-delay = <100>;
      inactive-delay = <100>;
      wait-delay = <3000>;
    };