mb/google/cherry: Introduce mainboard_needs_pcie_init

Implement mainboard_needs_pcie_init() for cherry as a callback for
mt8195 SoC to determine whether to initialize PCIe. When the SKU id is
unknown or unprovisioned (for example at the beginning of the factory
flow), we should still initialize PCIe. Otherwise the devices with NVMe
will fail to boot.

BUG=b:238850212
TEST=emerge-cherry coreboot
BRANCH=cherry

Change-Id: I2ed0ceeb37d2924ca16485fb2d130959a7eff102
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65992
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
This commit is contained in:
Yu-Ping Wu 2022-07-19 17:43:29 +08:00 committed by Yu-Ping Wu
parent df721bd0c3
commit 7b7250dfae
2 changed files with 31 additions and 0 deletions

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
#include <bl31.h> #include <bl31.h>
#include <boardid.h>
#include <bootmode.h> #include <bootmode.h>
#include <console/console.h> #include <console/console.h>
#include <delay.h> #include <delay.h>
@ -16,6 +17,7 @@
#include <soc/i2c.h> #include <soc/i2c.h>
#include <soc/msdc.h> #include <soc/msdc.h>
#include <soc/mtcmos.h> #include <soc/mtcmos.h>
#include <soc/pcie.h>
#include <soc/spm.h> #include <soc/spm.h>
#include <soc/usb.h> #include <soc/usb.h>
@ -29,6 +31,32 @@
#define GPIO_EDP_HPD_1V8 GPIO(GPIO_07) #define GPIO_EDP_HPD_1V8 GPIO(GPIO_07)
#define GPIO_EN_PP3300_DISP_X GPIO(I2SO1_D2) #define GPIO_EN_PP3300_DISP_X GPIO(I2SO1_D2)
bool mainboard_needs_pcie_init(void)
{
uint32_t sku;
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:
return true;
default:
/* For example CROS_SKU_UNPROVISIONED */
printk(BIOS_WARNING, "Unexpected sku %#x; assuming PCIe", sku);
return true;
}
}
static void register_reset_to_bl31(void) static void register_reset_to_bl31(void)
{ {
static struct bl_aux_param_gpio param_reset = { static struct bl_aux_param_gpio param_reset = {

View File

@ -4,8 +4,11 @@
#define SOC_MEDIATEK_MT8195_PCIE_H #define SOC_MEDIATEK_MT8195_PCIE_H
#include <soc/pcie_common.h> #include <soc/pcie_common.h>
#include <types.h>
void mtk_pcie_reset(uintptr_t reg, bool enable); void mtk_pcie_reset(uintptr_t reg, bool enable);
void mtk_pcie_pre_init(void); void mtk_pcie_pre_init(void);
bool mainboard_needs_pcie_init(void);
#endif #endif