aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/imx-dma.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-09-15 03:57:00 -0400
committerShawn Guo <shawn.guo@linaro.org>2012-10-14 22:03:17 -0400
commit73930eb31b2ecb0177c9bf81a35b4d2d73716951 (patch)
tree0a341a992eb4f6b986a6fc665b4b48e049a3cbe3 /drivers/dma/imx-dma.c
parent04bbd8ef533fed260ea8cc249b534c1cbbc7f9d0 (diff)
dma: imx-dma: retrieve MEM and IRQ from resources
Retrieve MEM and IRQ from resources rather than directly using the value by including machine header. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Arnd Bergmann <arnd@arndb.de> Cc: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/dma/imx-dma.c')
-rw-r--r--drivers/dma/imx-dma.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index 1f2b79009d69..88e8a8d89b56 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -959,23 +959,22 @@ static void imxdma_issue_pending(struct dma_chan *chan)
959static int __init imxdma_probe(struct platform_device *pdev) 959static int __init imxdma_probe(struct platform_device *pdev)
960 { 960 {
961 struct imxdma_engine *imxdma; 961 struct imxdma_engine *imxdma;
962 struct resource *res;
962 int ret, i; 963 int ret, i;
963 964 int irq, irq_err;
964 965
965 imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL); 966 imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL);
966 if (!imxdma) 967 if (!imxdma)
967 return -ENOMEM; 968 return -ENOMEM;
968 969
969 if (cpu_is_mx1()) { 970 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
970 imxdma->base = MX1_IO_ADDRESS(MX1_DMA_BASE_ADDR); 971 imxdma->base = devm_request_and_ioremap(&pdev->dev, res);
971 } else if (cpu_is_mx21()) { 972 if (!imxdma->base)
972 imxdma->base = MX21_IO_ADDRESS(MX21_DMA_BASE_ADDR); 973 return -EADDRNOTAVAIL;
973 } else if (cpu_is_mx27()) { 974
974 imxdma->base = MX27_IO_ADDRESS(MX27_DMA_BASE_ADDR); 975 irq = platform_get_irq(pdev, 0);
975 } else { 976 if (irq < 0)
976 kfree(imxdma); 977 return irq;
977 return 0;
978 }
979 978
980 imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg"); 979 imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg");
981 if (IS_ERR(imxdma->dma_ipg)) 980 if (IS_ERR(imxdma->dma_ipg))
@@ -992,14 +991,20 @@ static int __init imxdma_probe(struct platform_device *pdev)
992 imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR); 991 imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR);
993 992
994 if (cpu_is_mx1()) { 993 if (cpu_is_mx1()) {
995 ret = devm_request_irq(&pdev->dev, MX1_DMA_INT, 994 ret = devm_request_irq(&pdev->dev, irq,
996 dma_irq_handler, 0, "DMA", imxdma); 995 dma_irq_handler, 0, "DMA", imxdma);
997 if (ret) { 996 if (ret) {
998 dev_warn(imxdma->dev, "Can't register IRQ for DMA\n"); 997 dev_warn(imxdma->dev, "Can't register IRQ for DMA\n");
999 goto err; 998 goto err;
1000 } 999 }
1001 1000
1002 ret = devm_request_irq(&pdev->dev, MX1_DMA_ERR, 1001 irq_err = platform_get_irq(pdev, 1);
1002 if (irq_err < 0) {
1003 ret = irq_err;
1004 goto err;
1005 }
1006
1007 ret = devm_request_irq(&pdev->dev, irq_err,
1003 imxdma_err_handler, 0, "DMA", imxdma); 1008 imxdma_err_handler, 0, "DMA", imxdma);
1004 if (ret) { 1009 if (ret) {
1005 dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n"); 1010 dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n");
@@ -1034,12 +1039,12 @@ static int __init imxdma_probe(struct platform_device *pdev)
1034 struct imxdma_channel *imxdmac = &imxdma->channel[i]; 1039 struct imxdma_channel *imxdmac = &imxdma->channel[i];
1035 1040
1036 if (cpu_is_mx21() || cpu_is_mx27()) { 1041 if (cpu_is_mx21() || cpu_is_mx27()) {
1037 ret = devm_request_irq(&pdev->dev, MX2x_INT_DMACH0 + i, 1042 ret = devm_request_irq(&pdev->dev, irq + i,
1038 dma_irq_handler, 0, "DMA", imxdma); 1043 dma_irq_handler, 0, "DMA", imxdma);
1039 if (ret) { 1044 if (ret) {
1040 dev_warn(imxdma->dev, "Can't register IRQ %d " 1045 dev_warn(imxdma->dev, "Can't register IRQ %d "
1041 "for DMA channel %d\n", 1046 "for DMA channel %d\n",
1042 MX2x_INT_DMACH0 + i, i); 1047 irq + i, i);
1043 goto err; 1048 goto err;
1044 } 1049 }
1045 init_timer(&imxdmac->watchdog); 1050 init_timer(&imxdmac->watchdog);