x86/efi: Enforce CONFIG_RELOCATABLE for EFI boot stub
[linux/fpc-iii.git] / arch / arm / mach-imx / devices / platform-ipu-core.c
blob6bd7c3f37ac08e139118e48f200a075cb9fbac8b
1 /*
2 * Copyright (C) 2011 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
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 <linux/dma-mapping.h>
11 #include "../hardware.h"
12 #include "devices-common.h"
14 #define imx_ipu_core_entry_single(soc) \
15 { \
16 .iobase = soc ## _IPU_CTRL_BASE_ADDR, \
17 .synirq = soc ## _INT_IPU_SYN, \
18 .errirq = soc ## _INT_IPU_ERR, \
21 #ifdef CONFIG_SOC_IMX31
22 const struct imx_ipu_core_data imx31_ipu_core_data __initconst =
23 imx_ipu_core_entry_single(MX31);
24 #endif
26 #ifdef CONFIG_SOC_IMX35
27 const struct imx_ipu_core_data imx35_ipu_core_data __initconst =
28 imx_ipu_core_entry_single(MX35);
29 #endif
31 static struct platform_device *imx_ipu_coredev __initdata;
33 struct platform_device *__init imx_add_ipu_core(
34 const struct imx_ipu_core_data *data)
36 /* The resource order is important! */
37 struct resource res[] = {
39 .start = data->iobase,
40 .end = data->iobase + 0x5f,
41 .flags = IORESOURCE_MEM,
42 }, {
43 .start = data->iobase + 0x88,
44 .end = data->iobase + 0xb3,
45 .flags = IORESOURCE_MEM,
46 }, {
47 .start = data->synirq,
48 .end = data->synirq,
49 .flags = IORESOURCE_IRQ,
50 }, {
51 .start = data->errirq,
52 .end = data->errirq,
53 .flags = IORESOURCE_IRQ,
57 return imx_ipu_coredev = imx_add_platform_device("ipu-core", -1,
58 res, ARRAY_SIZE(res), NULL, 0);
61 struct platform_device *__init imx_alloc_mx3_camera(
62 const struct imx_ipu_core_data *data,
63 const struct mx3_camera_pdata *pdata)
65 struct resource res[] = {
67 .start = data->iobase + 0x60,
68 .end = data->iobase + 0x87,
69 .flags = IORESOURCE_MEM,
72 int ret = -ENOMEM;
73 struct platform_device *pdev;
75 if (IS_ERR_OR_NULL(imx_ipu_coredev))
76 return ERR_PTR(-ENODEV);
78 pdev = platform_device_alloc("mx3-camera", 0);
79 if (!pdev)
80 return ERR_PTR(-ENOMEM);
82 pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
83 if (!pdev->dev.dma_mask)
84 goto err;
86 *pdev->dev.dma_mask = DMA_BIT_MASK(32);
87 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
89 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
90 if (ret)
91 goto err;
93 if (pdata) {
94 struct mx3_camera_pdata *copied_pdata;
96 ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
97 if (ret) {
98 err:
99 kfree(pdev->dev.dma_mask);
100 platform_device_put(pdev);
101 return ERR_PTR(-ENODEV);
103 copied_pdata = dev_get_platdata(&pdev->dev);
104 copied_pdata->dma_dev = &imx_ipu_coredev->dev;
107 return pdev;
110 struct platform_device *__init imx_add_mx3_sdc_fb(
111 const struct imx_ipu_core_data *data,
112 struct mx3fb_platform_data *pdata)
114 struct resource res[] = {
116 .start = data->iobase + 0xb4,
117 .end = data->iobase + 0x1bf,
118 .flags = IORESOURCE_MEM,
122 if (IS_ERR_OR_NULL(imx_ipu_coredev))
123 return ERR_PTR(-ENODEV);
125 pdata->dma_dev = &imx_ipu_coredev->dev;
127 return imx_add_platform_device_dmamask("mx3_sdc_fb", -1,
128 res, ARRAY_SIZE(res), pdata, sizeof(*pdata),
129 DMA_BIT_MASK(32));