summaryrefslogtreecommitdiff
path: root/include/asm-generic
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-08-11 09:23:52 -0600
committerSimon Glass <sjg@chromium.org>2014-08-31 23:21:06 -0600
commit89e6405425c7b52fd1330c61b6f5526612b87516 (patch)
tree13186d56fec8da659f25289204b6d71923b495df /include/asm-generic
parenta1263632bb05f0a21620bad0661235fcbbe79dca (diff)
downloadu-boot-imx-89e6405425c7b52fd1330c61b6f5526612b87516.zip
u-boot-imx-89e6405425c7b52fd1330c61b6f5526612b87516.tar.gz
u-boot-imx-89e6405425c7b52fd1330c61b6f5526612b87516.tar.bz2
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>
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/gpio.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index a6e52a0..60539d8 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -79,11 +79,15 @@ int gpio_get_value(unsigned gpio);
*/
int gpio_set_value(unsigned gpio, int value);
-/* State of a GPIO, as reported by get_state() */
+/* State of a GPIO, as reported by get_function() */
enum {
GPIOF_INPUT = 0,
GPIOF_OUTPUT,
- GPIOF_UNKNOWN,
+ GPIOF_UNUSED, /* Not claimed */
+ GPIOF_UNKNOWN, /* Not known */
+ GPIOF_FUNC, /* Not used as a GPIO */
+
+ GPIOF_COUNT,
};
struct udevice;
@@ -123,6 +127,13 @@ struct dm_gpio_ops {
int value);
int (*get_value)(struct udevice *dev, unsigned offset);
int (*set_value)(struct udevice *dev, unsigned offset, int value);
+ /**
+ * get_function() Get the GPIO function
+ *
+ * @dev: Device to check
+ * @offset: GPIO offset within that device
+ * @return current function - GPIOF_...
+ */
int (*get_function)(struct udevice *dev, unsigned offset);
int (*get_state)(struct udevice *dev, unsigned offset, char *state,
int maxlen);