summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Hsieh <mark_hsieh@wistron.corp-partner.google.com>2023-06-09 17:55:27 +0800
committerFelix Held <felix-coreboot@felixheld.de>2023-06-16 18:06:31 +0000
commit28735a17f2020dc10f7ac22df199492585ed5142 (patch)
tree8c30019abb17444bca7960b1b17e80455454f699
parent40f0dafd141d7f97c7295c892f10a10967c775aa (diff)
mb/google/nissa/var/joxer: 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.). - Removed `bootblock-y += variant.c` from Makefile.inc based on CL:3841120.(The infrastructure for selecting an appropriate firmware image to use the right descriptor is now ready so runtime descriptor updates are no longer necessary.). BUG=b:285477026 TEST=USE="project_joxer emerge-nissa coreboot" Signed-off-by: Mark Hsieh <mark_hsieh@wistron.corp-partner.google.com> Change-Id: I6920d88dfec86676ff6733146f748e06d4085c49 Reviewed-on: https://review.coreboot.org/c/coreboot/+/75743 Reviewed-by: Derek Huang <derekhuang@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
-rw-r--r--src/mainboard/google/brya/variants/joxer/Makefile.inc4
-rw-r--r--src/mainboard/google/brya/variants/joxer/fw_config.c42
-rw-r--r--src/mainboard/google/brya/variants/joxer/variant.c24
3 files changed, 68 insertions, 2 deletions
diff --git a/src/mainboard/google/brya/variants/joxer/Makefile.inc b/src/mainboard/google/brya/variants/joxer/Makefile.inc
index 32e31738cf..86ba20d3c3 100644
--- a/src/mainboard/google/brya/variants/joxer/Makefile.inc
+++ b/src/mainboard/google/brya/variants/joxer/Makefile.inc
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: GPL-2.0-only
bootblock-y += gpio.c
-bootblock-y += variant.c
romstage-y += gpio.c
+ramstage-$(CONFIG_FW_CONFIG) += fw_config.c
+ramstage-$(CONFIG_FW_CONFIG) += variant.c
ramstage-y += gpio.c
-ramstage-y += variant.c
diff --git a/src/mainboard/google/brya/variants/joxer/fw_config.c b/src/mainboard/google/brya/variants/joxer/fw_config.c
new file mode 100644
index 0000000000..800fc1f205
--- /dev/null
+++ b/src/mainboard/google/brya/variants/joxer/fw_config.c
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <baseboard/gpio.h>
+#include <baseboard/variants.h>
+#include <console/console.h>
+#include <fw_config.h>
+
+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),
+};
+
+void fw_config_gpio_padbased_override(struct pad_config *padbased_table)
+{
+ 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));
+ }
+}
diff --git a/src/mainboard/google/brya/variants/joxer/variant.c b/src/mainboard/google/brya/variants/joxer/variant.c
index 3a0522078d..7db0617d8a 100644
--- a/src/mainboard/google/brya/variants/joxer/variant.c
+++ b/src/mainboard/google/brya/variants/joxer/variant.c
@@ -2,6 +2,7 @@
#include <baseboard/variants.h>
#include <console/console.h>
+#include <device/device.h>
#include <fw_config.h>
#include <soc/bootblock.h>
#include <sar.h>
@@ -10,3 +11,26 @@ const char *get_wifi_sar_cbfs_filename(void)
{
return "wifi_sar_0.hex";
}
+
+void variant_devtree_update(void)
+{
+ struct device *emmc = DEV_PTR(emmc);
+ struct device *ufs = DEV_PTR(ufs);
+ struct device *ish = DEV_PTR(ish);
+
+ 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_UFS))) {
+ printk(BIOS_INFO, "UFS disabled by fw_config\n");
+ ufs->enabled = 0;
+ ish->enabled = 0;
+ }
+}