From 2768a119ce08893975f3bf6788fd31c7071e7c9a Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Thu, 1 Sep 2016 22:55:58 -0700 Subject: rockchip: Remove pulls for gpio_output(), clean up code Output GPIOs should never have a pull-up or pull-down resistor attached since they're actively driven. Since some GPIOs get initialized with a pull at power-on reset, we should explicitly overwrite that setting. Most other platforms do this on gpio_output, but Rockchip hadn't yet. Also, shuffle some code around to make things cleaner and allow for easier code reuse. BRANCH=None BUG=chrome-os-partner:52526 TEST=Booted Kevin. Change-Id: I1425d074ea1e90f4484e1e84a8002b057192c5f7 Signed-off-by: Patrick Georgi Original-Commit-Id: df5b236bfd58b172435043c1cb792b917a4ec4ab Original-Change-Id: I044266d71ef8bd0518316ff72d829d1ca1e30f35 Original-Signed-off-by: Julius Werner Original-Reviewed-on: https://chromium-review.googlesource.com/382531 Original-Reviewed-by: Simon Glass Reviewed-on: https://review.coreboot.org/16710 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- src/soc/rockchip/common/include/soc/gpio.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/soc/rockchip/common/include') diff --git a/src/soc/rockchip/common/include/soc/gpio.h b/src/soc/rockchip/common/include/soc/gpio.h index 2c72435065..a888635f72 100644 --- a/src/soc/rockchip/common/include/soc/gpio.h +++ b/src/soc/rockchip/common/include/soc/gpio.h @@ -73,13 +73,18 @@ int is_pmu_gpio(gpio_t gpio); /* Return the io addr of gpio register */ void *gpio_grf_reg(gpio_t gpio); -enum { - PULLNONE = 0, - PULLUP, - PULLDOWN +enum gpio_pull { + GPIO_PULLNONE = 0, + GPIO_PULLUP = 1, + GPIO_PULLDOWN = 2, +}; + +enum gpio_dir { + GPIO_INPUT = 0, + GPIO_OUTPUT = 1, }; /* The gpio pull bias setting may be different between SoCs */ -u32 gpio_get_pull_val(gpio_t gpio, u32 pull); +u32 gpio_get_pull_val(gpio_t gpio, enum gpio_pull pull); #endif -- cgit v1.2.3