reset: Add driver for gpio-controlled reset pins
Subsystems (2)
Philipp Zabel
maintainerPATCH v9 1/1 reset: Add driver for gpio-controlled reset pins
This driver implements a reset controller device that toggle a gpio connected to a reset pin of a peripheral IC. The delay between assertion and de-assertion of the reset signal can be configured via device tree.
---
Changes since v8, as suggested by Shawn:
- added support for I2C gpios via gpio_set_value_cansleep
- switched from module_init to arch_initcall to avoid unnecessary probe deferral of subsys_initcall drivers like gpio-pca953x.
--- .../devicetree/bindings/reset/gpio-reset.txt | 35 ++++ drivers/reset/Kconfig | 11 ++ drivers/reset/Makefile | 1 + drivers/reset/gpio-reset.c | 188 +++++++++++++++++++++ 4 files changed, 235 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/gpio-reset.txt create mode 100644 drivers/reset/gpio-reset.c
Documentation/devicetree/bindings/reset/gpio-reset.txt new file +35 -0
@@ -0,0 +1,35 @@ +GPIO reset controller +===================== + +A GPIO reset controller controls a single GPIO that is connected to the reset +pin of a peripheral IC. Please also refer to reset.txt in this directory for +common reset controller binding usage. + +Required properties: +- compatible: Should be "gpio-reset" +- reset-gpios: A gpio used as reset line. The gpio specifier for this property + depends on the gpio controller that provides the gpio. +- #reset-cells: 0, see below + +Optional properties: +- reset-delay-us: delay in microseconds. The gpio reset line will be asserted for + this duration to reset. +- initially-in-reset: boolean. If not set, the initial state should be a + deasserted reset line. If this property exists, the + reset line should be kept in reset. + +example: + +sii902x_reset: gpio-reset { + compatible = "gpio-reset"; + reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; + reset-delay-us = <10000>; + initially-in-reset; + #reset-cells = <0>; +}; + +/* Device with nRESET pin connected to GPIO5_0 */ +sii902x at 39 { + /* ... */ + resets = <&sii902x_reset>; /* active-low GPIO5_0, 10 ms delay */ +};
drivers/reset/Kconfig +11 -0
@@ -11,3 +11,14 @@ menuconfig RESET_CONTROLLER via GPIOs or SoC-internal reset controller modules. If unsure, say no. + +if RESET_CONTROLLER + +config RESET_GPIO + tristate "GPIO reset controller support" + depends on GPIOLIB && OF + help + This driver provides support for reset lines that are controlled + directly by GPIOs. + +endif
drivers/reset/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_RESET_CONTROLLER) += core.o +obj-$(CONFIG_RESET_GPIO) += gpio-reset.o
drivers/reset/gpio-reset.c new file +188 -0
188 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH v9 1/1 reset: Add driver for gpio-controlled reset pins
Quoted 11 lines · Philipp Zabel
This driver implements a reset controller device that toggle a gpio connected to a reset pin of a peripheral IC. The delay between assertion and de-assertion of the reset signal can be configured via device tree.
Signed-off-by Philipp Zabel <[email protected]>Reviewed-by Stephen Warren <[email protected]>---
Changes since v8, as suggested by Shawn:
- added support for I2C gpios viagpio_set_value_cansleep
- switched frommodule_inittoarch_initcallto avoid unnecessary probe deferral ofsubsys_initcalldrivers like gpio-pca953x.
For the record, I'm not convinced that either of those changes is correct.