Yidi Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/85564?usp=email )
(
8 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: soc/mediatek/mt8196: Add SD card configurations ......................................................................
soc/mediatek/mt8196: Add SD card configurations
Rauru reference design has SD card interfaces, so we have to configure it in ramstage.
Implement msdc.c (memory and SD Card controller) to place the SD card drivers.
This implementation is based on chapter 10.3 in MT8196 Functional Specification.
TEST=Build pass BUG=b:317009620
Change-Id: Ibb6a075d0f1b5a647e93a58b3ea1029b7676c765 Signed-off-by: Andy-ld Lu andy-ld.lu@mediatek.corp-partner.google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/85564 Reviewed-by: Yidi Lin yidilin@google.com Reviewed-by: Yu-Ping Wu yupingso@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/soc/mediatek/mt8196/Makefile.mk A src/soc/mediatek/mt8196/msdc.c 2 files changed, 37 insertions(+), 0 deletions(-)
Approvals: Yu-Ping Wu: Looks good to me, approved build bot (Jenkins): Verified Yidi Lin: Looks good to me, approved
diff --git a/src/soc/mediatek/mt8196/Makefile.mk b/src/soc/mediatek/mt8196/Makefile.mk index 2af541f..2e78e1a 100644 --- a/src/soc/mediatek/mt8196/Makefile.mk +++ b/src/soc/mediatek/mt8196/Makefile.mk @@ -47,6 +47,7 @@ ramstage-y += ../common/mcu.c ramstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c ramstage-$(CONFIG_PCI) += ../common/pcie.c pcie.c +ramstage-$(CONFIG_COMMONLIB_STORAGE_MMC) += msdc.c ramstage-y += ../common/mt6363.c mt6363.c ramstage-y += ../common/mt6363_sdmadc.c ramstage-y += ../common/mt6373.c mt6373.c diff --git a/src/soc/mediatek/mt8196/msdc.c b/src/soc/mediatek/mt8196/msdc.c new file mode 100644 index 0000000..f787374 --- /dev/null +++ b/src/soc/mediatek/mt8196/msdc.c @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ + +/* + * This file is created based on MT8196 Functional Specification + * Chapter number: 10.3 + */ + +#include <gpio.h> +#include <soc/msdc.h> +#include <soc/regulator.h> + +static const struct pad_func sdcard_pins[] = { + PAD_FUNC_DOWN(MSDC1_CLK, MSDC1_CLK), + PAD_FUNC_UP(MSDC1_CMD, MSDC1_CMD), + PAD_FUNC_UP(MSDC1_DAT0, MSDC1_DAT0), + PAD_FUNC_UP(MSDC1_DAT1, MSDC1_DAT1), + PAD_FUNC_UP(MSDC1_DAT2, MSDC1_DAT2), + PAD_FUNC_UP(MSDC1_DAT3, MSDC1_DAT3), +}; + +void mtk_msdc_configure_sdcard(void) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(sdcard_pins); i++) { + gpio_set_mode(sdcard_pins[i].gpio, sdcard_pins[i].func); + gpio_set_pull(sdcard_pins[i].gpio, GPIO_PULL_ENABLE, sdcard_pins[i].select); + gpio_set_driving(sdcard_pins[i].gpio, GPIO_DRV_6_MA); + } + + /* enable SD card power */ + mainboard_enable_regulator(MTK_REGULATOR_VMCH, true); + mainboard_enable_regulator(MTK_REGULATOR_VMC, true); + mainboard_set_regulator_voltage(MTK_REGULATOR_VMCH, 3000000); + mainboard_set_regulator_voltage(MTK_REGULATOR_VMC, 3000000); +}