diff options
author | Edward Hill <ecgh@chromium.org> | 2019-10-10 15:43:02 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-25 18:52:08 +0000 |
commit | 9f392b0d616f6fec17d213736e6bf9f4217392e4 (patch) | |
tree | 85eb83515d93fa2cd5fe036d270b2811ff9101cb /common/espi.c | |
parent | 7eded13a72691fdce4d66f59c5b119969afa35c0 (diff) | |
download | chrome-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 'common/espi.c')
-rw-r--r-- | common/espi.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/common/espi.c b/common/espi.c index b496ca3cb6..0904f102d7 100644 --- a/common/espi.c +++ b/common/espi.c @@ -44,13 +44,8 @@ BUILD_ASSERT(ARRAY_SIZE(espi_vw_names) == VW_SIGNAL_COUNT); const char *espi_vw_get_wire_name(enum espi_vw_signal signal) { - int idx; - - if ((uint32_t)signal > VW_SIGNAL_BASE) { - idx = (uint32_t)signal - (VW_SIGNAL_BASE + 1); - if (idx < ARRAY_SIZE(espi_vw_names)) - return espi_vw_names[idx]; - } + if (espi_signal_is_vw(signal)) + return espi_vw_names[signal - VW_SIGNAL_START]; return NULL; } @@ -58,10 +53,5 @@ const char *espi_vw_get_wire_name(enum espi_vw_signal signal) int espi_signal_is_vw(int signal) { - enum espi_vw_signal sig = (enum espi_vw_signal)signal; - - if ((sig > VW_SIGNAL_BASE) && (sig < VW_SIGNAL_BASE_END)) - return 1; - - return 0; + return ((signal >= VW_SIGNAL_START) && (signal < VW_SIGNAL_END)); } |