summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-01-05 00:17:56 +0100
committerFelix Held <felix-coreboot@felixheld.de>2021-01-06 17:20:58 +0000
commit15dd9b89962a184cba4974c571960fe468f2a103 (patch)
tree69b56b9eba6a737a38a221629f9d1953fd09259e /src
parenta1f254b91b6bc0be67870629fc9aaa765671c649 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/common/block/gpio_banks/gpio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/soc/amd/common/block/gpio_banks/gpio.c b/src/soc/amd/common/block/gpio_banks/gpio.c
index 03804d56f1..bdc243fa2c 100644
--- a/src/soc/amd/common/block/gpio_banks/gpio.c
+++ b/src/soc/amd/common/block/gpio_banks/gpio.c
@@ -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)