1 .. SPDX-License-Identifier: GPL-2.0+:
14 gpio <input|set|clear|toggle> <pin>
15 gpio read <name> <pin>
16 gpio status [-a] [<bank>|<pin>]
18 The gpio command is used to access General Purpose Inputs/Outputs.
23 Switch the GPIO *pin* to input mode.
28 Switch the GPIO *pin* to output mode and set the signal to 1.
33 Switch the GPIO *pin* to output mode and set the signal to 0.
38 Switch the GPIO *pin* to output mode and reverse the signal state.
43 Read the signal state of the GPIO *pin* and save it in environment variable
49 Display the status of one or multiple GPIOs. By default only claimed GPIOs
51 gpio status command output fields are::
53 <name>: <function>: <value> [x] <label>
55 *function* can take the following values:
58 pin configured in gpio output, *value* indicates the pin's level
61 pin configured in gpio input, *value* indicates the pin's level
64 pin configured in alternate function, followed by *label*
65 which shows pinmuxing label.
70 *[x]* or *[ ]* indicate respectively if the gpio is used or not.
72 *label* shows the gpio label.
78 Display GPIOs irrespective of being claimed.
81 Name of a bank of GPIOs to be displayed.
84 Name of a single GPIO to be displayed or manipulated.
89 Switch the status of a GPIO::
92 gpio: pin a5 (gpio 133) value is 1
94 gpio: pin a5 (gpio 133) value is 0
96 gpio: pin a5 (gpio 133) value is 1
98 gpio: pin a5 (gpio 133) value is 1
102 gpio: pin a5 (gpio 133) value is 0
103 => gpio read myvar a5
104 gpio: pin a5 (gpio 133) value is 0
108 Show the GPIO status::
115 GPIOA10: output: 0 [x] hdmi-transmitter@39.reset-gpios
116 GPIOA13: output: 1 [x] red.gpios
122 GPIOB7: input: 0 [x] mmc@58005000.cd-gpios
123 GPIOB11: func rgmii-0
128 The *gpio* command is only available if CONFIG_CMD_GPIO=y.
129 The *gpio read* command is only available if CONFIG_CMD_GPIO_READ=y.
134 If the command succeds the return value $? is set to 0. If an error occurs, the
135 return value $? is set to 1.