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 | */ |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 9 | #include "../hardware.h" |
Shawn Guo | e0557c0 | 2012-09-13 15:51:15 +0800 | [diff] [blame] | 10 | #include "devices-common.h" |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 11 | |
Shawn Guo | 27b7648 | 2012-09-16 16:26:20 +0800 | [diff] [blame] | 12 | #define imx_mx2_camera_data_entry_single(soc, _devid) \ |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 13 | { \ |
Shawn Guo | 27b7648 | 2012-09-16 16:26:20 +0800 | [diff] [blame] | 14 | .devid = _devid, \ |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 15 | .iobasecsi = soc ## _CSI_BASE_ADDR, \ |
Uwe Kleine-König | bb4c853 | 2010-11-11 17:11:34 +0100 | [diff] [blame] | 16 | .iosizecsi = SZ_4K, \ |
| 17 | .irqcsi = soc ## _INT_CSI, \ |
| 18 | } |
Shawn Guo | 27b7648 | 2012-09-16 16:26:20 +0800 | [diff] [blame] | 19 | #define imx_mx2_camera_data_entry_single_emma(soc, _devid) \ |
Uwe Kleine-König | bb4c853 | 2010-11-11 17:11:34 +0100 | [diff] [blame] | 20 | { \ |
Shawn Guo | 27b7648 | 2012-09-16 16:26:20 +0800 | [diff] [blame] | 21 | .devid = _devid, \ |
Uwe Kleine-König | bb4c853 | 2010-11-11 17:11:34 +0100 | [diff] [blame] | 22 | .iobasecsi = soc ## _CSI_BASE_ADDR, \ |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 23 | .iosizecsi = SZ_32, \ |
| 24 | .irqcsi = soc ## _INT_CSI, \ |
| 25 | .iobaseemmaprp = soc ## _EMMAPRP_BASE_ADDR, \ |
| 26 | .iosizeemmaprp = SZ_32, \ |
| 27 | .irqemmaprp = soc ## _INT_EMMAPRP, \ |
| 28 | } |
| 29 | |
| 30 | #ifdef CONFIG_SOC_IMX27 |
| 31 | const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst = |
Shawn Guo | 27b7648 | 2012-09-16 16:26:20 +0800 | [diff] [blame] | 32 | imx_mx2_camera_data_entry_single_emma(MX27, "imx27-camera"); |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 33 | #endif /* ifdef CONFIG_SOC_IMX27 */ |
| 34 | |
| 35 | struct platform_device *__init imx_add_mx2_camera( |
| 36 | const struct imx_mx2_camera_data *data, |
| 37 | const struct mx2_camera_platform_data *pdata) |
| 38 | { |
| 39 | struct resource res[] = { |
| 40 | { |
| 41 | .start = data->iobasecsi, |
| 42 | .end = data->iobasecsi + data->iosizecsi - 1, |
| 43 | .flags = IORESOURCE_MEM, |
| 44 | }, { |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 45 | .start = data->irqcsi, |
| 46 | .end = data->irqcsi, |
| 47 | .flags = IORESOURCE_IRQ, |
| 48 | }, { |
Uwe Kleine-König | bb4c853 | 2010-11-11 17:11:34 +0100 | [diff] [blame] | 49 | .start = data->iobaseemmaprp, |
| 50 | .end = data->iobaseemmaprp + data->iosizeemmaprp - 1, |
| 51 | .flags = IORESOURCE_MEM, |
| 52 | }, { |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 53 | .start = data->irqemmaprp, |
| 54 | .end = data->irqemmaprp, |
| 55 | .flags = IORESOURCE_IRQ, |
| 56 | }, |
| 57 | }; |
Shawn Guo | 27b7648 | 2012-09-16 16:26:20 +0800 | [diff] [blame] | 58 | return imx_add_platform_device_dmamask(data->devid, 0, |
Uwe Kleine-König | bb4c853 | 2010-11-11 17:11:34 +0100 | [diff] [blame] | 59 | res, data->iobaseemmaprp ? 4 : 2, |
Uwe Kleine-König | b2997cb | 2010-11-02 17:50:55 +0100 | [diff] [blame] | 60 | pdata, sizeof(*pdata), DMA_BIT_MASK(32)); |
| 61 | } |
Javier Martin | 52f1a84 | 2012-01-13 06:31:57 -0300 | [diff] [blame] | 62 | |