Commit Graph

13 Commits

Author SHA1 Message Date
Simon Glass 66280e82f7 gpio: Warn about invalid GPIOs used with the 'gpio' command
At present there is no indication that an invalid GPIO is used except that
the GPIO status is not displayed. Make the error more explicit to avoid
confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-21 20:42:36 -07:00
Simon Glass 0ffe6ab521 gpio: Allow 's' as an abbreviation for 'status'
The 'gpio' command allows abbreviations for most subcommands. Allow them
for 'status' also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-21 20:42:35 -07:00
Tom Rini 84a6df09c7 Merge git://git.denx.de/u-boot-dm
Fix a trivial conflict over adding <dm.h>

Conflicts:
	arch/arm/cpu/armv7/omap3/board.c

Signed-off-by: Tom Rini <trini@ti.com>
2014-10-26 14:03:08 -04:00
Jeroen Hofstee 5b5ac64560 gpio: add protype for name_to_gpio
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2014-10-25 15:27:36 -04:00
Simon Glass 0757535a7e dm: Move the function for getting GPIO status into the uclass
This function can be more easily tested if it is in the uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:29:52 -06:00
Simon Glass 9165e8428d dm: gpio: Allow gpio command to adjust GPIOs that are busy
The gpio command mostly relies on gpio_request() and gpio_free() being
nops, in that you can request a GPIO twice. With driver model this is
now implemented correctly, so it fails.

Change the command to deal with a failure to claim the GPIO.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-08-31 23:21:19 -06:00
Simon Glass 89e6405425 dm: gpio: Enhance gpio command to show only active GPIOs
The GPIO list is very long in many cases and most of them are not used.
By default, show only the GPIOs that are in use, and provide a flag to show
all of them. This makes the 'gpio status' command much more pleasant.

In order to do this, driver model now exposes a method for obtaining the
'function' of a GPIO, which describes whether it is an input or output, for
example. Implementation of this method is optional.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-08-31 23:21:06 -06:00
Heiko Schocher 54c5d08a09 dm: rename device struct to udevice
using UBI and DM together leads in compiler error, as
both define a "struct device", so rename "struct device"
in include/dm/device.h to "struct udevice", as we use
linux code (MTD/UBI/UBIFS some USB code,...) and cannot
change the linux "struct device"

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Marek Vasut <marex@denx.de>
2014-05-27 10:21:32 -04:00
Ian Campbell fd11bea2cc blackfin: make name_to_gpio be a weak symbol
This required moving it into a C file from the header.

The only user of a non-default name_to_gpio is blackfin, therefore build tested
with the blackfin bct-brettl2 build, which is one I picked at random. Also
tested with a build for the ARM tec board which uses the default/fallback
implementation. Inspection with objdump shows that both have done the right
thing.

This change was requested by Marek during review of the sunxi patch series.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Cc: Marek Vasut <marex@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Sonic Zhang <sonic.adi@gmail.com>
2014-04-18 10:42:29 -04:00
Simon Glass 95a260a98c dm: Enable gpio command to support driver model
Now that named GPIO banks are supported, along with a way of obtaining
the status of a GPIO (input or output), we can provide an enhanced
GPIO command for driver model. Where the driver provides its own operation
for obtaining the GPIO state, this is used, otherwise a generic version
is sufficient.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-03-04 12:15:30 -05:00
Simon Glass 4c12eeb8b5 Convert cmd_usage() calls in common to use a return value
Change all files in common/ to use CMD_RET_USAGE instead of calling
cmd_usage() directly. I'm not completely sure about this patch since
the code since impact is small (100 byte or so on ARM) and it might
need splitting into smaller patches. But for now here it is.

Signed-off-by: Simon Glass <sjg@chromium.org>
2012-03-06 21:09:46 +01:00
Mike Frysinger 6801201ee7 gpio: check request result
Make sure the pin request passed before attempting to use it later on.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-04-13 15:57:00 -04:00
Mike Frysinger a972b8d701 gpio: generalize for all generic gpio providers
The Blackfin gpio command isn't terribly Blackfin-specific.  So generalize
the few pieces into two new optional helpers:
	name_to_gpio() - turn a string name into a GPIO #
	gpio_status() - display current pin bindings (think /proc/gpio)

Once these pieces are pulled out, we can relocate the cmd_gpio.c into the
common directory.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-04-13 15:56:51 -04:00