diff options
author | Eric Lai <eric_lai@quanta.corp-partner.google.com> | 2022-05-27 09:43:43 +0800 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2022-06-29 13:55:49 +0000 |
commit | a8d2cb86b5ed49c1968d908a0652d41689af32ae (patch) | |
tree | 55ac98f0a65f5e9a4917fc42763289a7ad63c056 /src | |
parent | 8b9bc48f4d76d800e63f311fe087a0fd58bab89a (diff) |
mb/google/nissa: Change fw config override to pad_number table based
BUG=b:231690996
TEST=gpios are the same in kernel pinctrl dump.
Signed-off-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Change-Id: I67a466fac478b2a3a682451174fbdcdd67816769
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64714
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Reka Norman <rekanorman@chromium.org>
Diffstat (limited to 'src')
5 files changed, 33 insertions, 19 deletions
diff --git a/src/mainboard/google/brya/mainboard.c b/src/mainboard/google/brya/mainboard.c index 7e933f359c..78bd30e000 100644 --- a/src/mainboard/google/brya/mainboard.c +++ b/src/mainboard/google/brya/mainboard.c @@ -69,6 +69,11 @@ void __weak variant_init(void) /* default implementation does nothing */ } +void __weak fw_config_gpio_padbased_override(struct pad_config *padbased_table) +{ + /* default implementation does nothing */ +} + void __weak variant_configure_pads(void) { const struct pad_config *base_pads; 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 ce849d0521..ad8eb05833 100644 --- a/src/mainboard/google/brya/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/brya/variants/baseboard/include/baseboard/variants.h @@ -16,6 +16,7 @@ const struct pad_config *variant_gpio_table(size_t *num); const struct pad_config *variant_gpio_override_table(size_t *num); const struct pad_config *variant_early_gpio_table(size_t *num); const struct pad_config *variant_romstage_gpio_table(size_t *num); +void fw_config_gpio_padbased_override(struct pad_config *padbased_table); const struct mb_cfg *variant_memory_params(void); void variant_get_spd_info(struct mem_spd *spd_info); diff --git a/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c b/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c index 7f4e291abc..670f8e392a 100644 --- a/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c +++ b/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c @@ -18,6 +18,7 @@ void variant_configure_pads(void) 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); + fw_config_gpio_padbased_override(padbased_table); gpio_configure_pads_with_padbased(padbased_table); free(padbased_table); } diff --git a/src/mainboard/google/brya/variants/craask/fw_config.c b/src/mainboard/google/brya/variants/craask/fw_config.c index ab89099951..8a318dddaa 100644 --- a/src/mainboard/google/brya/variants/craask/fw_config.c +++ b/src/mainboard/google/brya/variants/craask/fw_config.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include <baseboard/gpio.h> +#include <baseboard/variants.h> #include <bootstate.h> #include <console/console.h> #include <fw_config.h> @@ -45,25 +46,28 @@ static const struct pad_config sd_disable_pads[] = { PAD_NC(GPP_H13, NONE), }; -static void fw_config_handle(void *unused) +void fw_config_gpio_padbased_override(struct pad_config *padbased_table) { if (fw_config_probe(FW_CONFIG(DB_USB, DB_1C_LTE))) { printk(BIOS_INFO, "Enable LTE-related GPIO pins.\n"); - gpio_configure_pads(lte_enable_pads, ARRAY_SIZE(lte_enable_pads)); + gpio_padbased_override(padbased_table, lte_enable_pads, + ARRAY_SIZE(lte_enable_pads)); } else { printk(BIOS_INFO, "Disable LTE-related GPIO pins on craask.\n"); - gpio_configure_pads(lte_disable_pads, ARRAY_SIZE(lte_disable_pads)); + gpio_padbased_override(padbased_table, lte_disable_pads, + ARRAY_SIZE(lte_disable_pads)); } if (fw_config_probe(FW_CONFIG(WFC, WFC_ABSENT))) { printk(BIOS_INFO, "Disable MIPI WFC GPIO pins.\n"); - gpio_configure_pads(wfc_disable_pads, ARRAY_SIZE(wfc_disable_pads)); + gpio_padbased_override(padbased_table, wfc_disable_pads, + ARRAY_SIZE(wfc_disable_pads)); } if (fw_config_probe(FW_CONFIG(SD_CARD, SD_ABSENT))) { printk(BIOS_INFO, "Disable SD card GPIO pins.\n"); - gpio_configure_pads(sd_disable_pads, ARRAY_SIZE(sd_disable_pads)); + gpio_padbased_override(padbased_table, sd_disable_pads, + ARRAY_SIZE(sd_disable_pads)); } } -BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL); diff --git a/src/mainboard/google/brya/variants/nivviks/fw_config.c b/src/mainboard/google/brya/variants/nivviks/fw_config.c index 958621380a..af1461b573 100644 --- a/src/mainboard/google/brya/variants/nivviks/fw_config.c +++ b/src/mainboard/google/brya/variants/nivviks/fw_config.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include <baseboard/gpio.h> +#include <baseboard/variants.h> #include <boardid.h> #include <bootstate.h> #include <console/console.h> @@ -91,45 +92,47 @@ static const struct pad_config nvme_disable_pads[] = { PAD_NC(GPP_E17, NONE), }; -static void fw_config_handle(void *unused) +void fw_config_gpio_padbased_override(struct pad_config *padbased_table) { if (fw_config_probe(FW_CONFIG(DB_USB, DB_1C_LTE))) { printk(BIOS_INFO, "Enable LTE-related GPIO pins.\n"); - gpio_configure_pads(lte_enable_pads, ARRAY_SIZE(lte_enable_pads)); + gpio_padbased_override(padbased_table, lte_enable_pads, + ARRAY_SIZE(lte_enable_pads)); } else { if (board_id() >= 2) { printk(BIOS_INFO, "Disable LTE-related GPIO pins on nirwen.\n"); - gpio_configure_pads( - lte_disable_pads_nirwen, - ARRAY_SIZE(lte_disable_pads_nirwen) + gpio_padbased_override(padbased_table, lte_disable_pads_nirwen, + ARRAY_SIZE(lte_disable_pads_nirwen) ); } else { printk(BIOS_INFO, "Disable LTE-related GPIO pins on nivviks.\n"); - gpio_configure_pads( - lte_disable_pads_nivviks, - ARRAY_SIZE(lte_disable_pads_nivviks) + gpio_padbased_override(padbased_table, lte_disable_pads_nivviks, + ARRAY_SIZE(lte_disable_pads_nivviks) ); } } if (fw_config_probe(FW_CONFIG(SD_CARD, SD_ABSENT))) { printk(BIOS_INFO, "Disable SD card GPIO pins.\n"); - gpio_configure_pads(sd_disable_pads, ARRAY_SIZE(sd_disable_pads)); + gpio_padbased_override(padbased_table, sd_disable_pads, + ARRAY_SIZE(sd_disable_pads)); } if (fw_config_probe(FW_CONFIG(WFC, WFC_ABSENT))) { printk(BIOS_INFO, "Disable MIPI WFC GPIO pins.\n"); - gpio_configure_pads(wfc_disable_pads, ARRAY_SIZE(wfc_disable_pads)); + gpio_padbased_override(padbased_table, wfc_disable_pads, + ARRAY_SIZE(wfc_disable_pads)); } if (!fw_config_probe(FW_CONFIG(STORAGE, STORAGE_EMMC))) { printk(BIOS_INFO, "Disable eMMC SSD GPIO pins.\n"); - gpio_configure_pads(emmc_disable_pads, ARRAY_SIZE(emmc_disable_pads)); + gpio_padbased_override(padbased_table, emmc_disable_pads, + ARRAY_SIZE(emmc_disable_pads)); } if (board_id() >= 2 && !fw_config_probe(FW_CONFIG(STORAGE, STORAGE_NVME))) { printk(BIOS_INFO, "Disable NVMe SSD GPIO pins.\n"); - gpio_configure_pads(nvme_disable_pads, ARRAY_SIZE(nvme_disable_pads)); + gpio_padbased_override(padbased_table, nvme_disable_pads, + ARRAY_SIZE(nvme_disable_pads)); } } -BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL); |