platform-imx-fb.c 1.7 KB

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