summaryrefslogtreecommitdiff
path: root/include/gpio.h
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2014-12-04 14:37:16 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-10 22:14:07 +0000
commit1b1c3089afada7b53e7836ce2b98c157f36a44a8 (patch)
treeb741f174426d280347de3d0c87032ec241095c97 /include/gpio.h
parent8decf722c52cd03681d4c6a900722a11388b59f3 (diff)
downloadchrome-ec-1b1c3089afada7b53e7836ce2b98c157f36a44a8.tar.gz
g: implement GPIOs
Add a driver for the GPIO controller. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:33816 TEST=press the push buttons on the board and see the console text message and the LEDs lighting up. Change-Id: Idb408fe1c341beb8a97f2047ba6740e0d40cedf5 Reviewed-on: https://chromium-review.googlesource.com/233307 Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/gpio.h')
-rw-r--r--include/gpio.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/gpio.h b/include/gpio.h
index 3f76d43bfd..7d460a27f5 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -69,6 +69,18 @@ struct gpio_info {
/* Signal information from board.c. Must match order from enum gpio_signal. */
extern const struct gpio_info gpio_list[];
+/*
+ * Define the storage size for the pin muxing information.
+ *
+ * int8_t is more optimal for storage size and alignment,
+ * but some chips require to store more information.
+ */
+#ifdef CONFIG_GPIO_LARGE_ALT_INFO
+typedef uint32_t alt_func_t;
+#else
+typedef int8_t alt_func_t;
+#endif
+
/* GPIO alternate function structure, for use by board.c */
struct gpio_alt_func {
/* Port base address */
@@ -78,7 +90,7 @@ struct gpio_alt_func {
uint32_t mask;
/* Alternate function number */
- int8_t func;
+ alt_func_t func;
/* Module ID (as uint8_t, since enum would be 32-bit) */
uint8_t module_id;