All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prabhakar Lad <prabhakar.lad@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/7] da850/omap-l138: Add MMC support for DA850/OMAP-L138
Date: Thu, 7 Jun 2012 15:25:28 +0530	[thread overview]
Message-ID: <1339062934-20648-2-git-send-email-prabhakar.lad@ti.com> (raw)
In-Reply-To: <1339062934-20648-1-git-send-email-prabhakar.lad@ti.com>

From: Lad, Prabhakar <prabhakar.lad@ti.com>

This patch adds support for MMC/SD on DA850/OMAP-L138.

Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Rajashekhara, Sudhakar <sudhakar.raj@ti.com>
Signed-off-by: Hadli, Manjunath <manjunath.hadli@ti.com>
---
 Changes for v2:
 1:Removed CONFIG_MMC_MBLOCK config which was never used.
 2:Added comment while enabling MMC commands.
 3:Moved GP0[11] to the board file da850evm.c

 arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c   |   11 ++++++++
 arch/arm/include/asm/arch-davinci/hardware.h    |    1 +
 arch/arm/include/asm/arch-davinci/pinmux_defs.h |    3 ++
 board/davinci/da8xxevm/da850evm.c               |   32 +++++++++++++++++++++++
 include/configs/da850evm.h                      |   17 ++++++++++++
 5 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c b/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c
index fa07fb5..ad600b2 100644
--- a/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c
+++ b/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c
@@ -169,3 +169,14 @@ const struct pinmux_config emifa_pins_nor[] = {
 	{ pinmux(12), 1, 6 }, /* EMA_A[1] */
 	{ pinmux(12), 1, 7 }, /* EMA_A[0] */
 };
+
+/* MMC0 pin muxer settings */
+const struct pinmux_config mmc0_pins[] = {
+	{ pinmux(10), 2, 0 },	/* MMCSD0_CLK */
+	{ pinmux(10), 2, 1 },	/* MMCSD0_CMD */
+	{ pinmux(10), 2, 2 },	/* MMCSD0_DAT_0 */
+	{ pinmux(10), 2, 3 },	/* MMCSD0_DAT_1 */
+	{ pinmux(10), 2, 4 },	/* MMCSD0_DAT_2 */
+	{ pinmux(10), 2, 5 },	/* MMCSD0_DAT_3 */
+	/* DA850 supports only 4-bit mode, remaining pins are not configured */
+};
diff --git a/arch/arm/include/asm/arch-davinci/hardware.h b/arch/arm/include/asm/arch-davinci/hardware.h
index b145c6e..f6b7a2c 100644
--- a/arch/arm/include/asm/arch-davinci/hardware.h
+++ b/arch/arm/include/asm/arch-davinci/hardware.h
@@ -446,6 +446,7 @@ struct davinci_pllc_regs {
 #define DAVINCI_SPI1_CLKID  (cpu_is_da830() ? 2 : ASYNC3)
 /* Clock IDs */
 enum davinci_clk_ids {
+	DAVINCI_MMCSD_CLKID = 2,
 	DAVINCI_SPI0_CLKID = 2,
 	DAVINCI_UART2_CLKID = 2,
 	DAVINCI_MMC_CLKID = 2,
diff --git a/arch/arm/include/asm/arch-davinci/pinmux_defs.h b/arch/arm/include/asm/arch-davinci/pinmux_defs.h
index 07aceaa..0db1e40 100644
--- a/arch/arm/include/asm/arch-davinci/pinmux_defs.h
+++ b/arch/arm/include/asm/arch-davinci/pinmux_defs.h
@@ -48,4 +48,7 @@ extern const struct pinmux_config emifa_pins_cs4[1];
 extern const struct pinmux_config emifa_pins_nand[12];
 extern const struct pinmux_config emifa_pins_nor[43];
 
+/* MMC pin muxer settings */
+extern const struct pinmux_config mmc0_pins[6];
+
 #endif
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 004d5ad..88337ff 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -36,6 +36,11 @@
 #include <asm/errno.h>
 #include <hwconfig.h>
 
+#ifdef CONFIG_DAVINCI_MMC
+#include <mmc.h>
+#include <asm/arch/sdmmc_defs.h>
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_DRIVER_TI_EMAC
@@ -204,11 +209,32 @@ int misc_init_r(void)
 	return 0;
 }
 
+#ifdef CONFIG_DAVINCI_MMC
+static struct davinci_mmc mmc_sd0 = {
+	.reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE,
+	.host_caps = MMC_MODE_4BIT,     /* DA850 supports only 4-bit SD/MMC */
+	.voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
+	.version = MMC_CTLR_VERSION_2,
+};
+
+int board_mmc_init(bd_t *bis)
+{
+	mmc_sd0.input_clk = clk_get(DAVINCI_MMCSD_CLKID);
+
+	/* Add slot-0 to mmc subsystem */
+	return davinci_mmc_init(bis, &mmc_sd0);
+}
+#endif
+
 static const struct pinmux_config gpio_pins[] = {
 #ifdef CONFIG_USE_NOR
 	/* GP0[11] is required for NOR to work on Rev 3 EVMs */
 	{ pinmux(0), 8, 4 },	/* GP0[11] */
 #endif
+#ifdef CONFIG_DAVINCI_MMC
+	/* GP0[11] is required for SD to work on Rev 3 EVMs */
+	{ pinmux(0),  8, 4 },	/* GP0[11] */
+#endif
 };
 
 const struct pinmux_resource pinmuxes[] = {
@@ -236,6 +262,9 @@ const struct pinmux_resource pinmuxes[] = {
 	PINMUX_ITEM(emifa_pins_nor),
 #endif
 	PINMUX_ITEM(gpio_pins),
+#ifdef CONFIG_DAVINCI_MMC
+	PINMUX_ITEM(mmc0_pins),
+#endif
 };
 
 const int pinmuxes_size = ARRAY_SIZE(pinmuxes);
@@ -246,6 +275,9 @@ const struct lpsc_resource lpsc[] = {
 	{ DAVINCI_LPSC_EMAC },	/* image download */
 	{ DAVINCI_LPSC_UART2 },	/* console */
 	{ DAVINCI_LPSC_GPIO },
+#ifdef CONFIG_DAVINCI_MMC
+	{ DAVINCI_LPSC_MMC_SD },
+#endif
 };
 
 const int lpsc_size = ARRAY_SIZE(lpsc);
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index 989472b..8b4fea1 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -313,6 +313,23 @@
 #undef CONFIG_CMD_ENV
 #endif
 
+/* SD/MMC configuration */
+#define CONFIG_MMC
+#define CONFIG_DAVINCI_MMC_SD1
+#define CONFIG_GENERIC_MMC
+#define CONFIG_DAVINCI_MMC
+
+/*
+ * Enable MMC commands only when
+ * MMC support is present
+ */
+#ifdef CONFIG_MMC
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_MMC
+#endif
+
 /* defines for SPL */
 #define CONFIG_SPL
 #define CONFIG_SPL_SPI_SUPPORT
-- 
1.7.4.1

  reply	other threads:[~2012-06-07  9:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-07  9:55 [U-Boot] [PATCH v2 0/7] feature additions and fixes for da850/omap-l138 Prabhakar Lad
2012-06-07  9:55 ` Prabhakar Lad [this message]
2012-06-07  9:55 ` [U-Boot] [PATCH v2 2/7] da850/omap-l138: modifications for Logic PD Rev.3 AM18xx EVM Prabhakar Lad
2012-06-07  9:55 ` [U-Boot] [PATCH v2 3/7] da850/omap-l138: Add support to read u-boot image from MMC/SD Prabhakar Lad
2012-06-18 19:39   ` Christian Riesch
2012-06-19  5:06     ` Lad, Prabhakar
2012-06-20  9:20       ` Christian Riesch
2012-06-20 10:31         ` Lad, Prabhakar
2012-06-07  9:55 ` [U-Boot] [PATCH v2 4/7] da850/omap-l138: Make MMC and NOR support mutually exclusive Prabhakar Lad
2012-06-07  9:55 ` [U-Boot] [PATCH v2 5/7] da850/omap-l138: Fix NAND flash timings Prabhakar Lad
2012-06-07  9:55 ` [U-Boot] [PATCH v2 6/7] da850/omap-l138: Add support for NAND SPL Prabhakar Lad
2012-06-07  9:55 ` [U-Boot] [PATCH v2 7/7] da850/omap-l138: add support for direct NOR boot mode Prabhakar Lad
2012-06-13 10:29 ` [U-Boot] [PATCH v2 0/7] feature additions and fixes for da850/omap-l138 Sughosh Ganu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339062934-20648-2-git-send-email-prabhakar.lad@ti.com \
    --to=prabhakar.lad@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.