Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 Pengutronix |
| 3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it under |
| 6 | * the terms of the GNU General Public License version 2 as published by the |
| 7 | * Free Software Foundation. |
| 8 | */ |
| 9 | #include <mach/hardware.h> |
| 10 | #include <mach/devices-common.h> |
| 11 | |
| 12 | #define imx_mx2_camera_data_entry_single(soc) \ |
| 13 | { \ |
| 14 | .iobasecsi = soc ## _CSI_BASE_ADDR, \ |
Uwe Kleine-König | bb4c853 | 2010-11-11 17:11:34 +0100 | [diff] [blame] | 15 | .iosizecsi = SZ_4K, \ |
| 16 | .irqcsi = soc ## _INT_CSI, \ |
| 17 | } |
| 18 | #define imx_mx2_camera_data_entry_single_emma(soc) \ |
| 19 | { \ |
| 20 | .iobasecsi = soc ## _CSI_BASE_ADDR, \ |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 21 | .iosizecsi = SZ_32, \ |
| 22 | .irqcsi = soc ## _INT_CSI, \ |
| 23 | .iobaseemmaprp = soc ## _EMMAPRP_BASE_ADDR, \ |
| 24 | .iosizeemmaprp = SZ_32, \ |
| 25 | .irqemmaprp = soc ## _INT_EMMAPRP, \ |
| 26 | } |
| 27 | |
Uwe Kleine-König | bb4c853 | 2010-11-11 17:11:34 +0100 | [diff] [blame] | 28 | #ifdef CONFIG_SOC_IMX25 |
| 29 | const struct imx_mx2_camera_data imx25_mx2_camera_data __initconst = |
| 30 | imx_mx2_camera_data_entry_single(MX25); |
| 31 | #endif /* ifdef CONFIG_SOC_IMX25 */ |
| 32 | |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 33 | #ifdef CONFIG_SOC_IMX27 |
| 34 | const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst = |
Uwe Kleine-König | bb4c853 | 2010-11-11 17:11:34 +0100 | [diff] [blame] | 35 | imx_mx2_camera_data_entry_single_emma(MX27); |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 36 | #endif /* ifdef CONFIG_SOC_IMX27 */ |
| 37 | |
| 38 | struct platform_device *__init imx_add_mx2_camera( |
| 39 | const struct imx_mx2_camera_data *data, |
| 40 | const struct mx2_camera_platform_data *pdata) |
| 41 | { |
| 42 | struct resource res[] = { |
| 43 | { |
| 44 | .start = data->iobasecsi, |
| 45 | .end = data->iobasecsi + data->iosizecsi - 1, |
| 46 | .flags = IORESOURCE_MEM, |
| 47 | }, { |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 48 | .start = data->irqcsi, |
| 49 | .end = data->irqcsi, |
| 50 | .flags = IORESOURCE_IRQ, |
| 51 | }, { |
Uwe Kleine-König | bb4c853 | 2010-11-11 17:11:34 +0100 | [diff] [blame] | 52 | .start = data->iobaseemmaprp, |
| 53 | .end = data->iobaseemmaprp + data->iosizeemmaprp - 1, |
| 54 | .flags = IORESOURCE_MEM, |
| 55 | }, { |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 56 | .start = data->irqemmaprp, |
| 57 | .end = data->irqemmaprp, |
| 58 | .flags = IORESOURCE_IRQ, |
| 59 | }, |
| 60 | }; |
| 61 | return imx_add_platform_device_dmamask("mx2-camera", 0, |
Uwe Kleine-König | bb4c853 | 2010-11-11 17:11:34 +0100 | [diff] [blame] | 62 | res, data->iobaseemmaprp ? 4 : 2, |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 63 | pdata, sizeof(*pdata), DMA_BIT_MASK(32)); |
| 64 | } |