From f2201e20debc42f2ce8f2c713901ff8183ddc293 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Mon, 13 Jan 2025 23:16:32 +0530 Subject: [PATCH] mb/google/fatcat/var/fatcat: Refactor GPIO programming for UFS support Refactor GPIO programming to support UFS storage on the fatcat platform. - Add pad configurations for UFS in `fw_config.c`. - Update `fw_config_configure_pre_mem_gpio()` and `fw_config_gpio_padbased_override()` to include UFS support. - Remove redundant UFS pad configuration from `gpio.c`. TEST=Able to build and boot from UFS device on google/fatcat. Change-Id: I09331d75501977d89592d1a70d5b0dca271f8747 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/85958 Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai --- .../google/fatcat/variants/fatcat/fw_config.c | 14 ++++++++------ src/mainboard/google/fatcat/variants/fatcat/gpio.c | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/mainboard/google/fatcat/variants/fatcat/fw_config.c b/src/mainboard/google/fatcat/variants/fatcat/fw_config.c index ac2155f7cd..0ba60485ae 100644 --- a/src/mainboard/google/fatcat/variants/fatcat/fw_config.c +++ b/src/mainboard/google/fatcat/variants/fatcat/fw_config.c @@ -210,6 +210,11 @@ static const struct pad_config gen4_ssd_pads[] = { PAD_CFG_GPO(GPP_B09, 1, PLTRST), }; +static const struct pad_config ufs_enable_pads[] = { + /* GPP_D21: GPP_D21_UFS_REFCLK */ + PAD_CFG_NF(GPP_D21, NONE, DEEP, NF1), +}; + /* Gen5 NVME: at the bottom M.2 slot */ static const struct pad_config pre_mem_gen5_ssd_pwr_pads[] = { /* GPP_B16: GEN5_SSD_PWREN */ @@ -484,12 +489,9 @@ void fw_config_configure_pre_mem_gpio(void) GPIO_CONFIGURE_PADS(pre_mem_gen4_ssd_pwr_pads); } else if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_NVME_GEN5))) { GPIO_CONFIGURE_PADS(pre_mem_gen5_ssd_pwr_pads); - /* TODO: else if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_UFS))) - */ } else if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_UNKNOWN))) { GPIO_CONFIGURE_PADS(pre_mem_gen4_ssd_pwr_pads); GPIO_CONFIGURE_PADS(pre_mem_gen5_ssd_pwr_pads); - /* TODO for UFS */ } if (!fw_config_probe(FW_CONFIG(SD, SD_NONE))) @@ -524,12 +526,12 @@ void fw_config_gpio_padbased_override(struct pad_config *padbased_table) GPIO_PADBASED_OVERRIDE(padbased_table, gen4_ssd_pads); } else if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_NVME_GEN5))) { GPIO_PADBASED_OVERRIDE(padbased_table, gen5_ssd_pads); - /* TODO: else if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_UFS))) - */ + } else if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_UFS))) { + GPIO_PADBASED_OVERRIDE(padbased_table, ufs_enable_pads); } else if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_UNKNOWN))) { GPIO_PADBASED_OVERRIDE(padbased_table, gen4_ssd_pads); GPIO_PADBASED_OVERRIDE(padbased_table, gen5_ssd_pads); - /* TODO for UFS */ + GPIO_PADBASED_OVERRIDE(padbased_table, ufs_enable_pads); } if (fw_config_probe(FW_CONFIG(AUDIO, AUDIO_NONE))) diff --git a/src/mainboard/google/fatcat/variants/fatcat/gpio.c b/src/mainboard/google/fatcat/variants/fatcat/gpio.c index d6fea0974e..cf1e040c03 100644 --- a/src/mainboard/google/fatcat/variants/fatcat/gpio.c +++ b/src/mainboard/google/fatcat/variants/fatcat/gpio.c @@ -175,8 +175,8 @@ static const struct pad_config gpio_table[] = { PAD_CFG_NF(GPP_D18, NONE, DEEP, NF1), /* GPP_D20: CSE_EARLY_SW */ PAD_CFG_GPI_SCI_HIGH(GPP_D20, NONE, DEEP, LEVEL), - /* GPP_D21: GPP_D21_UFS_REFCLK */ - PAD_CFG_NF(GPP_D21, NONE, DEEP, NF1), + /* GPP_D21: NC */ + PAD_NC(GPP_D21, NONE), /* GPP_D22: BPKI3C_SDA */ PAD_CFG_NF(GPP_D22, NONE, DEEP, NF1), /* GPP_D23: BPKI3C_SCL */