From ffeee420912eecf525564bb35b095b6bfa5d0de6 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Tue, 27 Mar 2018 16:22:00 -0700 Subject: rockchip: Add gpio_set() function The 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 Reviewed-on: https://review.coreboot.org/25393 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/soc/rockchip/common/gpio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/soc') 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); } -- cgit v1.2.3