]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ti-u-boot/ti-u-boot.git/blob - doc/README.gpio
Prepare v2024.04
[ti-u-boot/ti-u-boot.git] / doc / README.gpio
2 GPIO hog (CONFIG_GPIO_HOG)
3 --------
5 All the GPIO hog are initialized in gpio_hog_probe_all() function called in
6 board_r.c just before board_late_init() but you can also acces directly to
7 the gpio with gpio_hog_lookup_name().
10 Example, for the device tree:
12         tca6416@20 {
13                 compatible = "ti,tca6416";
14                 reg = <0x20>;
15                 #gpio-cells = <2>;
16                 gpio-controller;
18                 env_reset {
19                         gpio-hog;
20                         input;
21                         gpios = <6 GPIO_ACTIVE_LOW>;
22                 };
23                 boot_rescue {
24                         gpio-hog;
25                         input;
26                         line-name = "foo-bar-gpio";
27                         gpios = <7 GPIO_ACTIVE_LOW>;
28                 };
29         };
31 You can than access the gpio in your board code with:
33         struct gpio_desc *desc;
34         int ret;
36         ret = gpio_hog_lookup_name("boot_rescue", &desc);
37         if (ret)
38                 return;
39         if (dm_gpio_get_value(desc) == 1)
40                 printf("\nBooting into Rescue System\n");
41         else if (dm_gpio_get_value(desc) == 0)
42                 printf("\nBoot normal\n");