79a1cb18a5b0ebb0344aa19c1f054ddc00d5dfc6
[linux-3.10.git] / arch / arm / plat-mxc / devices / platform-imx-fb.c
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_imx_fb_data_entry_single(soc, _size)                        \
13         {                                                               \
14                 .iobase = soc ## _LCDC_BASE_ADDR,                       \
15                 .iosize = _size,                                        \
16                 .irq = soc ## _INT_LCDC,                                \
17         }
18
19 #ifdef CONFIG_SOC_IMX1
20 const struct imx_imx_fb_data imx1_imx_fb_data __initconst =
21         imx_imx_fb_data_entry_single(MX1, SZ_4K);
22 #endif /* ifdef CONFIG_SOC_IMX1 */
23
24 #ifdef CONFIG_SOC_IMX21
25 const struct imx_imx_fb_data imx21_imx_fb_data __initconst =
26         imx_imx_fb_data_entry_single(MX21, SZ_4K);
27 #endif /* ifdef CONFIG_SOC_IMX21 */
28
29 #ifdef CONFIG_SOC_IMX25
30 const struct imx_imx_fb_data imx25_imx_fb_data __initconst =
31         imx_imx_fb_data_entry_single(MX25, SZ_16K);
32 #endif /* ifdef CONFIG_SOC_IMX25 */
33
34 #ifdef CONFIG_SOC_IMX27
35 const struct imx_imx_fb_data imx27_imx_fb_data __initconst =
36         imx_imx_fb_data_entry_single(MX27, SZ_4K);
37 #endif /* ifdef CONFIG_SOC_IMX27 */
38
39 struct platform_device *__init imx_add_imx_fb(
40                 const struct imx_imx_fb_data *data,
41                 const struct imx_fb_platform_data *pdata)
42 {
43         struct resource res[] = {
44                 {
45                         .start = data->iobase,
46                         .end = data->iobase + data->iosize - 1,
47                         .flags = IORESOURCE_MEM,
48                 }, {
49                         .start = data->irq,
50                         .end = data->irq,
51                         .flags = IORESOURCE_IRQ,
52                 },
53         };
54         return imx_add_platform_device_dmamask("imx-fb", 0,
55                         res, ARRAY_SIZE(res),
56                         pdata, sizeof(*pdata), DMA_BIT_MASK(32));
57 }