aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-08-02 14:20:32 +0200
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-08-13 11:09:49 +0200
commit1e120337f934b7e78d50b33fb408fd8aaa2f3b6c (patch)
tree3f8f826ffb062b54db857e51c964bbe65f9ed874
parent7252f3c16af7573b748895761a9829d968a39707 (diff)
downloadu-boot-1e120337f934b7e78d50b33fb408fd8aaa2f3b6c.zip
u-boot-1e120337f934b7e78d50b33fb408fd8aaa2f3b6c.tar.gz
u-boot-1e120337f934b7e78d50b33fb408fd8aaa2f3b6c.tar.bz2
doc: man-page for gpio command
Provide a man-page for the gpio command. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
-rw-r--r--doc/usage/cmd/gpio.rst90
-rw-r--r--doc/usage/index.rst1
2 files changed, 91 insertions, 0 deletions
diff --git a/doc/usage/cmd/gpio.rst b/doc/usage/cmd/gpio.rst
new file mode 100644
index 0000000..f6a5668
--- /dev/null
+++ b/doc/usage/cmd/gpio.rst
@@ -0,0 +1,90 @@
+.. SPDX-License-Identifier: GPL-2.0+:
+
+gpio command
+============
+
+Synopsis
+--------
+
+::
+
+ gpio <input|set|clear|toggle> <pin>
+ gpio read <name> <pin>
+ gpio status [-a] [<bank>|<pin>]
+
+The gpio command is used to access General Purpose Inputs/Outputs.
+
+gpio input
+----------
+
+Switch the GPIO *pin* to input mode.
+
+gpio set
+--------
+
+Switch the GPIO *pin* to output mode and set the signal to 1.
+
+gpio clear
+----------
+
+Switch the GPIO *pin* to output mode and set the signal to 0.
+
+gpio toggle
+-----------
+
+Switch the GPIO *pin* to output mode and reverse the signal state.
+
+gpio read
+---------
+
+Read the signal state of the GPIO *pin* and save it in environment variable
+*name*.
+
+gpio status
+-----------
+
+Display the status of one or multiple GPIOs. By default only claimed GPIOs
+are displayed.
+
+-a
+ Display GPIOs irrespective of being claimed.
+
+bank
+ Name of a bank of GPIOs to be displayed.
+
+pin
+ Name of a single GPIO to be displayed or manipulated.
+
+Examples
+--------
+
+Switch the status of a GPIO::
+
+ => gpio set a5
+ gpio: pin a5 (gpio 133) value is 1
+ => gpio clear a5
+ gpio: pin a5 (gpio 133) value is 0
+ => gpio toggle a5
+ gpio: pin a5 (gpio 133) value is 1
+ => gpio read myvar a5
+ gpio: pin a5 (gpio 133) value is 1
+ => echo $myvar
+ 1
+ => gpio toggle a5
+ gpio: pin a5 (gpio 133) value is 0
+ => gpio read myvar a5
+ gpio: pin a5 (gpio 133) value is 0
+ => echo $myvar
+ 0
+
+Configuration
+-------------
+
+The *gpio* command is only available if CONFIG_CMD_GPIO=y.
+The *gpio read* command is only available if CONFIG_CMD_GPIO_READ=y.
+
+Return value
+------------
+
+If the command succeds the return value $? is set to 0. If an error occurs, the
+return value $? is set to 1.
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index 2ba8733..28f9683 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -45,6 +45,7 @@ Shell commands
cmd/fatload
cmd/fdt
cmd/for
+ cmd/gpio
cmd/load
cmd/loadm
cmd/loady