From 514277f7462e338c41c27e37198725923128d039 Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Tue, 9 Aug 2022 15:54:05 +0800 Subject: mb/google/cherry: Initialize PCIe by SKU encoding All cherry boards (tomato, dojo) share the same SKU ID encoding, in the sense that a device has NVMe storage if and only if the BIT(1) of SKU ID is set (otherwise eMMC). Therefore, instead of hard coding the list of NVMe (PCIe) SKU IDs, we check the BIT(1) to decide whether to initialize PCIe. In addition, in preparation for UFS devices coming in the future, reserve BIT(3) (which is unset for all of current SKUs) for them. BUG=b:237953117, b:233327674 TEST=emerge-cherry coreboot BRANCH=cherry Change-Id: I9b30338645a87f29f96a249808b90f1ec16f82df Signed-off-by: Yu-Ping Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/66580 Tested-by: build bot (Jenkins) Reviewed-by: Yidi Lin Reviewed-by: Hung-Te Lin --- src/mainboard/google/cherry/mainboard.c | 39 ++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mainboard/google/cherry/mainboard.c b/src/mainboard/google/cherry/mainboard.c index c67a581c77..704a299e0c 100644 --- a/src/mainboard/google/cherry/mainboard.c +++ b/src/mainboard/google/cherry/mainboard.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -20,6 +21,7 @@ #include #include #include +#include #include "gpio.h" @@ -31,28 +33,29 @@ bool mainboard_needs_pcie_init(void) { - uint32_t sku; + uint32_t sku = sku_id(); - if (!CONFIG(BOARD_GOOGLE_DOJO)) - return false; - - sku = sku_id(); - switch (sku) { - case 0: - case 1: - case 4: - case 5: - return false; - case 2: - case 3: - case 6: - case 7: + if (sku == CROS_SKU_UNKNOWN) { + printk(BIOS_WARNING, "Unknown SKU (%#x); assuming PCIe", sku); return true; - default: - /* For example CROS_SKU_UNPROVISIONED */ - printk(BIOS_WARNING, "Unexpected sku %#x; assuming PCIe", sku); + } else if (sku == CROS_SKU_UNPROVISIONED) { + printk(BIOS_WARNING, "Unprovisioned SKU (%#x); assuming PCIe", sku); return true; } + + /* + * All cherry boards share the same SKU encoding. Therefore there is no need to check + * the board here. + * - BIT(1): NVMe (PCIe) + * - BIT(3): UFS (which takes precedence over BIT(1)) + */ + if (sku & BIT(3)) + return false; + if (sku & BIT(1)) + return true; + + /* Otherwise, eMMC */ + return false; } /* Set up backlight control pins as output pin and power-off by default */ -- cgit v1.2.3