platform-imx-fb.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #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. #ifdef CONFIG_SOC_IMX1
  19. const struct imx_imx_fb_data imx1_imx_fb_data __initconst =
  20. imx_imx_fb_data_entry_single(MX1, SZ_4K);
  21. #endif /* ifdef CONFIG_SOC_IMX1 */
  22. #ifdef CONFIG_SOC_IMX21
  23. const struct imx_imx_fb_data imx21_imx_fb_data __initconst =
  24. imx_imx_fb_data_entry_single(MX21, SZ_4K);
  25. #endif /* ifdef CONFIG_SOC_IMX21 */
  26. #ifdef CONFIG_SOC_IMX25
  27. const struct imx_imx_fb_data imx25_imx_fb_data __initconst =
  28. imx_imx_fb_data_entry_single(MX25, SZ_16K);
  29. #endif /* ifdef CONFIG_SOC_IMX25 */
  30. #ifdef CONFIG_SOC_IMX27
  31. const struct imx_imx_fb_data imx27_imx_fb_data __initconst =
  32. imx_imx_fb_data_entry_single(MX27, SZ_4K);
  33. #endif /* ifdef CONFIG_SOC_IMX27 */
  34. struct platform_device *__init imx_add_imx_fb(
  35. const struct imx_imx_fb_data *data,
  36. const struct imx_fb_platform_data *pdata)
  37. {
  38. struct resource res[] = {
  39. {
  40. .start = data->iobase,
  41. .end = data->iobase + data->iosize - 1,
  42. .flags = IORESOURCE_MEM,
  43. }, {
  44. .start = data->irq,
  45. .end = data->irq,
  46. .flags = IORESOURCE_IRQ,
  47. },
  48. };
  49. return imx_add_platform_device_dmamask("imx-fb", 0,
  50. res, ARRAY_SIZE(res),
  51. pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  52. }