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 <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85958
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <ericllai@google.com>
This commit is contained in:
Subrata Banik 2025-01-13 23:16:32 +05:30
commit f2201e20de
2 changed files with 10 additions and 8 deletions

View file

@ -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)))

View file

@ -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 */