Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/49119 )
Change subject: soc/amd/common/block/gpio_banks: fix sequence in gpio_output ......................................................................
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 --- M src/soc/amd/common/block/gpio_banks/gpio.c 1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/19/49119/1
diff --git a/src/soc/amd/common/block/gpio_banks/gpio.c b/src/soc/amd/common/block/gpio_banks/gpio.c index 03804d5..bdc243f 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_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)
Raul Rangel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/49119 )
Change subject: soc/amd/common/block/gpio_banks: fix sequence in gpio_output ......................................................................
Patch Set 1: Code-Review+2
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/49119 )
Change subject: soc/amd/common/block/gpio_banks: fix sequence in gpio_output ......................................................................
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 --- M src/soc/amd/common/block/gpio_banks/gpio.c 1 file changed, 2 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Raul Rangel: Looks good to me, approved
diff --git a/src/soc/amd/common/block/gpio_banks/gpio.c b/src/soc/amd/common/block/gpio_banks/gpio.c index 03804d5..bdc243f 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_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)