From 15192da7c756eead1e3ccb2d3c7781bf96680925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= Date: Tue, 11 Sep 2018 20:13:41 +0200 Subject: [PATCH] soc/amd/stoneyridge: Fix more GPIO functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of gpio_num, gpio_address should be used as the address in write32. This lets us also get rid of a few casts. Commit c9ed3ee8d8 ("soc/amd/stoneyridge: Fix gpio_set function") fixed one instance of this bug, but it was more widespread. TEST=None Change-Id: I0cf87aac2f1b87b6eac2b506515e48fe908c1f2b Signed-off-by: Jonathan Neuschäfer Reviewed-on: https://review.coreboot.org/28570 Tested-by: build bot (Jenkins) Reviewed-by: Richard Spiegel Reviewed-by: Martin Roth --- src/soc/amd/stoneyridge/gpio.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/soc/amd/stoneyridge/gpio.c b/src/soc/amd/stoneyridge/gpio.c index 88e7d3be19..b4b7acfe88 100644 --- a/src/soc/amd/stoneyridge/gpio.c +++ b/src/soc/amd/stoneyridge/gpio.c @@ -162,7 +162,7 @@ void gpio_set(gpio_t gpio_num, int value) reg = read32((void *)gpio_address); reg &= ~GPIO_OUTPUT_MASK; reg |= !!value << GPIO_OUTPUT_SHIFT; - write32((void *)(uintptr_t)gpio_address, reg); + write32((void *)gpio_address, reg); } void gpio_input_pulldown(gpio_t gpio_num) @@ -173,7 +173,7 @@ void gpio_input_pulldown(gpio_t gpio_num) reg = read32((void *)gpio_address); reg &= ~GPIO_PULLUP_ENABLE; reg |= GPIO_PULLDOWN_ENABLE; - write32((void *)(uintptr_t)gpio_num, reg); + write32((void *)gpio_address, reg); } void gpio_input_pullup(gpio_t gpio_num) @@ -184,7 +184,7 @@ void gpio_input_pullup(gpio_t gpio_num) reg = read32((void *)gpio_address); reg &= ~GPIO_PULLDOWN_ENABLE; reg |= GPIO_PULLUP_ENABLE; - write32((void *)(uintptr_t)gpio_num, reg); + write32((void *)gpio_address, reg); } void gpio_input(gpio_t gpio_num) @@ -194,7 +194,7 @@ void gpio_input(gpio_t gpio_num) reg = read32((void *)gpio_address); reg &= ~GPIO_OUTPUT_ENABLE; - write32((void *)(uintptr_t)gpio_num, reg); + write32((void *)gpio_address, reg); } void gpio_output(gpio_t gpio_num, int value) @@ -204,7 +204,7 @@ void gpio_output(gpio_t gpio_num, int value) reg = read32((void *)gpio_address); reg |= GPIO_OUTPUT_ENABLE; - write32((void *)(uintptr_t)gpio_num, reg); + write32((void *)gpio_address, reg); gpio_set(gpio_num, value); }