From 7aef2b1294f2da607b5e6b85dcf75fac4664ddd3 Mon Sep 17 00:00:00 2001 From: Eric Lai Date: Fri, 27 May 2022 09:32:06 +0800 Subject: mb/google/nissa: Apply gpio padbased table override In order to improve gpio merge mechanism. Change iteration override to padbased table override. And the following patch will change fw config override with ramstage gpio table override. BUG=b:231690996 TEST=check gpios in pinctrl are the same. Signed-off-by: Eric Lai Change-Id: I3d0beabc2c185405cb0af31e5506b6df94e9522c Reviewed-on: https://review.coreboot.org/c/coreboot/+/64713 Tested-by: build bot (Jenkins) Reviewed-by: Tim Wawrzynczak --- src/mainboard/google/brya/mainboard.c | 6 +++++- .../baseboard/include/baseboard/variants.h | 1 + .../brya/variants/baseboard/nissa/Makefile.inc | 1 + .../brya/variants/baseboard/nissa/ramstage.c | 23 ++++++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c (limited to 'src/mainboard/google/brya') diff --git a/src/mainboard/google/brya/mainboard.c b/src/mainboard/google/brya/mainboard.c index 3c5b2c39c9..7e933f359c 100644 --- a/src/mainboard/google/brya/mainboard.c +++ b/src/mainboard/google/brya/mainboard.c @@ -69,7 +69,7 @@ void __weak variant_init(void) /* default implementation does nothing */ } -static void mainboard_init(void *chip_info) +void __weak variant_configure_pads(void) { const struct pad_config *base_pads; const struct pad_config *override_pads; @@ -78,7 +78,11 @@ static void mainboard_init(void *chip_info) base_pads = variant_gpio_table(&base_num); override_pads = variant_gpio_override_table(&override_num); gpio_configure_pads_with_override(base_pads, base_num, override_pads, override_num); +} +static void mainboard_init(void *chip_info) +{ + variant_configure_pads(); variant_init(); variant_devtree_update(); } diff --git a/src/mainboard/google/brya/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/brya/variants/baseboard/include/baseboard/variants.h index 42e76227b6..ce849d0521 100644 --- a/src/mainboard/google/brya/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/brya/variants/baseboard/include/baseboard/variants.h @@ -23,6 +23,7 @@ int variant_memory_sku(void); bool variant_is_half_populated(void); void variant_update_soc_chip_config(struct soc_intel_alderlake_config *config); void variant_fill_ssdt(const struct device *dev); +void variant_configure_pads(void); enum s0ix_entry { S0IX_EXIT, diff --git a/src/mainboard/google/brya/variants/baseboard/nissa/Makefile.inc b/src/mainboard/google/brya/variants/baseboard/nissa/Makefile.inc index 1693d2e263..8a4b2acfaa 100644 --- a/src/mainboard/google/brya/variants/baseboard/nissa/Makefile.inc +++ b/src/mainboard/google/brya/variants/baseboard/nissa/Makefile.inc @@ -4,3 +4,4 @@ romstage-y += memory.c romstage-y += gpio.c ramstage-y += gpio.c +ramstage-y += ramstage.c diff --git a/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c b/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c new file mode 100644 index 0000000000..7f4e291abc --- /dev/null +++ b/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include +#include + +void variant_configure_pads(void) +{ + const struct pad_config *base_pads; + const struct pad_config *override_pads; + struct pad_config *padbased_table; + size_t base_num, override_num; + + padbased_table = new_padbased_table(); + base_pads = variant_gpio_table(&base_num); + gpio_padbased_override(padbased_table, base_pads, base_num); + override_pads = variant_gpio_override_table(&override_num); + gpio_padbased_override(padbased_table, override_pads, override_num); + gpio_configure_pads_with_padbased(padbased_table); + free(padbased_table); +} -- cgit v1.2.3