From 96666a39aed47c8c643dc7c6a6e15e314e63f42b Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 8 Apr 2012 17:34:46 +0000 Subject: DMA: Split the APBH DMA init into block and channel init This fixes the issue where mxs_dma_init() was called either twice or never, without introducing any new init hooks. The idea is to allow each and every device using the APBH DMA block to configure and request only the channels it uses, instead of making it call init for all the channels as is now. The common DMA block init part, which only configures the block, is then called from CPUs arch_cpu_init() call. NOTE: This patch depends on: http://patchwork.ozlabs.org/patch/150957/ Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel Cc: Fabio Estevam Tested-by: Fabio Estevam --- drivers/mtd/nand/mxs_nand.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'drivers/mtd/nand') diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c index 4b1297a..9c95811 100644 --- a/drivers/mtd/nand/mxs_nand.c +++ b/drivers/mtd/nand/mxs_nand.c @@ -1058,7 +1058,7 @@ int mxs_nand_init(struct mxs_nand_info *info) { struct mx28_gpmi_regs *gpmi_regs = (struct mx28_gpmi_regs *)MXS_GPMI_BASE; - int i = 0; + int i = 0, j; info->desc = malloc(sizeof(struct mxs_dma_desc *) * MXS_NAND_DMA_DESCRIPTOR_COUNT); @@ -1073,7 +1073,11 @@ int mxs_nand_init(struct mxs_nand_info *info) } /* Init the DMA controller. */ - mxs_dma_init(); + for (j = MXS_DMA_CHANNEL_AHB_APBH_GPMI0; + j <= MXS_DMA_CHANNEL_AHB_APBH_GPMI7; j++) { + if (mxs_dma_init_channel(j)) + goto err3; + } /* Reset the GPMI block. */ mx28_reset_block(&gpmi_regs->hw_gpmi_ctrl0_reg); @@ -1089,6 +1093,9 @@ int mxs_nand_init(struct mxs_nand_info *info) return 0; +err3: + for (--j; j >= 0; j--) + mxs_dma_release(j); err2: free(info->desc); err1: -- cgit v1.1