summaryrefslogtreecommitdiff
path: root/arch/blackfin/cpu
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-08-13 19:48:09 (GMT)
committerMike Frysinger <vapier@gentoo.org>2010-10-02 20:00:39 (GMT)
commit1729615875d5d443ef68154f7fff6af065301e59 (patch)
tree6dea7abe1cf6da45c7d9c66ef524ed3bedfd9e8e /arch/blackfin/cpu
parent821ad16fa9900c9b48e9af678b4a5d7808a58f7c (diff)
downloadu-boot-fsl-qoriq-1729615875d5d443ef68154f7fff6af065301e59.tar.xz
Blackfin: cmd_gpio: document/extend input sub-option
The input sub command was missing from the help text, and it didn't show the actual value currently read on the GPIO. This allows people to read the value of input pins. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/cpu')
-rw-r--r--arch/blackfin/cpu/cmd_gpio.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/arch/blackfin/cpu/cmd_gpio.c b/arch/blackfin/cpu/cmd_gpio.c
index 4430c90..5988da7 100644
--- a/arch/blackfin/cpu/cmd_gpio.c
+++ b/arch/blackfin/cpu/cmd_gpio.c
@@ -90,20 +90,19 @@ int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
gpio_request(gpio, "cmd_gpio");
/* finally, let's do it: set direction and exec command */
+ ulong value;
if (sub_cmd == GPIO_INPUT) {
gpio_direction_input(gpio);
- printf("gpio: pin %lu on port %c set to input\n", pin, *str_pin);
- return 0;
- }
-
- ulong value;
- switch (sub_cmd) {
- case GPIO_SET: value = 1; break;
- case GPIO_CLEAR: value = 0; break;
- case GPIO_TOGGLE: value = !gpio_get_value(gpio); break;
- default: goto show_usage;
+ value = gpio_get_value(gpio);
+ } else {
+ switch (sub_cmd) {
+ case GPIO_SET: value = 1; break;
+ case GPIO_CLEAR: value = 0; break;
+ case GPIO_TOGGLE: value = !gpio_get_value(gpio); break;
+ default: goto show_usage;
+ }
+ gpio_direction_output(gpio, value);
}
- gpio_direction_output(gpio, value);
printf("gpio: pin %lu on port %c (gpio %lu) value is %lu\n",
pin, *str_pin, gpio, value);
@@ -113,6 +112,6 @@ int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
U_BOOT_CMD(gpio, 3, 0, do_gpio,
- "set/clear/toggle gpio output pins",
- "<set|clear|toggle> <port><pin>\n"
- " - set/clear/toggle the specified pin (e.g. PF10)");
+ "input/set/clear/toggle gpio output pins",
+ "<input|set|clear|toggle> <port><pin>\n"
+ " - input/set/clear/toggle the specified pin (e.g. PF10)");