summaryrefslogtreecommitdiff
path: root/src/soc/rockchip
diff options
context:
space:
mode:
authorLin Huang <hl@rock-chips.com>2017-08-02 16:59:06 +0800
committerMartin Roth <martinroth@google.com>2017-08-06 23:20:49 +0000
commit589474fec768f7dcc95222c5791839f16c1d7e6e (patch)
tree26cf20d9681bbf77d1f47c8ad64f3a9a761ab574 /src/soc/rockchip
parent5cb2263004c2068090ecdf955d3da01fd46daee7 (diff)
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>
Diffstat (limited to 'src/soc/rockchip')
-rw-r--r--src/soc/rockchip/common/gpio.c9
-rw-r--r--src/soc/rockchip/common/include/soc/gpio.h2
2 files changed, 8 insertions, 3 deletions
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);