diff options
author | Mary Ruthven <mruthven@chromium.org> | 2017-06-05 12:30:16 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-06-05 18:33:57 -0700 |
commit | 4315a010b065b31073bdcef40b2f25adc97456e2 (patch) | |
tree | 2ca542d96010ee6703327c707a26afec31365555 | |
parent | 7dab0e853caf04a3c8d5d1f7b795a23f8b6142d9 (diff) | |
download | chrome-ec-4315a010b065b31073bdcef40b2f25adc97456e2.tar.gz |
g: add flag to delay int enable until board_init
Cr50 has different gpio configurations for different boards. They cannot
be determined until board_init. We want a way to delay enabling the gpio
interrupts until the board type can be determined.
This change adds a gpio flag, GPIO_INT_DISABLE. When set gpio_pre_init
will setup the interrupt, but not enable it. board_init then enables all
of the interrupts with init_interrupts.
BUG=b:35587228
BRANCH=cr50
TEST=use 'gpiocfg' to verify the setup hasn't changed. Add print
statements to verify that gpio_pre_init skips enabling the interrupt on
any gpio that has GPIO_INT_DISABLE set
Change-Id: I91f73297ab80781b99aa82eda479ae311c13cb77
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/523808
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | chip/g/gpio.c | 8 | ||||
-rw-r--r-- | include/gpio.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/chip/g/gpio.c b/chip/g/gpio.c index a4f17eaf76..5683048344 100644 --- a/chip/g/gpio.c +++ b/chip/g/gpio.c @@ -84,24 +84,24 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags) if (flags & GPIO_INT_F_LOW) { GR_GPIO_CLRINTTYPE(port) = mask; GR_GPIO_CLRINTPOL(port) = mask; - GR_GPIO_SETINTEN(port) = mask; } if (flags & GPIO_INT_F_HIGH) { GR_GPIO_CLRINTTYPE(port) = mask; GR_GPIO_SETINTPOL(port) = mask; - GR_GPIO_SETINTEN(port) = mask; } if (flags & GPIO_INT_F_FALLING) { GR_GPIO_SETINTTYPE(port) = mask; GR_GPIO_CLRINTPOL(port) = mask; - GR_GPIO_SETINTEN(port) = mask; } if (flags & GPIO_INT_F_RISING) { GR_GPIO_SETINTTYPE(port) = mask; GR_GPIO_SETINTPOL(port) = mask; - GR_GPIO_SETINTEN(port) = mask; } + if (flags & (GPIO_INT_ANY ^ GPIO_INPUT)) + if (!(flags & GPIO_INT_DISABLE)) + GR_GPIO_SETINTEN(port) = mask; + /* No way to trigger on both rising and falling edges, darn it. */ } diff --git a/include/gpio.h b/include/gpio.h index 35f53801de..d1dad9056a 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -33,6 +33,8 @@ #define GPIO_ALTERNATE (1 << 17) /* GPIO used for alternate function. */ #define GPIO_LOCKED (1 << 18) /* Lock GPIO output and configuration */ #define GPIO_HIB_WAKE_HIGH (1 << 19) /* Hibernate wake on high level */ +#define GPIO_INT_DISABLE (1 << 20) /* Don't enable interrupt in */ + /* gpio_pre_init */ /* Common flag combinations */ #define GPIO_OUT_LOW (GPIO_OUTPUT | GPIO_LOW) |