diff options
-rw-r--r-- | src/mainboard/google/gru/bootblock.c | 2 | ||||
-rw-r--r-- | src/soc/rockchip/common/gpio.c | 9 | ||||
-rw-r--r-- | src/soc/rockchip/common/include/soc/gpio.h | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/mainboard/google/gru/bootblock.c b/src/mainboard/google/gru/bootblock.c index c5ab28a7b0..01aa4bf47a 100644 --- a/src/mainboard/google/gru/bootblock.c +++ b/src/mainboard/google/gru/bootblock.c @@ -112,7 +112,7 @@ static void configure_tpm(void) write32(&rk3399_grf->iomux_spi0, IOMUX_SPI0); } - gpio_input_irq(GPIO_TPM_IRQ, IRQ_TYPE_EDGE_RISING); + gpio_input_irq(GPIO_TPM_IRQ, IRQ_TYPE_EDGE_RISING, GPIO_PULLUP); } else { gpio_input(GPIO(1, B, 7)); /* I2C0_SDA remove pull-up */ gpio_input(GPIO(1, C, 0)); /* I2C0_SCL remove pull-up */ diff --git a/src/soc/rockchip/common/gpio.c b/src/soc/rockchip/common/gpio.c index 0c19f514a7..952500974e 100644 --- a/src/soc/rockchip/common/gpio.c +++ b/src/soc/rockchip/common/gpio.c @@ -14,6 +14,7 @@ */ #include <arch/io.h> +#include <assert.h> #include <console/console.h> #include <gpio.h> #include <soc/gpio.h> @@ -56,12 +57,16 @@ void gpio_input_pullup(gpio_t gpio) gpio_set_dir(gpio, GPIO_INPUT); } -void gpio_input_irq(gpio_t gpio, enum gpio_irq_type type) +void gpio_input_irq(gpio_t gpio, enum gpio_irq_type type, enum gpio_pull pull) { uint32_t int_polarity, inttype_level; uint32_t mask = BIT(gpio.num); - gpio_input(gpio); + /* gpio pull only PULLNONE, PULLUP, PULLDOWN status */ + assert(pull <= GPIO_PULLDOWN); + + gpio_set_dir(gpio, GPIO_INPUT); + gpio_set_pull(gpio, pull); int_polarity = inttype_level = 0; switch (type) { diff --git a/src/soc/rockchip/common/include/soc/gpio.h b/src/soc/rockchip/common/include/soc/gpio.h index c9fa4c8339..666037464c 100644 --- a/src/soc/rockchip/common/include/soc/gpio.h +++ b/src/soc/rockchip/common/include/soc/gpio.h @@ -90,7 +90,7 @@ enum gpio_irq_type { }; /* Setup and enable irq */ -void gpio_input_irq(gpio_t gpio, enum gpio_irq_type); +void gpio_input_irq(gpio_t gpio, enum gpio_irq_type type, enum gpio_pull pull); /* Check and clear irq status */ int gpio_irq_status(gpio_t gpio); |