diff options
author | Chee Hong Ang <chee.hong.ang@intel.com> | 2020-12-24 18:21:04 +0800 |
---|---|---|
committer | Ley Foon Tan <ley.foon.tan@intel.com> | 2021-01-15 17:48:37 +0800 |
commit | 6b38cc2f2b8588fb50c606306ada6e48f20ff4ee (patch) | |
tree | be4aca83c8c98c11595fab1ae5c5cf80f8101100 /drivers/mmc | |
parent | d456dfbaa0d8e43991791723cbcd0b9def95fd8d (diff) | |
download | u-boot-6b38cc2f2b8588fb50c606306ada6e48f20ff4ee.zip u-boot-6b38cc2f2b8588fb50c606306ada6e48f20ff4ee.tar.gz u-boot-6b38cc2f2b8588fb50c606306ada6e48f20ff4ee.tar.bz2 |
mmc: dwmmc: socfpga: Add ATF support for MMC driver
In non-secure mode (EL2), MMC driver calls the SMC/PSCI services
provided by ATF to set SDMMC's DRVSEL and SMPLSEL.
Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/socfpga_dw_mmc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c index 7d8c452..aa0d3a2 100644 --- a/drivers/mmc/socfpga_dw_mmc.c +++ b/drivers/mmc/socfpga_dw_mmc.c @@ -6,6 +6,7 @@ #include <common.h> #include <log.h> #include <asm/arch/clock_manager.h> +#include <asm/arch/secure_reg_helper.h> #include <asm/arch/system_manager.h> #include <clk.h> #include <dm.h> @@ -13,6 +14,7 @@ #include <errno.h> #include <fdtdec.h> #include <dm/device_compat.h> +#include <linux/intel-smc.h> #include <linux/libfdt.h> #include <linux/err.h> #include <malloc.h> @@ -58,10 +60,22 @@ static int socfpga_dwmci_clksel(struct dwmci_host *host) debug("%s: drvsel %d smplsel %d\n", __func__, priv->drvsel, priv->smplsel); + +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_ATF) + int ret; + + ret = socfpga_secure_reg_write32(SOCFPGA_SECURE_REG_SYSMGR_SOC64_SDMMC, + sdmmc_mask); + if (ret) { + printf("DWMMC: Failed to set clksel via SMC call"); + return ret; + } +#else writel(sdmmc_mask, socfpga_get_sysmgr_addr() + SYSMGR_SDMMC); debug("%s: SYSMGR_SDMMCGRP_CTRL_REG = 0x%x\n", __func__, readl(socfpga_get_sysmgr_addr() + SYSMGR_SDMMC)); +#endif /* Enable SDMMC clock */ setbits_le32(socfpga_get_clkmgr_addr() + CLKMGR_PERPLL_EN, |