diff mbox

[U-Boot,v2] mmc: mxsmmc: Fix operation with DMA

Message ID 1333391050-25199-1-git-send-email-fabio.estevam@freescale.com
State Rejected
Headers show

Commit Message

Fabio Estevam April 2, 2012, 6:24 p.m. UTC
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

In order to not break the DMA NAND support, remove mxs_dma_init from the
NAND driver now that it is called from the core dma file.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
--
Changes since v1:
- Call mxs_dma_init() from a common location and remove it
from the mxs_nand driver

 drivers/dma/apbh_dma.c      |    2 ++
 drivers/mtd/nand/mxs_nand.c |    3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

Marek Vasut April 2, 2012, 6:39 p.m. UTC | #1
Dear Fabio Estevam,

> 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
> 
> In order to not break the DMA NAND support, remove mxs_dma_init from the
> NAND driver now that it is called from the core dma file.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> --
> Changes since v1:
> - Call mxs_dma_init() from a common location and remove it
> from the mxs_nand driver
> 
>  drivers/dma/apbh_dma.c      |    2 ++
>  drivers/mtd/nand/mxs_nand.c |    3 ---
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
> index c086629..68c4be2 100644
> --- a/drivers/dma/apbh_dma.c
> +++ b/drivers/dma/apbh_dma.c
> @@ -346,6 +346,8 @@ struct mxs_dma_desc *mxs_dma_desc_alloc(void)
>  	struct mxs_dma_desc *pdesc;
>  	uint32_t size;
> 
> +	/* Initialize the DMA controller. */
> +	mxs_dma_init();

This mxs_dma_desc_alloc() is called in a loop in the MXS NAND driver, this is 
even worse ;-)

Possibly some common mx28 init code would be better?

NAK (sorry, I know it hurts)

Best regards,
Marek Vasut
Fabio Estevam April 2, 2012, 6:54 p.m. UTC | #2
On Mon, Apr 2, 2012 at 3:39 PM, Marek Vasut <marex@denx.de> wrote:

> This mxs_dma_desc_alloc() is called in a loop in the MXS NAND driver, this is
> even worse ;-)
>
> Possibly some common mx28 init code would be better?

If I put it in mx28.c like that:

+++ b/arch/arm/cpu/arm926ejs/mx28/mx28.c
@@ -172,6 +172,8 @@ int arch_cpu_init(void)
         */
        mxs_gpio_init();

+       mxs_dma_init();
+
        return 0;
 }
 #endif

,MMC still fails.

Still looking for a good place for calling mxs_dma_init();
Marek Vasut April 2, 2012, 7:03 p.m. UTC | #3
Dear Fabio Estevam,

> On Mon, Apr 2, 2012 at 3:39 PM, Marek Vasut <marex@denx.de> wrote:
> > This mxs_dma_desc_alloc() is called in a loop in the MXS NAND driver,
> > this is even worse ;-)
> > 
> > Possibly some common mx28 init code would be better?
> 
> If I put it in mx28.c like that:
> 
> +++ b/arch/arm/cpu/arm926ejs/mx28/mx28.c
> @@ -172,6 +172,8 @@ int arch_cpu_init(void)
>          */
>         mxs_gpio_init();
> 
> +       mxs_dma_init();
> +
>         return 0;
>  }
>  #endif
> 
> ,MMC still fails.

Because that's called before relocation ;-)

> 
> Still looking for a good place for calling mxs_dma_init();

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index c086629..68c4be2 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -346,6 +346,8 @@  struct mxs_dma_desc *mxs_dma_desc_alloc(void)
 	struct mxs_dma_desc *pdesc;
 	uint32_t size;
 
+	/* Initialize the DMA controller. */
+	mxs_dma_init();
 	size = roundup(sizeof(struct mxs_dma_desc), MXS_DMA_ALIGNMENT);
 	pdesc = memalign(MXS_DMA_ALIGNMENT, size);
 
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);