riscv: dts: jh7110: Add clkgen for use sbi
[platform/kernel/u-boot.git] / doc / README.gpio
1
2 GPIO hog (CONFIG_GPIO_HOG)
3 --------
4
5 All the GPIO hog are initialized using DM_FLAG_PROBE_AFTER_BIND DM flag
6 after bind().
7
8 Example, for the device tree:
9
10         tca6416@20 {
11                 compatible = "ti,tca6416";
12                 reg = <0x20>;
13                 #gpio-cells = <2>;
14                 gpio-controller;
15
16                 env_reset {
17                         gpio-hog;
18                         input;
19                         gpios = <6 GPIO_ACTIVE_LOW>;
20                 };
21                 boot_rescue {
22                         gpio-hog;
23                         input;
24                         line-name = "foo-bar-gpio";
25                         gpios = <7 GPIO_ACTIVE_LOW>;
26                 };
27         };
28
29 You can than access the gpio in your board code with:
30
31         struct gpio_desc *desc;
32         int ret;
33
34         ret = gpio_hog_lookup_name("boot_rescue", &desc);
35         if (ret)
36                 return;
37         if (dm_gpio_get_value(desc) == 1)
38                 printf("\nBooting into Rescue System\n");
39         else if (dm_gpio_get_value(desc) == 0)
40                 printf("\nBoot normal\n");