mb/google/brya: Add CFR-based storage selection for taeko/taniks

Add support for selecting NVMe or eMMC storage via CFR option on
taeko and taniks variants. Override fw_config_probe() to check the
CFR "storage_device" option and enable/disable the appropriate PCIe
root port based on user selection.

This allows runtime configuration of storage devices while ensuring
only the selected device is initialized, since initializing both
causes neither to be detected.

TEST=build/boot taeko, verify both eMMC and NVMe M.2 storage modules
functional when correct type selected from setup menu.

Change-Id: Ic555f93763736adb5837534b8011aa9c123fea08
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90742
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Matt DeVillier 2025-12-14 18:13:21 -06:00
commit e0bc32ce61
5 changed files with 106 additions and 0 deletions

View file

@ -6,6 +6,32 @@
#include <intelblocks/cfr.h>
#include <soc/cfr.h>
#if CONFIG(BOARD_GOOGLE_TANIKS) || CONFIG(BOARD_GOOGLE_TAEKO)
enum storage_device {
STORAGE_NVME = 0,
STORAGE_EMMC = 1,
};
static const struct sm_object storage_device_opt = SM_DECLARE_ENUM({
.opt_name = "storage_device",
.ui_name = "Storage Device",
.ui_helptext = "Select which storage device to use (NVMe SSD or eMMC)",
.default_value = STORAGE_NVME,
.values = (const struct sm_enum_value[]) {
{ "NVMe SSD", STORAGE_NVME },
{ "eMMC", STORAGE_EMMC },
SM_ENUM_VALUE_END },
});
static struct sm_obj_form devices = {
.ui_name = "Devices",
.obj_list = (const struct sm_object *[]) {
&storage_device_opt,
NULL
},
};
#endif
static struct sm_obj_form system = {
.ui_name = "System",
.obj_list = (const struct sm_object *[]) {
@ -37,6 +63,9 @@ static struct sm_obj_form ec = {
static struct sm_obj_form *sm_root[] = {
&system,
#if CONFIG(BOARD_GOOGLE_TANIKS) || CONFIG(BOARD_GOOGLE_TAEKO)
&devices,
#endif
&ec,
NULL
};

View file

@ -8,6 +8,7 @@ romstage-y += memory.c
ramstage-y += gpio.c
romstage-$(CONFIG_FW_CONFIG) += fw_config.c
ramstage-$(CONFIG_FW_CONFIG) += fw_config.c
ramstage-$(CONFIG_FW_CONFIG) += variant.c

View file

@ -4,6 +4,44 @@
#include <console/console.h>
#include <fw_config.h>
#include <gpio.h>
#include <option.h>
#include <string.h>
#include <types.h>
enum storage_device {
STORAGE_NVME = 0,
STORAGE_EMMC = 1,
};
/* Override fw_config_probe_mainboard_override to check CFR for storage selection */
bool fw_config_probe_mainboard_override(const struct fw_config *match, bool *result)
{
/* Check if this is a storage-related probe */
if (match->field_name) {
/* Read CFR option directly - default to NVMe if not available */
uint8_t storage_selection = get_uint_option("storage_device", STORAGE_NVME);
if (strcmp(match->field_name, "BOOT_NVME_MASK") == 0) {
/* NVMe is enabled if storage selection is NVMe */
*result = (storage_selection == STORAGE_NVME);
if (*result) {
printk(BIOS_INFO, "fw_config: NVMe enabled by CFR\n");
}
return true;
}
if (strcmp(match->field_name, "BOOT_EMMC_MASK") == 0) {
/* eMMC is enabled if storage selection is eMMC */
*result = (storage_selection == STORAGE_EMMC);
if (*result) {
printk(BIOS_INFO, "fw_config: eMMC enabled by CFR\n");
}
return true;
}
}
/* Not handled - use standard fw_config logic */
return false;
}
static const struct pad_config dmic_enable_pads[] = {
PAD_CFG_NF(GPP_S2, NONE, DEEP, NF2), /* DMIC_CLK0_R */

View file

@ -6,6 +6,7 @@ romstage-y += gpio.c
romstage-y += memory.c
ramstage-y += gpio.c
romstage-$(CONFIG_FW_CONFIG) += fw_config.c
ramstage-$(CONFIG_FW_CONFIG) += fw_config.c
ramstage-$(CONFIG_FW_CONFIG) += variant.c

View file

@ -4,6 +4,43 @@
#include <console/console.h>
#include <fw_config.h>
#include <gpio.h>
#include <option.h>
#include <string.h>
#include <types.h>
enum storage_device {
STORAGE_NVME = 0,
STORAGE_EMMC = 1,
};
/* Override fw_config_probe_mainboard_override to check CFR for storage selection */
bool fw_config_probe_mainboard_override(const struct fw_config *match, bool *result)
{
/* Check if this is a storage-related probe */
if (match->field_name) {
/* Read CFR option directly - default to NVMe if not available */
uint8_t storage_selection = get_uint_option("storage_device", STORAGE_NVME);
if (strcmp(match->field_name, "BOOT_NVME_MASK") == 0) {
/* NVMe is enabled if storage selection is NVMe */
*result = (storage_selection == STORAGE_NVME);
if (*result) {
printk(BIOS_INFO, "fw_config: NVMe enabled by CFR\n");
}
return true;
}
if (strcmp(match->field_name, "BOOT_EMMC_MASK") == 0) {
/* eMMC is enabled if storage selection is eMMC */
*result = (storage_selection == STORAGE_EMMC);
if (*result) {
printk(BIOS_INFO, "fw_config: eMMC enabled by CFR\n");
}
return true;
}
}
/* Not handled - use standard fw_config logic */
return false;
}
static const struct pad_config dmic_enable_pads[] = {
PAD_CFG_NF(GPP_S2, NONE, DEEP, NF2), /* DMIC_CLK0_R */