summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2022-03-22 09:08:10 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-03-23 03:20:29 +0000
commit9f35fcfd6afeb071c6bbf8c0c5e18de17d08c58e (patch)
treef91f0f84fa4158b51c82c7d46f2a559029e4bac4
parent0a4cd04b22d0a42852a4800a4efc8425995e2883 (diff)
downloadchrome-ec-9f35fcfd6afeb071c6bbf8c0c5e18de17d08c58e.tar.gz
board/taeko: Override NVME and EMMC FW_CONFIG bits based on GPIO
Taeko has an EMMC_SKU_DET strap pin which signals whether or not the current board has EMMC or NVME storage. In the factory, the CBI images are prepared with both NVME and EMMC masks set to enabled, but this causes an issue in the AP firmware PCIe RP initialization because the two devices are designed to use the same CLKREQ# pin regardless of SKU. The FSP cannot handle this, thus we are left with trying to override these values. Thus this patch will read the FW_CONFIG value at init time, and if either both NVME and EMMC are selected, or neither, then it will read the EMMC_SKU_DET pin and set the two FW_CONFIG masks accordingly. BUG=b:224884408 BRANCH=none TEST=verified by ODM Change-Id: Ia8ad12fb785a75af6311acb41db7cedce58ad881 Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3537108 Reviewed-by: caveh jalali <caveh@chromium.org> Tested-by: Arthur Lin <arthur.lin@lcfc.corp-partner.google.com>
-rw-r--r--board/taeko/fw_config.c29
-rw-r--r--board/taeko/fw_config.h14
-rw-r--r--board/taeko/gpio.inc1
3 files changed, 43 insertions, 1 deletions
diff --git a/board/taeko/fw_config.c b/board/taeko/fw_config.c
index 93359e0c9e..02480a6205 100644
--- a/board/taeko/fw_config.c
+++ b/board/taeko/fw_config.c
@@ -8,6 +8,7 @@
#include "console.h"
#include "cros_board_info.h"
#include "fw_config.h"
+#include "gpio.h"
#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
@@ -26,6 +27,32 @@ static const union taeko_cbi_fw_config fw_config_defaults = {
/****************************************************************************
* Taeko FW_CONFIG access
*/
+static void determine_storage(void)
+{
+ const bool has_nvme = fw_config.nvme_status == NVME_ENABLED;
+ const bool has_emmc = fw_config.emmc_status == EMMC_ENABLED;
+
+ /*
+ * If both masks are enabled or disabled, read the EMMC_SKU_DET pin
+ * (should happen only in the factory).
+ */
+ if (has_nvme == has_emmc) {
+ /* 0 = eMMC SKU, 1 = NVMe SKU */
+ if (gpio_get_level(GPIO_EMMC_SKU_DET)) {
+ CPRINTS("CBI: Detected NVMe SKU, disabling eMMC");
+ fw_config.emmc_status = EMMC_DISABLED;
+ fw_config.nvme_status = NVME_ENABLED;
+ } else {
+ CPRINTS("CBI: Detected eMMC SKU, disabling NVMe");
+ fw_config.nvme_status = NVME_DISABLED;
+ fw_config.emmc_status = EMMC_ENABLED;
+ }
+ }
+
+ cbi_set_board_info(CBI_TAG_FW_CONFIG, (uint8_t *)&fw_config,
+ sizeof(fw_config));
+}
+
void board_init_fw_config(void)
{
if (cbi_get_fw_config(&fw_config.raw_value)) {
@@ -45,6 +72,8 @@ void board_init_fw_config(void)
} else
fw_config = fw_config_defaults;
}
+
+ determine_storage();
}
union taeko_cbi_fw_config get_fw_config(void)
diff --git a/board/taeko/fw_config.h b/board/taeko/fw_config.h
index 5ba3bc670a..4062946868 100644
--- a/board/taeko/fw_config.h
+++ b/board/taeko/fw_config.h
@@ -34,13 +34,23 @@ enum ec_cfg_kbnumpad {
KEYBOARD_NUMBER_PAD = 1
};
+enum ec_cfg_nvme_status {
+ NVME_DISABLED = 0,
+ NVME_ENABLED = 1,
+};
+
+enum ec_cfg_emmc_status {
+ EMMC_DISABLED = 0,
+ EMMC_ENABLED = 1,
+};
+
union taeko_cbi_fw_config {
struct {
enum ec_cfg_usb_db_type usb_db : 2;
uint32_t sd_db : 2;
enum ec_cfg_keyboard_backlight_type kb_bl : 1;
uint32_t audio : 3;
- uint32_t reserved_1 : 6;
+ uint32_t reserved_1 : 4;
/* b/194515356 - Fw config structure
* b/203630618 - Move tablet mode to bit14
* bit8-9: kb_layout
@@ -48,6 +58,8 @@ union taeko_cbi_fw_config {
* bit12: nvme
* bit13: emmc
*/
+ enum ec_cfg_nvme_status nvme_status : 1;
+ enum ec_cfg_emmc_status emmc_status : 1;
enum ec_cfg_tabletmode_type tabletmode : 1;
enum ec_cfg_kbnumpad kbnumpad : 1;
uint32_t reserved_2 : 16;
diff --git a/board/taeko/gpio.inc b/board/taeko/gpio.inc
index b0279f3f15..f1c8ef10ff 100644
--- a/board/taeko/gpio.inc
+++ b/board/taeko/gpio.inc
@@ -64,6 +64,7 @@ GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
GPIO(EC_PCH_WAKE_R_ODL, PIN(C, 0), GPIO_ODR_HIGH)
GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
+GPIO(EMMC_SKU_DET, PIN(7, 0), GPIO_INPUT)
GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_LOW)
GPIO(EN_PP5000_USBA_R, PIN(D, 7), GPIO_OUT_LOW)
GPIO(EN_S5_RAILS, PIN(B, 6), GPIO_OUT_LOW)