From c0edb925e67b946320dbdfe1a68c4f19ca161d6e Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 18 Dec 2022 14:59:31 -0600 Subject: [PATCH] mb/google/hatch: Add method to set GPIOs in romstage Add method variant_romstage_gpio_table() with empty weak implementation to allow variants to override as needed for touchscreen power sequencing (to be implemented in a subsequent commit). Call method in romstage to program any GPIOs the variant may need to set. TEST=tested with rest of patch train Change-Id: I1939387b5bb98d6d282fd044e9ce8780dbe0d2c5 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/71058 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/mainboard/google/hatch/romstage.c | 5 +++++ src/mainboard/google/hatch/variants/baseboard/gpio.c | 6 ++++++ .../hatch/variants/baseboard/include/baseboard/variants.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/src/mainboard/google/hatch/romstage.c b/src/mainboard/google/hatch/romstage.c index eb5153c133..710f1cea99 100644 --- a/src/mainboard/google/hatch/romstage.c +++ b/src/mainboard/google/hatch/romstage.c @@ -31,6 +31,8 @@ void mainboard_memory_init_params(FSPM_UPD *memupd) struct cnl_mb_cfg memcfg; int mem_sku; int is_single_ch_mem; + const struct pad_config *pads; + size_t pads_num; variant_memory_params(&memcfg); mem_sku = variant_memory_sku(); @@ -53,4 +55,7 @@ void mainboard_memory_init_params(FSPM_UPD *memupd) } cannonlake_memcfg_init(&memupd->FspmConfig, &memcfg); + + pads = variant_romstage_gpio_table(&pads_num); + gpio_configure_pads(pads, pads_num); } diff --git a/src/mainboard/google/hatch/variants/baseboard/gpio.c b/src/mainboard/google/hatch/variants/baseboard/gpio.c index c65375e2ec..609fbf742a 100644 --- a/src/mainboard/google/hatch/variants/baseboard/gpio.c +++ b/src/mainboard/google/hatch/variants/baseboard/gpio.c @@ -434,6 +434,12 @@ const struct pad_config *__weak variant_early_gpio_table(size_t *num) return NULL; } +/* Weak implementation of romstage gpio */ +const struct pad_config *__weak variant_romstage_gpio_table(size_t *num) +{ + *num = 0; + return NULL; +} /* Weak implementation of finalize gpio */ const struct pad_config *__weak variant_finalize_gpio_table(size_t *num) { diff --git a/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h index 62479eb6cd..0ec473b284 100644 --- a/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h @@ -24,6 +24,9 @@ int variant_memory_sku(void); /* Return variant specific gpio pads to be configured during sleep */ const struct pad_config *variant_sleep_gpio_table(u8 slp_typ, size_t *num); +/* Return GPIO pads that need to be configured during romstage */ +const struct pad_config *variant_romstage_gpio_table(size_t *num); + /* Return GPIO pads that need to be configured before ramstage */ const struct pad_config *variant_early_gpio_table(size_t *num);