[U-Boot] [PATCH 2/2] mmc: mxsmmc: Fix operation with DMA

Fabio Estevam fabio.estevam at freescale.com
Mon Apr 2 23:19:46 CEST 2012


Initialize the DMA controller so that the following errors are fixed:

U-Boot 2012.04-rc1-00001-g037cbfd (Apr 02 2012 - 10:57:48)

Freescale i.MX28 family at 454 MHz
DRAM:  128 MiB
MMC:   MXS MMC: 0
MMC0: DMA transfer failed
MMC0: DMA transfer failed
MMC0: DMA transfer failed
MMC0: DMA transfer failed
MMC init failed

Do the DMA initialization inside arch_early_init_r(), so that it can work after relocation.

In order to not break the DMA NAND support, remove mxs_dma_init from the
NAND driver now that it is called from arch_early_init_r().

Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
---
 arch/arm/cpu/arm926ejs/mx28/mx28.c |   12 ++++++++++++
 drivers/mtd/nand/mxs_nand.c        |    3 ---
 include/configs/m28evk.h           |    1 +
 include/configs/mx28evk.h          |    1 +
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/mx28/mx28.c b/arch/arm/cpu/arm926ejs/mx28/mx28.c
index cf6d4e9..6c148a8 100644
--- a/arch/arm/cpu/arm926ejs/mx28/mx28.c
+++ b/arch/arm/cpu/arm926ejs/mx28/mx28.c
@@ -34,6 +34,7 @@
 #include <asm/arch/iomux.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/arch/dma.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -297,3 +298,14 @@ U_BOOT_CMD(
 	"display clocks",
 	""
 );
+
+#ifdef CONFIG_ARCH_EARLY_INIT_R
+int arch_early_init_r(void)
+{
+#ifdef	CONFIG_APBH_DMA
+	/* Initialize the DMA controller. */
+	mxs_dma_init();
+#endif
+	return 0;
+}
+#endif
diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c
index 4b1297a..95eac35 100644
--- a/drivers/mtd/nand/mxs_nand.c
+++ b/drivers/mtd/nand/mxs_nand.c
@@ -1072,9 +1072,6 @@ int mxs_nand_init(struct mxs_nand_info *info)
 			goto err2;
 	}
 
-	/* Init the DMA controller. */
-	mxs_dma_init();
-
 	/* Reset the GPMI block. */
 	mx28_reset_block(&gpmi_regs->hw_gpmi_ctrl0_reg);
 
diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h
index 8b83180..b0e6d3b 100644
--- a/include/configs/m28evk.h
+++ b/include/configs/m28evk.h
@@ -42,6 +42,7 @@
 #define	CONFIG_BOARD_EARLY_INIT_F
 #define	CONFIG_ARCH_CPU_INIT
 #define	CONFIG_ARCH_MISC_INIT
+#define	CONFIG_ARCH_EARLY_INIT_R
 
 /*
  * SPL
diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
index 705fdab..350e833 100644
--- a/include/configs/mx28evk.h
+++ b/include/configs/mx28evk.h
@@ -36,6 +36,7 @@
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_ARCH_CPU_INIT
 #define CONFIG_ARCH_MISC_INIT
+#define CONFIG_ARCH_EARLY_INIT_R
 
 /*
  * SPL
-- 
1.7.1




More information about the U-Boot mailing list