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 <matt.devillier@amd.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/67811
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
diff --git a/src/mainboard/google/skyrim/romstage.c b/src/mainboard/google/skyrim/romstage.c
index cf93fc5..ce25ee9 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 b234a5d..b44114e 100644
--- a/src/mainboard/google/skyrim/variants/baseboard/gpio.c
+++ b/src/mainboard/google/skyrim/variants/baseboard/gpio.c
@@ -202,12 +202,18 @@
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 73ccc03..4d71c5c 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_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__ */