diff options
author | Tony Lindgren <tony@atomide.com> | 2013-01-11 14:24:19 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2013-01-11 14:24:19 -0500 |
commit | be1f94812c2cc0aaf696d39fe23104763ea52b5b (patch) | |
tree | 2f9789af80ad91ad976a824548c0c2aa4d9b591f | |
parent | a6cf912c6047077a6eb860ed8dbfa342376ee395 (diff) |
ARM: OMAP: Fix dmaengine init for multiplatform
Otherwise omap dmaengine will initialized when booted
on other SoCs. Fix this by initializing the platform
device in arch/arm/*omap*/dma.c instead.
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Dan Williams <djbw@fb.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | arch/arm/mach-omap1/dma.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-omap2/dma.c | 21 | ||||
-rw-r--r-- | drivers/dma/omap-dma.c | 20 |
3 files changed, 36 insertions, 23 deletions
diff --git a/arch/arm/mach-omap1/dma.c b/arch/arm/mach-omap1/dma.c index e190611e4b46..1a4e887f028d 100644 --- a/arch/arm/mach-omap1/dma.c +++ b/arch/arm/mach-omap1/dma.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/device.h> | 25 | #include <linux/device.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | 27 | #include <linux/dma-mapping.h> | |
28 | #include <linux/omap-dma.h> | 28 | #include <linux/omap-dma.h> |
29 | #include <mach/tc.h> | 29 | #include <mach/tc.h> |
30 | 30 | ||
@@ -270,11 +270,17 @@ static u32 configure_dma_errata(void) | |||
270 | return errata; | 270 | return errata; |
271 | } | 271 | } |
272 | 272 | ||
273 | static const struct platform_device_info omap_dma_dev_info = { | ||
274 | .name = "omap-dma-engine", | ||
275 | .id = -1, | ||
276 | .dma_mask = DMA_BIT_MASK(32), | ||
277 | }; | ||
278 | |||
273 | static int __init omap1_system_dma_init(void) | 279 | static int __init omap1_system_dma_init(void) |
274 | { | 280 | { |
275 | struct omap_system_dma_plat_info *p; | 281 | struct omap_system_dma_plat_info *p; |
276 | struct omap_dma_dev_attr *d; | 282 | struct omap_dma_dev_attr *d; |
277 | struct platform_device *pdev; | 283 | struct platform_device *pdev, *dma_pdev; |
278 | int ret; | 284 | int ret; |
279 | 285 | ||
280 | pdev = platform_device_alloc("omap_dma_system", 0); | 286 | pdev = platform_device_alloc("omap_dma_system", 0); |
@@ -380,8 +386,16 @@ static int __init omap1_system_dma_init(void) | |||
380 | dma_common_ch_start = CPC; | 386 | dma_common_ch_start = CPC; |
381 | dma_common_ch_end = COLOR; | 387 | dma_common_ch_end = COLOR; |
382 | 388 | ||
389 | dma_pdev = platform_device_register_full(&omap_dma_dev_info); | ||
390 | if (IS_ERR(dma_pdev)) { | ||
391 | ret = PTR_ERR(dma_pdev); | ||
392 | goto exit_release_pdev; | ||
393 | } | ||
394 | |||
383 | return ret; | 395 | return ret; |
384 | 396 | ||
397 | exit_release_pdev: | ||
398 | platform_device_del(pdev); | ||
385 | exit_release_chan: | 399 | exit_release_chan: |
386 | kfree(d->chan); | 400 | kfree(d->chan); |
387 | exit_release_d: | 401 | exit_release_d: |
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c index e034ab69a046..5cd8d7668bec 100644 --- a/arch/arm/mach-omap2/dma.c +++ b/arch/arm/mach-omap2/dma.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/device.h> | 29 | #include <linux/device.h> |
30 | 30 | #include <linux/dma-mapping.h> | |
31 | #include <linux/omap-dma.h> | 31 | #include <linux/omap-dma.h> |
32 | 32 | ||
33 | #include "soc.h" | 33 | #include "soc.h" |
@@ -288,9 +288,26 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) | |||
288 | return 0; | 288 | return 0; |
289 | } | 289 | } |
290 | 290 | ||
291 | static const struct platform_device_info omap_dma_dev_info = { | ||
292 | .name = "omap-dma-engine", | ||
293 | .id = -1, | ||
294 | .dma_mask = DMA_BIT_MASK(32), | ||
295 | }; | ||
296 | |||
291 | static int __init omap2_system_dma_init(void) | 297 | static int __init omap2_system_dma_init(void) |
292 | { | 298 | { |
293 | return omap_hwmod_for_each_by_class("dma", | 299 | struct platform_device *pdev; |
300 | int res; | ||
301 | |||
302 | res = omap_hwmod_for_each_by_class("dma", | ||
294 | omap2_system_dma_init_dev, NULL); | 303 | omap2_system_dma_init_dev, NULL); |
304 | if (res) | ||
305 | return res; | ||
306 | |||
307 | pdev = platform_device_register_full(&omap_dma_dev_info); | ||
308 | if (IS_ERR(pdev)) | ||
309 | return PTR_ERR(pdev); | ||
310 | |||
311 | return res; | ||
295 | } | 312 | } |
296 | omap_arch_initcall(omap2_system_dma_init); | 313 | omap_arch_initcall(omap2_system_dma_init); |
diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c index 5a31264f2bd1..c4b4fd2acc42 100644 --- a/drivers/dma/omap-dma.c +++ b/drivers/dma/omap-dma.c | |||
@@ -661,32 +661,14 @@ bool omap_dma_filter_fn(struct dma_chan *chan, void *param) | |||
661 | } | 661 | } |
662 | EXPORT_SYMBOL_GPL(omap_dma_filter_fn); | 662 | EXPORT_SYMBOL_GPL(omap_dma_filter_fn); |
663 | 663 | ||
664 | static struct platform_device *pdev; | ||
665 | |||
666 | static const struct platform_device_info omap_dma_dev_info = { | ||
667 | .name = "omap-dma-engine", | ||
668 | .id = -1, | ||
669 | .dma_mask = DMA_BIT_MASK(32), | ||
670 | }; | ||
671 | |||
672 | static int omap_dma_init(void) | 664 | static int omap_dma_init(void) |
673 | { | 665 | { |
674 | int rc = platform_driver_register(&omap_dma_driver); | 666 | return platform_driver_register(&omap_dma_driver); |
675 | |||
676 | if (rc == 0) { | ||
677 | pdev = platform_device_register_full(&omap_dma_dev_info); | ||
678 | if (IS_ERR(pdev)) { | ||
679 | platform_driver_unregister(&omap_dma_driver); | ||
680 | rc = PTR_ERR(pdev); | ||
681 | } | ||
682 | } | ||
683 | return rc; | ||
684 | } | 667 | } |
685 | subsys_initcall(omap_dma_init); | 668 | subsys_initcall(omap_dma_init); |
686 | 669 | ||
687 | static void __exit omap_dma_exit(void) | 670 | static void __exit omap_dma_exit(void) |
688 | { | 671 | { |
689 | platform_device_unregister(pdev); | ||
690 | platform_driver_unregister(&omap_dma_driver); | 672 | platform_driver_unregister(&omap_dma_driver); |
691 | } | 673 | } |
692 | module_exit(omap_dma_exit); | 674 | module_exit(omap_dma_exit); |