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