aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 14:51:39 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 14:51:39 -0500
commitd01e4afdbb65e030fd6f1f96c30a558e2eb0f279 (patch)
tree02ef82b2740cf93a98199eded5ef765fa6e03052 /drivers/dma
parent8287361abca36504da813638310d2547469283eb (diff)
parent794b175fc0c0c4844dbb7b137a73bbfd01f6c608 (diff)
Merge tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanups on various subarchitectures from Olof Johansson: "Cleanup patches for various ARM platforms and some of their associated drivers. There's also a branch in here that enables Freescale i.MX to be part of the multiplatform support -- the first "big" SoC that is moved over (more multiplatform work comes in a separate branch later during the merge window)." Conflicts fixed as per Olof, including a silent semantic one in arch/arm/mach-omap2/board-generic.c (omap_prcm_restart() was renamed to omap3xxx_restart(), and a new user of the old name was added). * tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (189 commits) ARM: omap: fix typo on timer cleanup ARM: EXYNOS: Remove unused regs-mem.h file ARM: EXYNOS: Remove unused non-dt support for dwmci controller ARM: Kirkwood: Use hw_pci.ops instead of hw_pci.scan ARM: OMAP3: cm-t3517: use GPTIMER for system clock ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER ARM: SAMSUNG: use devm_ functions for ADC driver ARM: EXYNOS: no duplicate mask/unmask in eint0_15 ARM: S3C24XX: SPI clock channel setup is fixed for S3C2443 ARM: EXYNOS: Remove i2c0 resource information and setting of device names ARM: Kirkwood: checkpatch cleanups ARM: Kirkwood: Fix sparse warnings. ARM: Kirkwood: Remove unused includes ARM: kirkwood: cleanup lsxl board includes ARM: integrator: use BUG_ON where possible ARM: integrator: push down SC dependencies ARM: integrator: delete static UART1 mapping ARM: integrator: delete SC mapping on the CP ARM: integrator: remove static CP syscon mapping ARM: integrator: remove static AP syscon mapping ...
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/imx-dma.c137
-rw-r--r--drivers/dma/imx-sdma.c1
-rw-r--r--drivers/dma/ipu/ipu_idmac.c3
-rw-r--r--drivers/dma/ipu/ipu_irq.c3
4 files changed, 82 insertions, 62 deletions
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index 7d9554cc4976..dbf0e6f8de8a 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -29,7 +29,6 @@
29 29
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <linux/platform_data/dma-imx.h> 31#include <linux/platform_data/dma-imx.h>
32#include <mach/hardware.h>
33 32
34#include "dmaengine.h" 33#include "dmaengine.h"
35#define IMXDMA_MAX_CHAN_DESCRIPTORS 16 34#define IMXDMA_MAX_CHAN_DESCRIPTORS 16
@@ -167,6 +166,12 @@ struct imxdma_channel {
167 int slot_2d; 166 int slot_2d;
168}; 167};
169 168
169enum imx_dma_type {
170 IMX1_DMA,
171 IMX21_DMA,
172 IMX27_DMA,
173};
174
170struct imxdma_engine { 175struct imxdma_engine {
171 struct device *dev; 176 struct device *dev;
172 struct device_dma_parameters dma_parms; 177 struct device_dma_parameters dma_parms;
@@ -177,7 +182,39 @@ struct imxdma_engine {
177 spinlock_t lock; 182 spinlock_t lock;
178 struct imx_dma_2d_config slots_2d[IMX_DMA_2D_SLOTS]; 183 struct imx_dma_2d_config slots_2d[IMX_DMA_2D_SLOTS];
179 struct imxdma_channel channel[IMX_DMA_CHANNELS]; 184 struct imxdma_channel channel[IMX_DMA_CHANNELS];
185 enum imx_dma_type devtype;
186};
187
188static struct platform_device_id imx_dma_devtype[] = {
189 {
190 .name = "imx1-dma",
191 .driver_data = IMX1_DMA,
192 }, {
193 .name = "imx21-dma",
194 .driver_data = IMX21_DMA,
195 }, {
196 .name = "imx27-dma",
197 .driver_data = IMX27_DMA,
198 }, {
199 /* sentinel */
200 }
180}; 201};
202MODULE_DEVICE_TABLE(platform, imx_dma_devtype);
203
204static inline int is_imx1_dma(struct imxdma_engine *imxdma)
205{
206 return imxdma->devtype == IMX1_DMA;
207}
208
209static inline int is_imx21_dma(struct imxdma_engine *imxdma)
210{
211 return imxdma->devtype == IMX21_DMA;
212}
213
214static inline int is_imx27_dma(struct imxdma_engine *imxdma)
215{
216 return imxdma->devtype == IMX27_DMA;
217}
181 218
182static struct imxdma_channel *to_imxdma_chan(struct dma_chan *chan) 219static struct imxdma_channel *to_imxdma_chan(struct dma_chan *chan)
183{ 220{
@@ -212,7 +249,9 @@ static unsigned imx_dmav1_readl(struct imxdma_engine *imxdma, unsigned offset)
212 249
213static int imxdma_hw_chain(struct imxdma_channel *imxdmac) 250static int imxdma_hw_chain(struct imxdma_channel *imxdmac)
214{ 251{
215 if (cpu_is_mx27()) 252 struct imxdma_engine *imxdma = imxdmac->imxdma;
253
254 if (is_imx27_dma(imxdma))
216 return imxdmac->hw_chaining; 255 return imxdmac->hw_chaining;
217 else 256 else
218 return 0; 257 return 0;
@@ -267,7 +306,7 @@ static void imxdma_enable_hw(struct imxdma_desc *d)
267 imx_dmav1_writel(imxdma, imx_dmav1_readl(imxdma, DMA_CCR(channel)) | 306 imx_dmav1_writel(imxdma, imx_dmav1_readl(imxdma, DMA_CCR(channel)) |
268 CCR_CEN | CCR_ACRPT, DMA_CCR(channel)); 307 CCR_CEN | CCR_ACRPT, DMA_CCR(channel));
269 308
270 if ((cpu_is_mx21() || cpu_is_mx27()) && 309 if (!is_imx1_dma(imxdma) &&
271 d->sg && imxdma_hw_chain(imxdmac)) { 310 d->sg && imxdma_hw_chain(imxdmac)) {
272 d->sg = sg_next(d->sg); 311 d->sg = sg_next(d->sg);
273 if (d->sg) { 312 if (d->sg) {
@@ -436,7 +475,7 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
436 struct imxdma_engine *imxdma = dev_id; 475 struct imxdma_engine *imxdma = dev_id;
437 int i, disr; 476 int i, disr;
438 477
439 if (cpu_is_mx21() || cpu_is_mx27()) 478 if (!is_imx1_dma(imxdma))
440 imxdma_err_handler(irq, dev_id); 479 imxdma_err_handler(irq, dev_id);
441 480
442 disr = imx_dmav1_readl(imxdma, DMA_DISR); 481 disr = imx_dmav1_readl(imxdma, DMA_DISR);
@@ -961,35 +1000,32 @@ static void imxdma_issue_pending(struct dma_chan *chan)
961static int __init imxdma_probe(struct platform_device *pdev) 1000static int __init imxdma_probe(struct platform_device *pdev)
962 { 1001 {
963 struct imxdma_engine *imxdma; 1002 struct imxdma_engine *imxdma;
1003 struct resource *res;
964 int ret, i; 1004 int ret, i;
1005 int irq, irq_err;
965 1006
966 1007 imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL);
967 imxdma = kzalloc(sizeof(*imxdma), GFP_KERNEL);
968 if (!imxdma) 1008 if (!imxdma)
969 return -ENOMEM; 1009 return -ENOMEM;
970 1010
971 if (cpu_is_mx1()) { 1011 imxdma->devtype = pdev->id_entry->driver_data;
972 imxdma->base = MX1_IO_ADDRESS(MX1_DMA_BASE_ADDR); 1012
973 } else if (cpu_is_mx21()) { 1013 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
974 imxdma->base = MX21_IO_ADDRESS(MX21_DMA_BASE_ADDR); 1014 imxdma->base = devm_request_and_ioremap(&pdev->dev, res);
975 } else if (cpu_is_mx27()) { 1015 if (!imxdma->base)
976 imxdma->base = MX27_IO_ADDRESS(MX27_DMA_BASE_ADDR); 1016 return -EADDRNOTAVAIL;
977 } else { 1017
978 kfree(imxdma); 1018 irq = platform_get_irq(pdev, 0);
979 return 0; 1019 if (irq < 0)
980 } 1020 return irq;
981 1021
982 imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg"); 1022 imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg");
983 if (IS_ERR(imxdma->dma_ipg)) { 1023 if (IS_ERR(imxdma->dma_ipg))
984 ret = PTR_ERR(imxdma->dma_ipg); 1024 return PTR_ERR(imxdma->dma_ipg);
985 goto err_clk;
986 }
987 1025
988 imxdma->dma_ahb = devm_clk_get(&pdev->dev, "ahb"); 1026 imxdma->dma_ahb = devm_clk_get(&pdev->dev, "ahb");
989 if (IS_ERR(imxdma->dma_ahb)) { 1027 if (IS_ERR(imxdma->dma_ahb))
990 ret = PTR_ERR(imxdma->dma_ahb); 1028 return PTR_ERR(imxdma->dma_ahb);
991 goto err_clk;
992 }
993 1029
994 clk_prepare_enable(imxdma->dma_ipg); 1030 clk_prepare_enable(imxdma->dma_ipg);
995 clk_prepare_enable(imxdma->dma_ahb); 1031 clk_prepare_enable(imxdma->dma_ahb);
@@ -997,18 +1033,25 @@ static int __init imxdma_probe(struct platform_device *pdev)
997 /* reset DMA module */ 1033 /* reset DMA module */
998 imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR); 1034 imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR);
999 1035
1000 if (cpu_is_mx1()) { 1036 if (is_imx1_dma(imxdma)) {
1001 ret = request_irq(MX1_DMA_INT, dma_irq_handler, 0, "DMA", imxdma); 1037 ret = devm_request_irq(&pdev->dev, irq,
1038 dma_irq_handler, 0, "DMA", imxdma);
1002 if (ret) { 1039 if (ret) {
1003 dev_warn(imxdma->dev, "Can't register IRQ for DMA\n"); 1040 dev_warn(imxdma->dev, "Can't register IRQ for DMA\n");
1004 goto err_enable; 1041 goto err;
1042 }
1043
1044 irq_err = platform_get_irq(pdev, 1);
1045 if (irq_err < 0) {
1046 ret = irq_err;
1047 goto err;
1005 } 1048 }
1006 1049
1007 ret = request_irq(MX1_DMA_ERR, imxdma_err_handler, 0, "DMA", imxdma); 1050 ret = devm_request_irq(&pdev->dev, irq_err,
1051 imxdma_err_handler, 0, "DMA", imxdma);
1008 if (ret) { 1052 if (ret) {
1009 dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n"); 1053 dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n");
1010 free_irq(MX1_DMA_INT, NULL); 1054 goto err;
1011 goto err_enable;
1012 } 1055 }
1013 } 1056 }
1014 1057
@@ -1038,14 +1081,14 @@ static int __init imxdma_probe(struct platform_device *pdev)
1038 for (i = 0; i < IMX_DMA_CHANNELS; i++) { 1081 for (i = 0; i < IMX_DMA_CHANNELS; i++) {
1039 struct imxdma_channel *imxdmac = &imxdma->channel[i]; 1082 struct imxdma_channel *imxdmac = &imxdma->channel[i];
1040 1083
1041 if (cpu_is_mx21() || cpu_is_mx27()) { 1084 if (!is_imx1_dma(imxdma)) {
1042 ret = request_irq(MX2x_INT_DMACH0 + i, 1085 ret = devm_request_irq(&pdev->dev, irq + i,
1043 dma_irq_handler, 0, "DMA", imxdma); 1086 dma_irq_handler, 0, "DMA", imxdma);
1044 if (ret) { 1087 if (ret) {
1045 dev_warn(imxdma->dev, "Can't register IRQ %d " 1088 dev_warn(imxdma->dev, "Can't register IRQ %d "
1046 "for DMA channel %d\n", 1089 "for DMA channel %d\n",
1047 MX2x_INT_DMACH0 + i, i); 1090 irq + i, i);
1048 goto err_init; 1091 goto err;
1049 } 1092 }
1050 init_timer(&imxdmac->watchdog); 1093 init_timer(&imxdmac->watchdog);
1051 imxdmac->watchdog.function = &imxdma_watchdog; 1094 imxdmac->watchdog.function = &imxdma_watchdog;
@@ -1091,46 +1134,25 @@ static int __init imxdma_probe(struct platform_device *pdev)
1091 ret = dma_async_device_register(&imxdma->dma_device); 1134 ret = dma_async_device_register(&imxdma->dma_device);
1092 if (ret) { 1135 if (ret) {
1093 dev_err(&pdev->dev, "unable to register\n"); 1136 dev_err(&pdev->dev, "unable to register\n");
1094 goto err_init; 1137 goto err;
1095 } 1138 }
1096 1139
1097 return 0; 1140 return 0;
1098 1141
1099err_init: 1142err:
1100
1101 if (cpu_is_mx21() || cpu_is_mx27()) {
1102 while (--i >= 0)
1103 free_irq(MX2x_INT_DMACH0 + i, NULL);
1104 } else if cpu_is_mx1() {
1105 free_irq(MX1_DMA_INT, NULL);
1106 free_irq(MX1_DMA_ERR, NULL);
1107 }
1108err_enable:
1109 clk_disable_unprepare(imxdma->dma_ipg); 1143 clk_disable_unprepare(imxdma->dma_ipg);
1110 clk_disable_unprepare(imxdma->dma_ahb); 1144 clk_disable_unprepare(imxdma->dma_ahb);
1111err_clk:
1112 kfree(imxdma);
1113 return ret; 1145 return ret;
1114} 1146}
1115 1147
1116static int __exit imxdma_remove(struct platform_device *pdev) 1148static int __exit imxdma_remove(struct platform_device *pdev)
1117{ 1149{
1118 struct imxdma_engine *imxdma = platform_get_drvdata(pdev); 1150 struct imxdma_engine *imxdma = platform_get_drvdata(pdev);
1119 int i;
1120 1151
1121 dma_async_device_unregister(&imxdma->dma_device); 1152 dma_async_device_unregister(&imxdma->dma_device);
1122 1153
1123 if (cpu_is_mx21() || cpu_is_mx27()) {
1124 for (i = 0; i < IMX_DMA_CHANNELS; i++)
1125 free_irq(MX2x_INT_DMACH0 + i, NULL);
1126 } else if cpu_is_mx1() {
1127 free_irq(MX1_DMA_INT, NULL);
1128 free_irq(MX1_DMA_ERR, NULL);
1129 }
1130
1131 clk_disable_unprepare(imxdma->dma_ipg); 1154 clk_disable_unprepare(imxdma->dma_ipg);
1132 clk_disable_unprepare(imxdma->dma_ahb); 1155 clk_disable_unprepare(imxdma->dma_ahb);
1133 kfree(imxdma);
1134 1156
1135 return 0; 1157 return 0;
1136} 1158}
@@ -1139,6 +1161,7 @@ static struct platform_driver imxdma_driver = {
1139 .driver = { 1161 .driver = {
1140 .name = "imx-dma", 1162 .name = "imx-dma",
1141 }, 1163 },
1164 .id_table = imx_dma_devtype,
1142 .remove = __exit_p(imxdma_remove), 1165 .remove = __exit_p(imxdma_remove),
1143}; 1166};
1144 1167
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index c099ca0846f4..f082aa3a918c 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -40,7 +40,6 @@
40#include <asm/irq.h> 40#include <asm/irq.h>
41#include <linux/platform_data/dma-imx-sdma.h> 41#include <linux/platform_data/dma-imx-sdma.h>
42#include <linux/platform_data/dma-imx.h> 42#include <linux/platform_data/dma-imx.h>
43#include <mach/hardware.h>
44 43
45#include "dmaengine.h" 44#include "dmaengine.h"
46 45
diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c
index c7573e50aa14..65855373cee6 100644
--- a/drivers/dma/ipu/ipu_idmac.c
+++ b/drivers/dma/ipu/ipu_idmac.c
@@ -22,8 +22,7 @@
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/module.h> 24#include <linux/module.h>
25 25#include <linux/dma/ipu-dma.h>
26#include <mach/ipu.h>
27 26
28#include "../dmaengine.h" 27#include "../dmaengine.h"
29#include "ipu_intern.h" 28#include "ipu_intern.h"
diff --git a/drivers/dma/ipu/ipu_irq.c b/drivers/dma/ipu/ipu_irq.c
index fa95bcc3de1f..a5ee37d5320f 100644
--- a/drivers/dma/ipu/ipu_irq.c
+++ b/drivers/dma/ipu/ipu_irq.c
@@ -15,8 +15,7 @@
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/module.h> 17#include <linux/module.h>
18 18#include <linux/dma/ipu-dma.h>
19#include <mach/ipu.h>
20 19
21#include "ipu_intern.h" 20#include "ipu_intern.h"
22 21