aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-07-28 20:30:17 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-07-30 23:14:28 +0000
commit21813c3577831548a8a1ff9da64334f9c3a96d3a (patch)
treef5e9f021e264e290ed026494247343f110f62b08 /src
parente8fd7a42e0458d528944168b5a93587b4a437b23 (diff)
soc/amd/common/block/gpio_banks/gpio: factor out set_gpio_mux
Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I75f1e45ead4a5f04cba1eecb220ef027a8bfd09e Reviewed-on: https://review.coreboot.org/c/coreboot/+/56678 Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/common/block/gpio_banks/gpio.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/soc/amd/common/block/gpio_banks/gpio.c b/src/soc/amd/common/block/gpio_banks/gpio.c
index 711b779e51..85f273646b 100644
--- a/src/soc/amd/common/block/gpio_banks/gpio.c
+++ b/src/soc/amd/common/block/gpio_banks/gpio.c
@@ -160,6 +160,12 @@ uint16_t gpio_acpi_pin(gpio_t gpio)
return gpio;
}
+static void set_gpio_mux(gpio_t gpio, uint8_t function)
+{
+ iomux_write8(gpio, function & AMD_GPIO_MUX_MASK);
+ iomux_read8(gpio); /* Flush posted write */
+}
+
static void set_single_gpio(const struct soc_amd_gpio *g)
{
static const struct soc_amd_event *gev_tbl;
@@ -168,8 +174,7 @@ static void set_single_gpio(const struct soc_amd_gpio *g)
const bool can_set_smi_flags = !(CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK) &&
ENV_SEPARATE_VERSTAGE);
- iomux_write8(g->gpio, g->function & AMD_GPIO_MUX_MASK);
- iomux_read8(g->gpio); /* Flush posted write */
+ set_gpio_mux(g->gpio, g->function);
gpio_setbits32(g->gpio, PAD_CFG_MASK, g->control);
/* Clear interrupt and wake status (write 1-to-clear bits) */