mb/google/nissa/var/craask: Disable storage devices based on fw_config

Disable devices in variant.c instead of adding probe statements to
devicetree because storage devices need to be enabled when fw_config is
unprovisioned, and devicetree does not currently support this (it
disables all probed devices when fw_config is unprovisioned).

BUG=b:263920313
TEST=Boot to OS on craask eMMC and NVMe SKUs with both unprovisioned
fw_config and fw_config set correctly.

Change-Id: I4167ee4d00b9ae8fe074c6f5e7a2d5a7382bfe6d
Signed-off-by: Reka Norman <rekanorman@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/71726
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Ren Kuo <ren.kuo@quanta.corp-partner.google.com>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Reviewed-by: Kangheui Won <khwon@chromium.org>
This commit is contained in:
Reka Norman 2023-01-06 10:51:37 +11:00 committed by Eric Lai
parent 72fb5a915a
commit 8b32e404e1
2 changed files with 56 additions and 0 deletions

View File

@ -47,6 +47,33 @@ static const struct pad_config stylus_disable_pads[] = {
PAD_NC_LOCK(GPP_F15, NONE, LOCK_CONFIG), PAD_NC_LOCK(GPP_F15, NONE, LOCK_CONFIG),
}; };
static const struct pad_config emmc_disable_pads[] = {
/* I7 : EMMC_CMD */
PAD_NC(GPP_I7, NONE),
/* I8 : EMMC_D0 */
PAD_NC(GPP_I8, NONE),
/* I9 : EMMC_D1 */
PAD_NC(GPP_I9, NONE),
/* I10 : EMMC_D2 */
PAD_NC(GPP_I10, NONE),
/* I11 : EMMC_D3 */
PAD_NC(GPP_I11, NONE),
/* I12 : EMMC_D4 */
PAD_NC(GPP_I12, NONE),
/* I13 : EMMC_D5 */
PAD_NC(GPP_I13, NONE),
/* I14 : EMMC_D6 */
PAD_NC(GPP_I14, NONE),
/* I15 : EMMC_D7 */
PAD_NC(GPP_I15, NONE),
/* I16 : EMMC_RCLK */
PAD_NC(GPP_I16, NONE),
/* I17 : EMMC_CLK */
PAD_NC(GPP_I17, NONE),
/* I18 : EMMC_RST_L */
PAD_NC(GPP_I18, NONE),
};
static const struct pad_config nvme_disable_pads[] = { static const struct pad_config nvme_disable_pads[] = {
/* B4 : SSD_PERST_L */ /* B4 : SSD_PERST_L */
PAD_NC_LOCK(GPP_B4, NONE, LOCK_CONFIG), PAD_NC_LOCK(GPP_B4, NONE, LOCK_CONFIG),
@ -84,6 +111,12 @@ void fw_config_gpio_padbased_override(struct pad_config *padbased_table)
ARRAY_SIZE(stylus_disable_pads)); ARRAY_SIZE(stylus_disable_pads));
} }
if (fw_config_is_provisioned() && !fw_config_probe(FW_CONFIG(STORAGE, STORAGE_EMMC))) {
printk(BIOS_INFO, "Disable eMMC GPIO pins.\n");
gpio_padbased_override(padbased_table, emmc_disable_pads,
ARRAY_SIZE(emmc_disable_pads));
}
if (fw_config_is_provisioned() && !fw_config_probe(FW_CONFIG(STORAGE, STORAGE_NVME))) { if (fw_config_is_provisioned() && !fw_config_probe(FW_CONFIG(STORAGE, STORAGE_NVME))) {
printk(BIOS_INFO, "Disable NVMe SSD GPIO pins.\n"); printk(BIOS_INFO, "Disable NVMe SSD GPIO pins.\n");
gpio_padbased_override(padbased_table, nvme_disable_pads, gpio_padbased_override(padbased_table, nvme_disable_pads,

View File

@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
#include <baseboard/variants.h>
#include <console/console.h> #include <console/console.h>
#include <device/device.h>
#include <fw_config.h> #include <fw_config.h>
#include <sar.h> #include <sar.h>
@ -8,3 +10,24 @@ const char *get_wifi_sar_cbfs_filename(void)
{ {
return get_wifi_sar_fw_config_filename(FW_CONFIG_FIELD(WIFI_SAR_ID)); return get_wifi_sar_fw_config_filename(FW_CONFIG_FIELD(WIFI_SAR_ID));
} }
void variant_devtree_update(void)
{
struct device *emmc = DEV_PTR(emmc);
struct device *nvme_rp = DEV_PTR(pcie_rp9);
if (!fw_config_is_provisioned()) {
printk(BIOS_INFO, "fw_config unprovisioned so enable all storage devices\n");
return;
}
if (!fw_config_probe(FW_CONFIG(STORAGE, STORAGE_EMMC))) {
printk(BIOS_INFO, "eMMC disabled by fw_config\n");
emmc->enabled = 0;
}
if (!fw_config_probe(FW_CONFIG(STORAGE, STORAGE_NVME))) {
printk(BIOS_INFO, "NVMe disabled by fw_config\n");
nvme_rp->enabled = 0;
}
}