diff options
author | Julius Werner <jwerner@chromium.org> | 2018-03-27 16:22:00 -0700 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2018-04-03 00:34:46 +0000 |
commit | ffeee420912eecf525564bb35b095b6bfa5d0de6 (patch) | |
tree | 9e4fc2fac9c7480171bcad7d61d16ce2376bc878 /src/soc/rockchip/common | |
parent | e7e35674d667c4cdbbf5b433be29776c2cd46625 (diff) |
rockchip: Add gpio_set() function
The <gpio.h> API is supposed to include a gpio_set() function that just
toggles the state of a GPIO already configured as an output, even though
we rarely need it since gpio_output() can already be used to initialze a
GPIO to a default value while configuring it as an output. This function
was forgotten on Rockchip, so this patch adds it now.
Change-Id: I201288139a2870e71f55a7af0d79d4a460b30a0c
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/25393
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/soc/rockchip/common')
-rw-r--r-- | src/soc/rockchip/common/gpio.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/soc/rockchip/common/gpio.c b/src/soc/rockchip/common/gpio.c index 1d87cf814d..cd095ff374 100644 --- a/src/soc/rockchip/common/gpio.c +++ b/src/soc/rockchip/common/gpio.c @@ -109,10 +109,15 @@ int gpio_get(gpio_t gpio) return (read32(&gpio_port[gpio.port]->ext_porta) >> gpio.num) & 0x1; } -void gpio_output(gpio_t gpio, int value) +void gpio_set(gpio_t gpio, int value) { clrsetbits_le32(&gpio_port[gpio.port]->swporta_dr, 1 << gpio.num, !!value << gpio.num); +} + +void gpio_output(gpio_t gpio, int value) +{ + gpio_set(gpio, value); gpio_set_dir(gpio, GPIO_OUTPUT); gpio_set_pull(gpio, GPIO_PULLNONE); } |