soc/amd/common/block/gpio_banks: fix sequence in gpio_output

When configuring a GPIO pin as output the value should be written before
it gets configures as an output to avoid a possible glitch on the output
when the GPIO pin was an input before and the output value was different
from the one that got written afterwards.

Change-Id: I2bb5e629ef0ed2daadc903ecc1852200fe3a5cb9
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49119
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
This commit is contained in:
Felix Held 2021-01-05 00:17:56 +01:00
parent a1f254b91b
commit 15dd9b8996
1 changed files with 2 additions and 1 deletions

View File

@ -162,8 +162,9 @@ void gpio_input(gpio_t gpio_num)
void gpio_output(gpio_t gpio_num, int value)
{
gpio_or32(gpio_num, GPIO_OUTPUT_ENABLE);
/* set GPIO output value before setting the direction to output to avoid glitches */
gpio_set(gpio_num, value);
gpio_or32(gpio_num, GPIO_OUTPUT_ENABLE);
}
const char *gpio_acpi_path(gpio_t gpio)