aboutsummaryrefslogtreecommitdiff
path: root/src/soc/mediatek
diff options
context:
space:
mode:
authorRex-BC Chen <rex-bc.chen@mediatek.corp-partner.google.com>2021-10-26 13:17:43 +0800
committerHung-Te Lin <hungte@chromium.org>2021-11-16 08:01:57 +0000
commit4ab77addc51e256ed3f6a360ecec06ca7afd5e9c (patch)
tree69ab3bc3b39d1b415779c8086e23ac45e6571603 /src/soc/mediatek
parent966b502d352424a9d30d34cdb8020545c819c385 (diff)
soc/mediatek/mt8186: add early initialization for eMMC
Some eMMCs need 80+ms for CMD1 to complete. And the payload may need to access eMMC in the very early stage (for example, depthcharge needs it 20ms after started) so we have to start initialization in coreboot. TEST=boot kernel from eMMC ok BUG=b:202871018 Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com> Change-Id: I3bc06b1fc506b1d6f54f7f456117d22477a87e29 Reviewed-on: https://review.coreboot.org/c/coreboot/+/59294 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'src/soc/mediatek')
-rw-r--r--src/soc/mediatek/common/include/soc/msdc.h2
-rw-r--r--src/soc/mediatek/mt8186/msdc.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/src/soc/mediatek/common/include/soc/msdc.h b/src/soc/mediatek/common/include/soc/msdc.h
index f25c3d0276..b7f7fd7b0b 100644
--- a/src/soc/mediatek/common/include/soc/msdc.h
+++ b/src/soc/mediatek/common/include/soc/msdc.h
@@ -165,7 +165,7 @@ struct msdc_ctrlr {
#define msdc_error(format...) printk(BIOS_ERR, "ERROR: " format)
int mtk_emmc_early_init(void *base, void *top_base);
-void mtk_msdc_configure_emmc(void);
+void mtk_msdc_configure_emmc(bool is_early_init);
void mtk_msdc_configure_sdcard(void);
#endif /* SOC_MEDIATEK_COMMON_MSDC_H */
diff --git a/src/soc/mediatek/mt8186/msdc.c b/src/soc/mediatek/mt8186/msdc.c
index f1c2004d09..cfdb0f2cfb 100644
--- a/src/soc/mediatek/mt8186/msdc.c
+++ b/src/soc/mediatek/mt8186/msdc.c
@@ -33,7 +33,7 @@ enum {
MSDC1_GPIO_MODE1_BASE = 0x100053b0,
};
-void mtk_msdc_configure_emmc(void)
+void mtk_msdc_configure_emmc(bool is_early_init)
{
void *gpio_base = (void *)IOCFG_LT_BASE;
int i;
@@ -58,6 +58,9 @@ void mtk_msdc_configure_emmc(void)
/* set eMMC cmd/dat/clk pins driving to 8mA */
SET32_BITFIELDS(gpio_base, MSDC0_DRV, MSDC0_DRV_VALUE);
+
+ if (is_early_init)
+ mtk_emmc_early_init((void *)MSDC0_BASE, (void *)MSDC0_TOP_BASE);
}
void mtk_msdc_configure_sdcard(void)