diff options
Diffstat (limited to 'arch/arm/mach-mx3/mach-mx31moboard.c')
-rw-r--r-- | arch/arm/mach-mx3/mach-mx31moboard.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c index 6c13061b6ac2..eaaea2dbd4fd 100644 --- a/arch/arm/mach-mx3/mach-mx31moboard.c +++ b/arch/arm/mach-mx3/mach-mx31moboard.c | |||
@@ -40,12 +40,9 @@ | |||
40 | #include <mach/common.h> | 40 | #include <mach/common.h> |
41 | #include <mach/hardware.h> | 41 | #include <mach/hardware.h> |
42 | #include <mach/iomux-mx3.h> | 42 | #include <mach/iomux-mx3.h> |
43 | #include <mach/ipu.h> | ||
44 | #include <mach/mx3_camera.h> | ||
45 | #include <mach/ulpi.h> | 43 | #include <mach/ulpi.h> |
46 | 44 | ||
47 | #include "devices-imx31.h" | 45 | #include "devices-imx31.h" |
48 | #include "devices.h" | ||
49 | 46 | ||
50 | static unsigned int moboard_pins[] = { | 47 | static unsigned int moboard_pins[] = { |
51 | /* UART0 */ | 48 | /* UART0 */ |
@@ -194,8 +191,8 @@ static struct regulator_init_data sdhc_vreg_data = { | |||
194 | 191 | ||
195 | static struct regulator_consumer_supply cam_consumers[] = { | 192 | static struct regulator_consumer_supply cam_consumers[] = { |
196 | { | 193 | { |
197 | .dev = &mx3_camera.dev, | 194 | .dev_name = "mx3_camera.0", |
198 | .supply = "cam_vcc", | 195 | .supply = "cam_vcc", |
199 | }, | 196 | }, |
200 | }; | 197 | }; |
201 | 198 | ||
@@ -458,7 +455,7 @@ static struct platform_device mx31moboard_leds_device = { | |||
458 | }, | 455 | }, |
459 | }; | 456 | }; |
460 | 457 | ||
461 | static struct ipu_platform_data mx3_ipu_data = { | 458 | static const struct ipu_platform_data mx3_ipu_data __initconst = { |
462 | .irq_base = MXC_IPU_IRQ_START, | 459 | .irq_base = MXC_IPU_IRQ_START, |
463 | }; | 460 | }; |
464 | 461 | ||
@@ -467,8 +464,7 @@ static struct platform_device *devices[] __initdata = { | |||
467 | &mx31moboard_leds_device, | 464 | &mx31moboard_leds_device, |
468 | }; | 465 | }; |
469 | 466 | ||
470 | static struct mx3_camera_pdata camera_pdata = { | 467 | static struct mx3_camera_pdata camera_pdata __initdata = { |
471 | .dma_dev = &mx3_ipu.dev, | ||
472 | .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10, | 468 | .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10, |
473 | .mclk_10khz = 4800, | 469 | .mclk_10khz = 4800, |
474 | }; | 470 | }; |
@@ -476,18 +472,31 @@ static struct mx3_camera_pdata camera_pdata = { | |||
476 | static phys_addr_t mx3_camera_base __initdata; | 472 | static phys_addr_t mx3_camera_base __initdata; |
477 | #define MX3_CAMERA_BUF_SIZE SZ_4M | 473 | #define MX3_CAMERA_BUF_SIZE SZ_4M |
478 | 474 | ||
479 | static int __init mx31moboard_cam_alloc_dma(void) | 475 | static int __init mx31moboard_init_cam(void) |
480 | { | 476 | { |
481 | int dma; | 477 | int dma, ret = -ENOMEM; |
478 | struct platform_device *pdev; | ||
479 | |||
480 | imx31_add_ipu_core(&mx3_ipu_data); | ||
482 | 481 | ||
482 | pdev = imx31_alloc_mx3_camera(&camera_pdata); | ||
483 | if (IS_ERR(pdev)) | ||
484 | return PTR_ERR(pdev); | ||
483 | 485 | ||
484 | dma = dma_declare_coherent_memory(&mx3_camera.dev, | 486 | dma = dma_declare_coherent_memory(&pdev->dev, |
485 | mx3_camera_base, mx3_camera_base, | 487 | mx3_camera_base, mx3_camera_base, |
486 | MX3_CAMERA_BUF_SIZE, | 488 | MX3_CAMERA_BUF_SIZE, |
487 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | 489 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); |
490 | if (!(dma & DMA_MEMORY_MAP)) | ||
491 | goto err; | ||
492 | |||
493 | ret = platform_device_add(pdev); | ||
494 | if (ret) | ||
495 | err: | ||
496 | platform_device_put(pdev); | ||
497 | |||
498 | return ret; | ||
488 | 499 | ||
489 | /* The way we call dma_declare_coherent_memory only a malloc can fail */ | ||
490 | return dma & DMA_MEMORY_MAP ? 0 : -ENOMEM; | ||
491 | } | 500 | } |
492 | 501 | ||
493 | static int mx31moboard_baseboard; | 502 | static int mx31moboard_baseboard; |
@@ -519,9 +528,7 @@ static void __init mx31moboard_init(void) | |||
519 | 528 | ||
520 | imx31_add_mxc_mmc(0, &sdhc1_pdata); | 529 | imx31_add_mxc_mmc(0, &sdhc1_pdata); |
521 | 530 | ||
522 | mxc_register_device(&mx3_ipu, &mx3_ipu_data); | 531 | mx31moboard_init_cam(); |
523 | if (!mx31moboard_cam_alloc_dma()) | ||
524 | mxc_register_device(&mx3_camera, &camera_pdata); | ||
525 | 532 | ||
526 | usb_xcvr_reset(); | 533 | usb_xcvr_reset(); |
527 | 534 | ||