blob: 4c377c33242c75b31bfe8849a5662cb770486223 [file] [log] [blame]
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +01001/*
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 Guo50f2de62012-09-14 14:14:45 +08009#include "../hardware.h"
Shawn Guoe0557c02012-09-13 15:51:15 +080010#include "devices-common.h"
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +010011
Shawn Guo27b76482012-09-16 16:26:20 +080012#define imx_mx2_camera_data_entry_single(soc, _devid) \
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +010013 { \
Shawn Guo27b76482012-09-16 16:26:20 +080014 .devid = _devid, \
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +010015 .iobasecsi = soc ## _CSI_BASE_ADDR, \
Uwe Kleine-Königbb4c8532010-11-11 17:11:34 +010016 .iosizecsi = SZ_4K, \
17 .irqcsi = soc ## _INT_CSI, \
18 }
Shawn Guo27b76482012-09-16 16:26:20 +080019#define imx_mx2_camera_data_entry_single_emma(soc, _devid) \
Uwe Kleine-Königbb4c8532010-11-11 17:11:34 +010020 { \
Shawn Guo27b76482012-09-16 16:26:20 +080021 .devid = _devid, \
Uwe Kleine-Königbb4c8532010-11-11 17:11:34 +010022 .iobasecsi = soc ## _CSI_BASE_ADDR, \
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +010023 .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
31const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst =
Shawn Guo27b76482012-09-16 16:26:20 +080032 imx_mx2_camera_data_entry_single_emma(MX27, "imx27-camera");
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +010033#endif /* ifdef CONFIG_SOC_IMX27 */
34
35struct 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önigb2997cb2010-11-02 17:50:55 +010045 .start = data->irqcsi,
46 .end = data->irqcsi,
47 .flags = IORESOURCE_IRQ,
48 }, {
Uwe Kleine-Königbb4c8532010-11-11 17:11:34 +010049 .start = data->iobaseemmaprp,
50 .end = data->iobaseemmaprp + data->iosizeemmaprp - 1,
51 .flags = IORESOURCE_MEM,
52 }, {
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +010053 .start = data->irqemmaprp,
54 .end = data->irqemmaprp,
55 .flags = IORESOURCE_IRQ,
56 },
57 };
Shawn Guo27b76482012-09-16 16:26:20 +080058 return imx_add_platform_device_dmamask(data->devid, 0,
Uwe Kleine-Königbb4c8532010-11-11 17:11:34 +010059 res, data->iobaseemmaprp ? 4 : 2,
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +010060 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
61}
Javier Martin52f1a842012-01-13 06:31:57 -030062