rockchip: gpio: add gpio_pull argument in gpio_input_irq() function

some gpio irq need to set input pull initialization status
to guarantee to get the right irq trigger. let's add this argument
in gpio_input_irq() function

BRANCH=None
BUG=None
TEST=boot from bob

Change-Id: I9b8e6497f07146dafdb447a6ea10d039a2a2fa33
Signed-off-by: Lin Huang <hl@rock-chips.com>
Reviewed-on: https://review.coreboot.org/20866
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Lin Huang 2017-08-02 16:59:06 +08:00 committed by Martin Roth
parent 5cb2263004
commit 589474fec7
3 changed files with 9 additions and 4 deletions

View File

@ -112,7 +112,7 @@ static void configure_tpm(void)
write32(&rk3399_grf->iomux_spi0, IOMUX_SPI0); 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 { } else {
gpio_input(GPIO(1, B, 7)); /* I2C0_SDA remove pull-up */ gpio_input(GPIO(1, B, 7)); /* I2C0_SDA remove pull-up */
gpio_input(GPIO(1, C, 0)); /* I2C0_SCL remove pull-up */ gpio_input(GPIO(1, C, 0)); /* I2C0_SCL remove pull-up */

View File

@ -14,6 +14,7 @@
*/ */
#include <arch/io.h> #include <arch/io.h>
#include <assert.h>
#include <console/console.h> #include <console/console.h>
#include <gpio.h> #include <gpio.h>
#include <soc/gpio.h> #include <soc/gpio.h>
@ -56,12 +57,16 @@ void gpio_input_pullup(gpio_t gpio)
gpio_set_dir(gpio, GPIO_INPUT); 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 int_polarity, inttype_level;
uint32_t mask = BIT(gpio.num); 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; int_polarity = inttype_level = 0;
switch (type) { switch (type) {

View File

@ -90,7 +90,7 @@ enum gpio_irq_type {
}; };
/* Setup and enable irq */ /* 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 */ /* Check and clear irq status */
int gpio_irq_status(gpio_t gpio); int gpio_irq_status(gpio_t gpio);