summaryrefslogtreecommitdiffstats
path: root/include/fdtdec.h
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2012-10-25 16:31:06 +0000
committerGerald Van Baren <gvb@unssw.com>2012-11-12 23:14:57 -0500
commit202ff7537558edfd759b400cfe9e56c56fc7868c (patch)
tree3a24471fde372eeb2da00b04d3a8d6522e407159 /include/fdtdec.h
parentaadef0a1bc3db81708471c9d18eb6c756659196f (diff)
downloadblackbird-obmc-uboot-202ff7537558edfd759b400cfe9e56c56fc7868c.tar.gz
blackbird-obmc-uboot-202ff7537558edfd759b400cfe9e56c56fc7868c.zip
fdt: Add polarity-aware gpio functions to fdtdec
Add get and set gpio functions to fdtdec that take into account the polarity field in fdtdec_gpio_state.flags. Signed-off-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/fdtdec.h')
-rw-r--r--include/fdtdec.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/fdtdec.h b/include/fdtdec.h
index b5d7d2f54a..5164ce24e6 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -90,6 +90,22 @@ struct fdt_gpio_state {
#define fdt_gpio_isvalid(x) ((x)->gpio != FDT_GPIO_NONE)
/**
+ * Read the GPIO taking into account the polarity of the pin.
+ *
+ * @param gpio pointer to the decoded gpio
+ * @return value of the gpio if successful, < 0 if unsuccessful
+ */
+int fdtdec_get_gpio(struct fdt_gpio_state *gpio);
+
+/**
+ * Write the GPIO taking into account the polarity of the pin.
+ *
+ * @param gpio pointer to the decoded gpio
+ * @return 0 if successful
+ */
+int fdtdec_set_gpio(struct fdt_gpio_state *gpio, int val);
+
+/**
* Find the next numbered alias for a peripheral. This is used to enumerate
* all the peripherals of a certain type.
*
OpenPOWER on IntegriCloud