summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>2018-09-11 20:13:41 +0200
committerMartin Roth <martinroth@google.com>2018-09-12 11:54:09 +0000
commit15192da7c756eead1e3ccb2d3c7781bf96680925 (patch)
tree71fec2998672e74a4b92ad5872bb4fc5b7a9e14b
parent8c4561d2efa6f1a60dde3e41de8e7105d5911348 (diff)
downloadcoreboot-15192da7c756eead1e3ccb2d3c7781bf96680925.tar.xz
soc/amd/stoneyridge: Fix more GPIO functions
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 <j.neuschaefer@gmx.net> Reviewed-on: https://review.coreboot.org/28570 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Richard Spiegel <richard.spiegel@silverbackltd.com> Reviewed-by: Martin Roth <martinroth@google.com>
-rw-r--r--src/soc/amd/stoneyridge/gpio.c10
1 files 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);
}