From 8924280eb1024401082ac3a7f84eaf2498963ce6 Mon Sep 17 00:00:00 2001 From: Tarun Tuli Date: Sat, 29 Oct 2022 17:17:46 +0000 Subject: mb/google/hatch: Add variant finalize support for hatch devices Provide a variant_finalize() method and call to be invoked from mainboard_ops.final BUG=b:245953688 TEST=Hatch and variants build BRANCH=Hatch Signed-off-by: Tarun Tuli Change-Id: I9253ed4be1b08d0c7f65526c9b26dbcd00ffccc7 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68821 Reviewed-by: Nick Vaccaro Tested-by: build bot (Jenkins) --- src/mainboard/google/hatch/ramstage.c | 15 +++++++++++++++ src/mainboard/google/hatch/variants/baseboard/gpio.c | 7 +++++++ .../hatch/variants/baseboard/include/baseboard/variants.h | 6 ++++++ 3 files changed, 28 insertions(+) (limited to 'src/mainboard') diff --git a/src/mainboard/google/hatch/ramstage.c b/src/mainboard/google/hatch/ramstage.c index ff466a34a8..6cce734c90 100644 --- a/src/mainboard/google/hatch/ramstage.c +++ b/src/mainboard/google/hatch/ramstage.c @@ -55,7 +55,22 @@ static void mainboard_chip_init(void *chip_info) variant_ramstage_init(); } +void __weak variant_final(void) +{ +} + +static void mainboard_final(void *chip_info) +{ + const struct pad_config *variant_finalize; + size_t variant_gpios; + variant_finalize = variant_finalize_gpio_table(&variant_gpios); + gpio_configure_pads(variant_finalize, variant_gpios); + + variant_final(); +} + struct chip_operations mainboard_ops = { .init = mainboard_chip_init, .enable_dev = mainboard_enable, + .final = mainboard_final, }; diff --git a/src/mainboard/google/hatch/variants/baseboard/gpio.c b/src/mainboard/google/hatch/variants/baseboard/gpio.c index eab831aabf..c65375e2ec 100644 --- a/src/mainboard/google/hatch/variants/baseboard/gpio.c +++ b/src/mainboard/google/hatch/variants/baseboard/gpio.c @@ -433,3 +433,10 @@ const struct pad_config *__weak variant_early_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) +{ + *num = 0; + return NULL; +} 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 125f7388a1..62479eb6cd 100644 --- a/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h @@ -27,12 +27,18 @@ const struct pad_config *variant_sleep_gpio_table(u8 slp_typ, size_t *num); /* Return GPIO pads that need to be configured before ramstage */ const struct pad_config *variant_early_gpio_table(size_t *num); +/* Return GPIO pads that need to be configured after ramstage */ +const struct pad_config *variant_finalize_gpio_table(size_t *num); + /* Modify devictree settings during ramstage. */ void variant_devtree_update(void); /* Perform variant specific initialization early on in ramstage. */ void variant_ramstage_init(void); +/* Perform variant specific mainboard finalization */ +void variant_final(void); + /* Perform variant specific mainboard initialization */ void variant_mainboard_enable(struct device *dev); -- cgit v1.2.3