summaryrefslogtreecommitdiff
path: root/include/asm-generic/gpio.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-11-10 18:00:21 -0700
committerSimon Glass <sjg@chromium.org>2014-11-21 07:24:11 +0100
commite5901c94e32b3533c35511d1acfb7f1587e324ee (patch)
tree6dc5d86c7f55b0ac45e60bb3b019ceec02db59ec /include/asm-generic/gpio.h
parent469a579df2907a421afec06e37d50e61b7d80227 (diff)
downloadu-boot-imx-e5901c94e32b3533c35511d1acfb7f1587e324ee.zip
u-boot-imx-e5901c94e32b3533c35511d1acfb7f1587e324ee.tar.gz
u-boot-imx-e5901c94e32b3533c35511d1acfb7f1587e324ee.tar.bz2
dm: gpio: Add a function to read an ID from a list of GPIOs
For board IDs a common approach is to set aside several GPIOs for use in determining the board ID. This can provide information about board features and the revision. Add a function that turns a list of GPIOs into an integer by assigning each GPIO to a single bit. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/asm-generic/gpio.h')
-rw-r--r--include/asm-generic/gpio.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index f81b51a..36a36c6 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -257,6 +257,15 @@ const char *gpio_get_bank_info(struct udevice *dev, int *offset_count);
int gpio_lookup_name(const char *name, struct udevice **devp,
unsigned int *offsetp, unsigned int *gpiop);
-int name_to_gpio(const char *name);
+/**
+ * get_gpios() - Turn the values of a list of GPIOs into an integer
+ *
+ * This puts the value of the first GPIO into bit 0, the second into bit 1,
+ * etc. then returns the resulting integer.
+ *
+ * @gpio_list: List of GPIOs to collect
+ * @return resulting integer value
+ */
+unsigned gpio_get_values_as_int(const int *gpio_list);
#endif /* _ASM_GENERIC_GPIO_H_ */