Patchwork [U-Boot,SPEAr,Enhancement,5/9] spear320: Add support for SD/MMC

login
register
mail settings
Submitter Vipin Kumar
Date Nov. 2, 2012, 5:39 p.m.
Message ID <03c311b0b2de5483bc5089350bc7c4ccb955c68a.1351877331.git.vipin.kumar@st.com>
Download mbox | patch
Permalink /patch/196703/
State New
Delegated to: Vipin Kumar
Headers show

Comments

Vipin Kumar - Nov. 2, 2012, 5:39 p.m.
Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
---
 arch/arm/include/asm/arch-spear/mmc.h      | 29 +++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-spear/spear320.h |  1 +
 board/st/spear/spear320plc.c               | 12 ++++++++++++
 include/configs/spear320-evb.h             |  5 +++++
 4 files changed, 47 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-spear/mmc.h

Patch

diff --git a/arch/arm/include/asm/arch-spear/mmc.h b/arch/arm/include/asm/arch-spear/mmc.h
new file mode 100644
index 0000000..5c01a7e
--- /dev/null
+++ b/arch/arm/include/asm/arch-spear/mmc.h
@@ -0,0 +1,29 @@ 
+/*
+ * (C) Copyright 2012
+ * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _ASM_ARCH_MMC_H
+#define _ASM_ARCH_MMC_H
+
+extern int spear_sdhci_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks);
+
+#endif
diff --git a/arch/arm/include/asm/arch-spear/spear320.h b/arch/arm/include/asm/arch-spear/spear320.h
index abdcda6..a027e10 100644
--- a/arch/arm/include/asm/arch-spear/spear320.h
+++ b/arch/arm/include/asm/arch-spear/spear320.h
@@ -31,6 +31,7 @@ 
 #define CONFIG_SYS_NAND_CLE			(1 << 16)
 #define CONFIG_SYS_NAND_ALE			(1 << 17)
 
+#define CONFIG_SYS_MMC_BASE			0x70000000
 #define CONFIG_SYS_MACB0_BASE			0xAA000000
 #define CONFIG_SYS_MACB1_BASE			0xAB000000
 #define CONFIG_SPEAR_RASBASE			0xB3000000
diff --git a/board/st/spear/spear320plc.c b/board/st/spear/spear320plc.c
index 5a79eb6..315fe2d 100644
--- a/board/st/spear/spear320plc.c
+++ b/board/st/spear/spear320plc.c
@@ -123,3 +123,15 @@  int board_eth_init(bd_t *bis)
 	return ret;
 }
 #endif
+
+#if defined(CONFIG_CMD_MMC)
+int board_mmc_init(bd_t *bis)
+{
+	int ret = 0;
+#if defined(CONFIG_SPEAR_SDHCI)
+	if (spear_sdhci_init(CONFIG_SYS_MMC_BASE, 24000000, 6000000, 0) >= 0)
+		ret++;
+#endif
+	return ret;
+}
+#endif
diff --git a/include/configs/spear320-evb.h b/include/configs/spear320-evb.h
index 229fa83..955266b 100644
--- a/include/configs/spear320-evb.h
+++ b/include/configs/spear320-evb.h
@@ -33,6 +33,11 @@ 
 #define CONFIG_MACH_SPEAR320EVB
 #define CONFIG_MACH_TYPE			MACH_TYPE_SPEAR320
 
+/* ARASAN SD MMC configuration */
+#if !defined(CONFIG_SPEAR_USBTTY)
+	#define CONFIG_SPEAR_SDHCI
+#endif
+
 /* Designware Ethernet configurations */
 #if !defined(CONFIG_SPEAR_USBTTY)
 	#define CONFIG_DESIGNWARE_ETH