blob: bf95ed7273d8d0e366517128034ce4ab278dc3dd [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001From cbf16548dc6dcc8eea97aa18c6ae17fb848e5c6c Mon Sep 17 00:00:00 2001
2From: Rui Miguel Silva <rui.silva@linaro.org>
3Date: Tue, 5 Apr 2022 10:24:38 +0100
4Subject: [PATCH 27/27] arm:corstone1000: add mmc for fvp
5
6Enable support mmc/sdcard for the corstone1000 FVP.
7
8Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
9Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
10---
11 arch/arm/dts/corstone1000-fvp.dts | 28 +++++++++++++++
12 board/armltd/corstone1000/corstone1000.c | 46 ++++++++++++++++--------
13 configs/corstone1000_defconfig | 8 ++++-
14 include/configs/corstone1000.h | 4 ++-
15 4 files changed, 69 insertions(+), 17 deletions(-)
16
17diff --git a/arch/arm/dts/corstone1000-fvp.dts b/arch/arm/dts/corstone1000-fvp.dts
18index 1fcc137a493c..26b0f1b3cea6 100644
19--- a/arch/arm/dts/corstone1000-fvp.dts
20+++ b/arch/arm/dts/corstone1000-fvp.dts
21@@ -20,4 +20,32 @@
22 interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
23 reg-io-width = <2>;
24 };
25+
26+ vmmc_v3_3d: fixed_v3_3d {
27+ compatible = "regulator-fixed";
28+ regulator-name = "vmmc_supply";
29+ regulator-min-microvolt = <3300000>;
30+ regulator-max-microvolt = <3300000>;
31+ regulator-always-on;
32+ };
33+
34+ sdmmc0: mmc@40300000 {
35+ compatible = "arm,pl18x", "arm,primecell";
36+ reg = <0x40300000 0x1000>;
37+ interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
38+ max-frequency = <12000000>;
39+ vmmc-supply = <&vmmc_v3_3d>;
40+ clocks = <&smbclk>, <&refclk100mhz>;
41+ clock-names = "smclk", "apb_pclk";
42+ };
43+
44+ sdmmc1: mmc@50000000 {
45+ compatible = "arm,pl18x", "arm,primecell";
46+ reg = <0x50000000 0x10000>;
47+ interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
48+ max-frequency = <12000000>;
49+ vmmc-supply = <&vmmc_v3_3d>;
50+ clocks = <&smbclk>, <&refclk100mhz>;
51+ clock-names = "smclk", "apb_pclk";
52+ };
53 };
54diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c
55index eff1739f0b02..936a6c9f8b89 100644
56--- a/board/armltd/corstone1000/corstone1000.c
57+++ b/board/armltd/corstone1000/corstone1000.c
58@@ -46,22 +46,38 @@ static struct mm_region corstone1000_mem_map[] = {
59 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
60 PTE_BLOCK_NON_SHARE |
61 PTE_BLOCK_PXN | PTE_BLOCK_UXN
62- }, {
63- /* USB */
64- .virt = 0x40200000UL,
65- .phys = 0x40200000UL,
66- .size = 0x00100000UL,
67- .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
68- PTE_BLOCK_NON_SHARE |
69- PTE_BLOCK_PXN | PTE_BLOCK_UXN
70 }, {
71- /* ethernet */
72- .virt = 0x40100000UL,
73- .phys = 0x40100000UL,
74- .size = 0x00100000UL,
75- .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
76- PTE_BLOCK_NON_SHARE |
77- PTE_BLOCK_PXN | PTE_BLOCK_UXN
78+ /* USB */
79+ .virt = 0x40200000UL,
80+ .phys = 0x40200000UL,
81+ .size = 0x00100000UL,
82+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
83+ PTE_BLOCK_NON_SHARE |
84+ PTE_BLOCK_PXN | PTE_BLOCK_UXN
85+ }, {
86+ /* MMC0 */
87+ .virt = 0x40300000UL,
88+ .phys = 0x40300000UL,
89+ .size = 0x00100000UL,
90+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
91+ PTE_BLOCK_NON_SHARE |
92+ PTE_BLOCK_PXN | PTE_BLOCK_UXN
93+ }, {
94+ /* ethernet */
95+ .virt = 0x40100000UL,
96+ .phys = 0x40100000UL,
97+ .size = 0x00100000UL,
98+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
99+ PTE_BLOCK_NON_SHARE |
100+ PTE_BLOCK_PXN | PTE_BLOCK_UXN
101+ }, {
102+ /* MMC1 */
103+ .virt = 0x50000000UL,
104+ .phys = 0x50000000UL,
105+ .size = 0x00100000UL,
106+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
107+ PTE_BLOCK_NON_SHARE |
108+ PTE_BLOCK_PXN | PTE_BLOCK_UXN
109 }, {
110 /* OCVM */
111 .virt = 0x80000000UL,
112diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
113index b042d4e49419..147c14c94865 100644
114--- a/configs/corstone1000_defconfig
115+++ b/configs/corstone1000_defconfig
116@@ -38,7 +38,13 @@ CONFIG_CMD_EFIDEBUG=y
117 CONFIG_CMD_FAT=y
118 CONFIG_OF_CONTROL=y
119 CONFIG_REGMAP=y
120-# CONFIG_MMC is not set
121+CONFIG_CLK=y
122+CONFIG_CMD_MMC=y
123+CONFIG_DM_MMC=y
124+CONFIG_ARM_PL180_MMCI=y
125+CONFIG_MMC_SDHCI_ADMA_HELPERS=y
126+CONFIG_MMC_WRITE=y
127+CONFIG_DM_GPIO=y
128 CONFIG_DM_SERIAL=y
129 CONFIG_USB=y
130 CONFIG_DM_USB=y
131diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
132index 06b605e43bdf..d9855bf91ebf 100644
133--- a/include/configs/corstone1000.h
134+++ b/include/configs/corstone1000.h
135@@ -95,7 +95,9 @@
136 #define CONFIG_SYS_MAXARGS 64 /* max command args */
137
138 #define BOOT_TARGET_DEVICES(func) \
139- func(USB, usb, 0)
140+ func(USB, usb, 0) \
141+ func(MMC, mmc, 0) \
142+ func(MMC, mmc, 1)
143
144 #include <config_distro_bootcmd.h>
145
146--
1472.30.2
148