summaryrefslogtreecommitdiff
path: root/src/soc/qualcomm
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/qualcomm')
-rw-r--r--src/soc/qualcomm/sc7280/Kconfig3
-rw-r--r--src/soc/qualcomm/sc7280/Makefile.inc1
-rw-r--r--src/soc/qualcomm/sc7280/include/soc/addressmap.h3
-rw-r--r--src/soc/qualcomm/sc7280/include/soc/sdhci.h8
-rw-r--r--src/soc/qualcomm/sc7280/sdhci.c27
5 files changed, 42 insertions, 0 deletions
diff --git a/src/soc/qualcomm/sc7280/Kconfig b/src/soc/qualcomm/sc7280/Kconfig
index ccba8ff9b5..985afdce80 100644
--- a/src/soc/qualcomm/sc7280/Kconfig
+++ b/src/soc/qualcomm/sc7280/Kconfig
@@ -21,6 +21,9 @@ config SOC_QUALCOMM_SC7280
select HAVE_UART_SPECIAL
select PCI
select NO_ECAM_MMCONF_SUPPORT
+ select COMMONLIB_STORAGE
+ select COMMONLIB_STORAGE_MMC
+ select SDHCI_CONTROLLER
if SOC_QUALCOMM_SC7280
diff --git a/src/soc/qualcomm/sc7280/Makefile.inc b/src/soc/qualcomm/sc7280/Makefile.inc
index bd0afe4da5..440148494d 100644
--- a/src/soc/qualcomm/sc7280/Makefile.inc
+++ b/src/soc/qualcomm/sc7280/Makefile.inc
@@ -55,6 +55,7 @@ ramstage-$(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) += ../common/display/mdss.c
ramstage-$(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) += display/disp.c
ramstage-$(CONFIG_PCI) += ../common/pcie_common.c
ramstage-$(CONFIG_PCI) += pcie.c
+ramstage-$(CONFIG_SDHCI_CONTROLLER) += sdhci.c ../common/storage/sdhci_msm.c
################################################################################
diff --git a/src/soc/qualcomm/sc7280/include/soc/addressmap.h b/src/soc/qualcomm/sc7280/include/soc/addressmap.h
index 31f7d64f8f..342de9f9a4 100644
--- a/src/soc/qualcomm/sc7280/include/soc/addressmap.h
+++ b/src/soc/qualcomm/sc7280/include/soc/addressmap.h
@@ -91,4 +91,7 @@
/* PHY BCR */
#define GCC_PCIE_1_PHY_BCR 0x18E01C
+/* eMMC base address */
+#define SDC1_HC_BASE 0x007C4000
+
#endif /* __SOC_QUALCOMM_SC7280_ADDRESS_MAP_H__ */
diff --git a/src/soc/qualcomm/sc7280/include/soc/sdhci.h b/src/soc/qualcomm/sc7280/include/soc/sdhci.h
new file mode 100644
index 0000000000..70635c08d3
--- /dev/null
+++ b/src/soc/qualcomm/sc7280/include/soc/sdhci.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _SOC_QUALCOMM_SC7280_SDHCI_H__
+#define _SOC_QUALCOMM_SC7280_SDHCI_H__
+
+int qc_emmc_early_init(void);
+
+#endif // _SOC_QUALCOMM_SC7280_SDHCI_H__
diff --git a/src/soc/qualcomm/sc7280/sdhci.c b/src/soc/qualcomm/sc7280/sdhci.c
new file mode 100644
index 0000000000..6e676f4feb
--- /dev/null
+++ b/src/soc/qualcomm/sc7280/sdhci.c
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
+#include <commonlib/storage/sd_mmc.h>
+#include <commonlib/storage/sdhci.h>
+#include <commonlib/sd_mmc_ctrlr.h>
+#include <soc/addressmap.h>
+#include <soc/sdhci.h>
+#include <soc/sdhci_msm.h>
+
+int qc_emmc_early_init(void)
+{
+ struct sd_mmc_ctrlr *ctrlr;
+ struct storage_media media = {0};
+
+ ctrlr = new_sdhci_msm_host((void *)(uintptr_t)SDC1_HC_BASE);
+ if (ctrlr == NULL)
+ return -1;
+
+ media.ctrlr = ctrlr;
+ SET_BUS_WIDTH(ctrlr, 1);
+ SET_CLOCK(ctrlr, 384 * 1000);
+
+ /* Send CMD1 */
+ return mmc_send_cmd1(&media);
+}