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>
This commit is contained in:
parent
8c4561d2ef
commit
15192da7c7
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue