diff options
author | 2023-10-10 14:33:42 +0000 | |
---|---|---|
committer | 2023-10-10 14:33:42 +0000 | |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/u-boot/doc/README.gpio | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/u-boot/doc/README.gpio')
-rw-r--r-- | roms/u-boot/doc/README.gpio | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/roms/u-boot/doc/README.gpio b/roms/u-boot/doc/README.gpio new file mode 100644 index 000000000..548ff37b8 --- /dev/null +++ b/roms/u-boot/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"); |