diff options
author | Patrick Delaunay <patrick.delaunay@st.com> | 2020-01-13 13:35:10 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-04-17 06:06:54 +0300 |
commit | 6a0388c5b12b911e4e2a65b60731c1c245821181 (patch) | |
tree | 3267cdc77a624c4830f13592440422bee85cfbef /doc/README.gpio | |
parent | 8fd9daf0363e6d0bda8cc9a6330eb08a0c98543f (diff) | |
download | u-boot-6a0388c5b12b911e4e2a65b60731c1c245821181.tar.xz |
dt-bindings: gpio: alignment with kernel v5.3
Update the binding file for gpio, it is just an alignment
with kernel v5.3.
The U-Boot code example for gpio-hog (not directly linked
to binding) is moved in a new file doc/README.gpio.
[commit 21676b706e99 ("gpio: fixes for gpio-hog support")
& 'commit 4762a9988ede ("gpio: add gpio-hog support")']
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'doc/README.gpio')
-rw-r--r-- | doc/README.gpio | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/doc/README.gpio b/doc/README.gpio new file mode 100644 index 0000000000..548ff37b8c --- /dev/null +++ b/doc/README.gpio @@ -0,0 +1,42 @@ + +GPIO hog (CONFIG_GPIO_HOG) +-------- + +All the GPIO hog are initialized in gpio_hog_probe_all() function called in +board_r.c just before board_late_init() but you can also acces directly to +the gpio with gpio_hog_lookup_name(). + + +Example, for the device tree: + + tca6416@20 { + compatible = "ti,tca6416"; + reg = <0x20>; + #gpio-cells = <2>; + gpio-controller; + + env_reset { + gpio-hog; + input; + gpios = <6 GPIO_ACTIVE_LOW>; + }; + boot_rescue { + gpio-hog; + input; + line-name = "foo-bar-gpio"; + gpios = <7 GPIO_ACTIVE_LOW>; + }; + }; + +You can than access the gpio in your board code with: + + struct gpio_desc *desc; + int ret; + + ret = gpio_hog_lookup_name("boot_rescue", &desc); + if (ret) + return; + if (dm_gpio_get_value(desc) == 1) + printf("\nBooting into Rescue System\n"); + else if (dm_gpio_get_value(desc) == 0) + printf("\nBoot normal\n"); |