]> Git Repo - J-u-boot.git/blame - doc/README.gpio
arm_ffa: introduce sandbox FF-A support
[J-u-boot.git] / doc / README.gpio
CommitLineData
6a0388c5
PD
1
2GPIO hog (CONFIG_GPIO_HOG)
3--------
4
48b3ecbe
MV
5All the GPIO hog are initialized using DM_FLAG_PROBE_AFTER_BIND DM flag
6after bind().
6a0388c5
PD
7
8Example, 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
29You 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");
This page took 0.086624 seconds and 4 git commands to generate.