diff options
author | Jett Rink <jettrink@chromium.org> | 2019-02-07 15:14:09 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-02-14 05:27:38 -0800 |
commit | d256379678ff4068f76a925074a79c738b77b4b7 (patch) | |
tree | 0f1492cbaaaa6c8694d8ce7bf7c66c9283c7fdd3 /chip/ish/gpio.c | |
parent | 7c20200967b367a8996866f51868feec483f1429 (diff) | |
download | chrome-ec-d256379678ff4068f76a925074a79c738b77b4b7.tar.gz |
ish: print message for misconfigured GPIOs
ISH does not support level-triggered GPIOs, and we should print an
error message when we encounter this bad configuration
BRANCH=none
BUG=none
TEST=manually verified that print occurs
Change-Id: I76d5c7bb2c70c664660a1c8fbe362fcbbde77ae6
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1460083
Reviewed-by: Nick Crews <ncrews@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'chip/ish/gpio.c')
-rw-r--r-- | chip/ish/gpio.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/chip/ish/gpio.c b/chip/ish/gpio.c index 3e5a873141..7d0a34f18f 100644 --- a/chip/ish/gpio.c +++ b/chip/ish/gpio.c @@ -47,6 +47,22 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags) if (port == DUMMY_GPIO_BANK) return; + /* ISH does not support level-trigger interrupts; only edge. */ + if (flags & (GPIO_INT_F_HIGH | GPIO_INT_F_LOW)) { + ccprintf("\n\nISH does not support level trigger GPIO for %d " + "0x%02x!\n\n", + port, mask); + } + + /* ISH 3 can't support both rising and falling edge */ +#ifdef CHIP_FAMILY_ISH3 + if ((flags & GPIO_INT_F_RISING) && (flags & GPIO_INT_F_FALLING)) { + ccprintf("\n\nISH 2/3 does not support both rising & falling " + "edge for %d 0x%02x\n\n", + port, mask); + } +#endif + /* GPSR/GPCR Output high/low */ if (flags & GPIO_HIGH) /* Output high */ ISH_GPIO_GPSR |= mask; @@ -59,21 +75,13 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags) else /* GPIO_INPUT or un-configured */ ISH_GPIO_GPDR &= ~mask; - /* GRER/GFER interrupt trigger */ -#ifdef CHIP_FAMILY_ISH3 - /* ISH 3 can't support both rising and falling edge */ - if (((flags & GPIO_INT_F_RISING) && (flags & GPIO_INT_F_FALLING)) || - ((flags & GPIO_INT_F_HIGH) && (flags & GPIO_INT_F_LOW))) { - ccprintf("ISH 2/3 not support both rising&falling edge\n"); - } -#endif - /* Interrupt is asserted on rising edge/active high */ + /* Interrupt is asserted on rising edge */ if (flags & GPIO_INT_F_RISING) ISH_GPIO_GRER |= mask; else ISH_GPIO_GRER &= ~mask; - /* Interrupt is asserted on falling edge/active low */ + /* Interrupt is asserted on falling edge */ if (flags & GPIO_INT_F_FALLING) ISH_GPIO_GFER |= mask; else |