summaryrefslogtreecommitdiff
path: root/include/gpio_signal.h
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2019-10-10 15:43:02 -0600
committerCommit Bot <commit-bot@chromium.org>2019-10-25 18:52:08 +0000
commit9f392b0d616f6fec17d213736e6bf9f4217392e4 (patch)
tree85eb83515d93fa2cd5fe036d270b2811ff9101cb /include/gpio_signal.h
parent7eded13a72691fdce4d66f59c5b119969afa35c0 (diff)
downloadchrome-ec-9f392b0d616f6fec17d213736e6bf9f4217392e4.tar.gz
GPIO/IOEX/eSPI: Give different IO signals unique values
There are 3 different IO signal types used by the EC. Ensure they each use a unique range of values so we can tell them apart. 1) Local GPIO => 0 to 0x0FFF 2) IO expander GPIO => 0x1000 to 0x1FFF 3) eSPI virtual wire signals => 0x2000 to 0x2FFF BUG=b:138600691 BRANCH=none TEST=IO expander signals still work on Trembyle Change-Id: I63fadb4bb4573ed3dd121c24e3bd40a00873e29f Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1854778 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'include/gpio_signal.h')
-rw-r--r--include/gpio_signal.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/include/gpio_signal.h b/include/gpio_signal.h
index e863b7c415..478e83dca5 100644
--- a/include/gpio_signal.h
+++ b/include/gpio_signal.h
@@ -6,21 +6,44 @@
#ifndef __CROS_EC_GPIO_SIGNAL_H
#define __CROS_EC_GPIO_SIGNAL_H
+#include "compile_time_macros.h"
+
+/*
+ * There are 3 different IO signal types used by the EC.
+ * Ensure they each use a unique range of values so we can tell them apart.
+ * 1) Local GPIO => 0 to 0x0FFF
+ * 2) IO expander GPIO => 0x1000 to 0x1FFF
+ * 3) eSPI virtual wire signals (defined in include/espi.h) => 0x2000 to 0x2FFF
+ */
+
#define GPIO(name, pin, flags) GPIO_##name,
#define UNIMPLEMENTED(name) GPIO_##name,
#define GPIO_INT(name, pin, flags, signal) GPIO_##name,
+#define GPIO_SIGNAL_START 0 /* The first valid GPIO signal is 0 */
+
enum gpio_signal {
#include "gpio.wrap"
- GPIO_COUNT
+ GPIO_COUNT,
+ /* Ensure that sizeof gpio_signal is large enough for ioex_signal */
+ GPIO_LIMIT = 0x0FFF
};
+BUILD_ASSERT(GPIO_COUNT < GPIO_LIMIT);
#define IOEX(name, expin, flags) IOEX_##name,
#define IOEX_INT(name, expin, flags, signal) IOEX_##name,
enum ioex_signal {
+ /* The first valid IOEX signal is 0x1000 */
+ IOEX_SIGNAL_START = GPIO_LIMIT + 1,
+ /* Used to ensure that the first IOEX signal is same as start */
+ __IOEX_PLACEHOLDER = GPIO_LIMIT,
#include "gpio.wrap"
- IOEX_COUNT
+ IOEX_SIGNAL_END,
+ IOEX_LIMIT = 0x1FFF
};
+BUILD_ASSERT(IOEX_SIGNAL_END < IOEX_LIMIT);
+
+#define IOEX_COUNT (IOEX_SIGNAL_END - IOEX_SIGNAL_START)
#endif /* __CROS_EC_GPIO_SIGNAL_H */