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 /chip | |
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 'chip')
-rw-r--r-- | chip/it83xx/espi.c | 7 | ||||
-rw-r--r-- | chip/mchp/espi.c | 10 |
2 files changed, 8 insertions, 9 deletions
diff --git a/chip/it83xx/espi.c b/chip/it83xx/espi.c index 972ac6c146..c731a7ad7e 100644 --- a/chip/it83xx/espi.c +++ b/chip/it83xx/espi.c @@ -59,7 +59,7 @@ static const struct vw_channel_t vw_host_startup_setting[] = { }; #define VW_CHAN(name, idx, level, valid) \ - [(name - VW_SIGNAL_BASE)] = {idx, level, valid} + [(name - VW_SIGNAL_START)] = {idx, level, valid} /* VW signals used in eSPI (NOTE: must match order of enum espi_vw_signal). */ static const struct vw_channel_t vw_channel_list[] = { @@ -165,13 +165,12 @@ static const struct vw_channel_t vw_channel_list[] = { VW_LEVEL_FIELD(VW_IDX_42_SLP_WLAN), VW_VALID_FIELD(VW_IDX_42_SLP_WLAN)), }; -BUILD_ASSERT(ARRAY_SIZE(vw_channel_list) == - (VW_SIGNAL_BASE_END - VW_SIGNAL_BASE)); +BUILD_ASSERT(ARRAY_SIZE(vw_channel_list) == VW_SIGNAL_COUNT); /* Get vw index & value information by signal */ static int espi_vw_get_signal_index(enum espi_vw_signal event) { - uint32_t i = event - VW_SIGNAL_BASE; + uint32_t i = event - VW_SIGNAL_START; return (i < ARRAY_SIZE(vw_channel_list)) ? i : -1; } diff --git a/chip/mchp/espi.c b/chip/mchp/espi.c index e7459ae25c..95cd05c10a 100644 --- a/chip/mchp/espi.c +++ b/chip/mchp/espi.c @@ -578,7 +578,7 @@ static void espi_pc_flush(void) void espi_vw_power_signal_interrupt(enum espi_vw_signal signal) { CPRINTS("eSPI power signal interrupt for VW %d", signal); - trace1(0, ESPI, 0, "eSPI pwr intr VW %d", (signal - VW_SIGNAL_BASE)); + trace1(0, ESPI, 0, "eSPI pwr intr VW %d", (signal - VW_SIGNAL_START)); power_signal_interrupt((enum gpio_signal) signal); } @@ -625,7 +625,7 @@ int espi_vw_set_wire(enum espi_vw_signal signal, uint8_t level) CPRINTS("eSPI VW Set Wire %s = %d", espi_vw_get_wire_name(signal), level); trace2(0, ESPI, 0, "VW SetWire[%d] = %d", - ((uint32_t)signal - VW_SIGNAL_BASE), level); + ((uint32_t)signal - VW_SIGNAL_START), level); #endif return EC_SUCCESS; @@ -735,7 +735,7 @@ int espi_vw_get_wire(enum espi_vw_signal signal) CPRINTS("VW GetWire %s = %d", espi_vw_get_wire_name(signal), vw); trace2(0, ESPI, 0, "VW GetWire[%d] = %d", - ((uint32_t)signal - VW_SIGNAL_BASE), vw); + ((uint32_t)signal - VW_SIGNAL_START), vw); #endif } @@ -765,7 +765,7 @@ int espi_vw_enable_wire_int(enum espi_vw_signal signal) CPRINTS("VW IntrEn for VW[%s]", espi_vw_get_wire_name(signal)); trace1(0, ESPI, 0, "VW IntrEn for VW[%d]", - ((uint32_t)signal - VW_SIGNAL_BASE)); + ((uint32_t)signal - VW_SIGNAL_START)); #endif ridx = vw_info_tbl[tidx].reg_idx; @@ -816,7 +816,7 @@ int espi_vw_disable_wire_int(enum espi_vw_signal signal) CPRINTS("VW IntrDis for VW[%s]", espi_vw_get_wire_name(signal)); trace1(0, ESPI, 0, "VW IntrDis for VW[%d]", - (signal - VW_SIGNAL_BASE)); + (signal - VW_SIGNAL_START)); #endif ridx = vw_info_tbl[tidx].reg_idx; |