From 5f69b867f0c9ec9c0afab4df70a3d0d06809957a Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Fri, 23 Sep 2022 14:51:12 -0500 Subject: mb/google/skyrim: Allow variants to override romstage GPIO table Switch from gpio_configure_pads() to gpio_configure_pads_with_override() so variants can override romstage GPIO defaults. Rename baseboard function and add an weak empty override function to be used by variants. Will be used for touchscreen power sequencing in a follow-on commit. Change-Id: I45586237919cd07a171beac57f3510e26338f67f Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/67811 Tested-by: build bot (Jenkins) Reviewed-by: Raul Rangel --- src/mainboard/google/skyrim/romstage.c | 12 ++++++------ src/mainboard/google/skyrim/variants/baseboard/gpio.c | 8 +++++++- .../skyrim/variants/baseboard/include/baseboard/variants.h | 5 ++++- 3 files changed, 17 insertions(+), 8 deletions(-) (limited to 'src/mainboard/google/skyrim') diff --git a/src/mainboard/google/skyrim/romstage.c b/src/mainboard/google/skyrim/romstage.c index cf93fc5685..ce25ee9182 100644 --- a/src/mainboard/google/skyrim/romstage.c +++ b/src/mainboard/google/skyrim/romstage.c @@ -5,11 +5,11 @@ void mb_pre_fspm(FSP_M_CONFIG *mcfg) { - size_t base_num_gpios; - const struct soc_amd_gpio *base_gpios; + size_t num_base_gpios, num_override_gpios; + const struct soc_amd_gpio *base_gpios, *override_gpios; - /* Initialize PCIe reset. */ - variant_romstage_gpio_table(&base_gpios, &base_num_gpios); - - gpio_configure_pads(base_gpios, base_num_gpios); + baseboard_romstage_gpio_table(&base_gpios, &num_base_gpios); + variant_romstage_override_gpio_table(&override_gpios, &num_override_gpios); + gpio_configure_pads_with_override(base_gpios, num_base_gpios, + override_gpios, num_override_gpios); } diff --git a/src/mainboard/google/skyrim/variants/baseboard/gpio.c b/src/mainboard/google/skyrim/variants/baseboard/gpio.c index b234a5dee3..b44114e48c 100644 --- a/src/mainboard/google/skyrim/variants/baseboard/gpio.c +++ b/src/mainboard/google/skyrim/variants/baseboard/gpio.c @@ -202,12 +202,18 @@ static const struct soc_amd_gpio romstage_gpio_table[] = { PAD_GPO(GPIO_6, HIGH), }; -__weak void variant_romstage_gpio_table(const struct soc_amd_gpio **gpio, size_t *size) +void baseboard_romstage_gpio_table(const struct soc_amd_gpio **gpio, size_t *size) { *size = ARRAY_SIZE(romstage_gpio_table); *gpio = romstage_gpio_table; } +__weak void variant_romstage_override_gpio_table(const struct soc_amd_gpio **gpio, size_t *size) +{ + *size = 0; + *gpio = NULL; +} + void baseboard_gpio_table(const struct soc_amd_gpio **gpio, size_t *size) { *size = ARRAY_SIZE(base_gpio_table); diff --git a/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/variants.h index 73ccc03991..4d71c5cc5c 100644 --- a/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/variants.h @@ -39,6 +39,9 @@ void variant_espi_gpio_table(const struct soc_amd_gpio **gpio, size_t *size); void variant_tpm_gpio_table(const struct soc_amd_gpio **gpio, size_t *size); /* This function provides GPIO settings in romstage. */ -void variant_romstage_gpio_table(const struct soc_amd_gpio **gpio, size_t *size); +void baseboard_romstage_gpio_table(const struct soc_amd_gpio **gpio, size_t *size); + +/* This function allows variant to override any GPIO init in romstage. */ +void variant_romstage_override_gpio_table(const struct soc_amd_gpio **gpio, size_t *size); #endif /* __BASEBOARD_VARIANTS_H__ */ -- cgit v1.2.3