1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2010 Pengutronix
4 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5 */
6 #include <linux/dma-mapping.h>
7
8 #include "../hardware.h"
9 #include "devices-common.h"
10
11 #define imx_imx_fb_data_entry_single(soc, _devid, _size) \
12 { \
13 .devid = _devid, \
14 .iobase = soc ## _LCDC_BASE_ADDR, \
15 .iosize = _size, \
16 .irq = soc ## _INT_LCDC, \
17 }
18
19 #ifdef CONFIG_SOC_IMX21
20 const struct imx_imx_fb_data imx21_imx_fb_data __initconst =
21 imx_imx_fb_data_entry_single(MX21, "imx21-fb", SZ_4K);
22 #endif /* ifdef CONFIG_SOC_IMX21 */
23
24 #ifdef CONFIG_SOC_IMX27
25 const struct imx_imx_fb_data imx27_imx_fb_data __initconst =
26 imx_imx_fb_data_entry_single(MX27, "imx21-fb", SZ_4K);
27 #endif /* ifdef CONFIG_SOC_IMX27 */
28
imx_add_imx_fb(const struct imx_imx_fb_data * data,const struct imx_fb_platform_data * pdata)29 struct platform_device *__init imx_add_imx_fb(
30 const struct imx_imx_fb_data *data,
31 const struct imx_fb_platform_data *pdata)
32 {
33 struct resource res[] = {
34 {
35 .start = data->iobase,
36 .end = data->iobase + data->iosize - 1,
37 .flags = IORESOURCE_MEM,
38 }, {
39 .start = data->irq,
40 .end = data->irq,
41 .flags = IORESOURCE_IRQ,
42 },
43 };
44 return imx_add_platform_device_dmamask(data->devid, 0,
45 res, ARRAY_SIZE(res),
46 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
47 }
48