diff options
author | Yu-Ping Wu <yupingso@chromium.org> | 2022-08-09 15:54:05 +0800 |
---|---|---|
committer | Paul Fagerburg <pfagerburg@chromium.org> | 2022-09-22 15:14:40 +0000 |
commit | 514277f7462e338c41c27e37198725923128d039 (patch) | |
tree | 710ce0baff29bd1a04799f69ff8e7790b35b8100 /src/mainboard | |
parent | a19ff6dea3ef01ee49a0f34cac019edc25041ce6 (diff) |
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 <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66580
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yidi Lin <yidilin@google.com>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'src/mainboard')
-rw-r--r-- | src/mainboard/google/cherry/mainboard.c | 39 |
1 files changed, 21 insertions, 18 deletions
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 <delay.h> #include <device/device.h> #include <device/mmio.h> +#include <ec/google/chromeec/ec.h> #include <edid.h> #include <framebuffer_info.h> #include <gpio.h> @@ -20,6 +21,7 @@ #include <soc/pcie.h> #include <soc/spm.h> #include <soc/usb.h> +#include <types.h> #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 */ |