From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Mon, 2 Apr 2012 22:52:26 +0200 Subject: [U-Boot] [PATCH v2] mmc: mxsmmc: Fix operation with DMA In-Reply-To: References: <1333391050-25199-1-git-send-email-fabio.estevam@freescale.com> <201204022154.38769.marex@denx.de> Message-ID: <201204022252.26493.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Fabio Estevam, > On Mon, Apr 2, 2012 at 4:54 PM, Marek Vasut wrote: > > Yes another hook function that'd be called early in board_init_r() > > Ok, please see the patch below and let me know if you like it. > > If you do, then I can probably split it in 2 parts: > one that introduces arch_early_init_r() and another one that fixes the > mmc problem on mx28. Well ... CCing Albert to express his concerns about this. > > 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 > #include > #include > +#include > > 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/arch/arm/include/asm/u-boot-arm.h > b/arch/arm/include/asm/u-boot-arm.h > index 4ca75f9..9f3cae5 100644 > --- a/arch/arm/include/asm/u-boot-arm.h > +++ b/arch/arm/include/asm/u-boot-arm.h > @@ -52,6 +52,7 @@ void cpu_init_cp15(void); > /* cpu/.../arch/cpu.c */ > int arch_cpu_init(void); > int arch_misc_init(void); > +int arch_early_init_r(void); > > /* board/.../... */ > int board_init(void); > diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c > index 5270c11..025d6ca 100644 > --- a/arch/arm/lib/board.c > +++ b/arch/arm/lib/board.c > @@ -500,6 +500,10 @@ void board_init_r(gd_t *id, ulong dest_addr) > malloc_start = dest_addr - TOTAL_MALLOC_LEN; > mem_malloc_init (malloc_start, TOTAL_MALLOC_LEN); > > +#ifdef CONFIG_ARCH_EARLY_INIT_R > + arch_early_init_r(); > +#endif > + > #if !defined(CONFIG_SYS_NO_FLASH) > puts("Flash: "); > > 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