162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/power/reset/gpio-restart.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: GPIO controlled reset
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Sebastian Reichel <sre@kernel.org>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cidescription: >
1362306a36Sopenharmony_ci  Drive a GPIO line that can be used to restart the system from a restart handler.
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci  This binding supports level and edge triggered reset.  At driver load time, the driver will
1662306a36Sopenharmony_ci  request the given gpio line and install a restart handler. If the optional properties
1762306a36Sopenharmony_ci  'open-source' is not found, the GPIO line will be driven in the inactive state.  Otherwise its
1862306a36Sopenharmony_ci  not driven until the restart is initiated.
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci  When the system is restarted, the restart handler will be invoked in priority order.  The GPIO
2162306a36Sopenharmony_ci  is configured as an output, and driven active, triggering a level triggered reset condition.
2262306a36Sopenharmony_ci  This will also cause an inactive->active edge condition, triggering positive edge triggered
2362306a36Sopenharmony_ci  reset. After a delay specified by active-delay, the GPIO is set to inactive, thus causing an
2462306a36Sopenharmony_ci  active->inactive edge, triggering negative edge triggered reset. After a delay specified by
2562306a36Sopenharmony_ci  inactive-delay, the GPIO is driven active again.  After a delay specified by wait-delay, the
2662306a36Sopenharmony_ci  restart handler completes allowing other restart handlers to be attempted.
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciallOf:
2962306a36Sopenharmony_ci  - $ref: restart-handler.yaml#
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciproperties:
3262306a36Sopenharmony_ci  compatible:
3362306a36Sopenharmony_ci    const: gpio-restart
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci  gpios:
3662306a36Sopenharmony_ci    description: The GPIO to set high/low, see "gpios property" in
3762306a36Sopenharmony_ci      Documentation/devicetree/bindings/gpio/gpio.txt. If the pin should be low to reset the board
3862306a36Sopenharmony_ci      set it to "Active Low", otherwise set GPIO to "Active High".
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci  open-source:
4162306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/flag
4262306a36Sopenharmony_ci    description: Treat the GPIO as being open source and defer driving it to when the restart is
4362306a36Sopenharmony_ci      initiated.  If this optional property is not specified, the GPIO is initialized as an output
4462306a36Sopenharmony_ci      in its inactive state.
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci  priority:
4762306a36Sopenharmony_ci    default: 129
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci  active-delay:
5062306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
5162306a36Sopenharmony_ci    description: Delay (default 100) to wait after driving gpio active [ms]
5262306a36Sopenharmony_ci    default: 100
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci  inactive-delay:
5562306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
5662306a36Sopenharmony_ci    description: Delay (default 100) to wait after driving gpio inactive [ms]
5762306a36Sopenharmony_ci    default: 100
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci  wait-delay:
6062306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
6162306a36Sopenharmony_ci    description: Delay (default 3000) to wait after completing restart sequence [ms]
6262306a36Sopenharmony_ci    default: 100
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciadditionalProperties: false
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_cirequired:
6762306a36Sopenharmony_ci  - compatible
6862306a36Sopenharmony_ci  - gpios
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ciexamples:
7162306a36Sopenharmony_ci  - |
7262306a36Sopenharmony_ci    gpio-restart {
7362306a36Sopenharmony_ci      compatible = "gpio-restart";
7462306a36Sopenharmony_ci      gpios = <&gpio 4 0>;
7562306a36Sopenharmony_ci      priority = <128>;
7662306a36Sopenharmony_ci      active-delay = <100>;
7762306a36Sopenharmony_ci      inactive-delay = <100>;
7862306a36Sopenharmony_ci      wait-delay = <3000>;
7962306a36Sopenharmony_ci    };
80