platform-mx2-camera.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 "../hardware.h"
  10. #include "devices-common.h"
  11. #define imx_mx2_camera_data_entry_single(soc, _devid) \
  12. { \
  13. .devid = _devid, \
  14. .iobasecsi = soc ## _CSI_BASE_ADDR, \
  15. .iosizecsi = SZ_4K, \
  16. .irqcsi = soc ## _INT_CSI, \
  17. }
  18. #define imx_mx2_camera_data_entry_single_emma(soc, _devid) \
  19. { \
  20. .devid = _devid, \
  21. .iobasecsi = soc ## _CSI_BASE_ADDR, \
  22. .iosizecsi = SZ_32, \
  23. .irqcsi = soc ## _INT_CSI, \
  24. .iobaseemmaprp = soc ## _EMMAPRP_BASE_ADDR, \
  25. .iosizeemmaprp = SZ_32, \
  26. .irqemmaprp = soc ## _INT_EMMAPRP, \
  27. }
  28. #ifdef CONFIG_SOC_IMX27
  29. const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst =
  30. imx_mx2_camera_data_entry_single_emma(MX27, "imx27-camera");
  31. #endif /* ifdef CONFIG_SOC_IMX27 */
  32. struct platform_device *__init imx_add_mx2_camera(
  33. const struct imx_mx2_camera_data *data,
  34. const struct mx2_camera_platform_data *pdata)
  35. {
  36. struct resource res[] = {
  37. {
  38. .start = data->iobasecsi,
  39. .end = data->iobasecsi + data->iosizecsi - 1,
  40. .flags = IORESOURCE_MEM,
  41. }, {
  42. .start = data->irqcsi,
  43. .end = data->irqcsi,
  44. .flags = IORESOURCE_IRQ,
  45. }, {
  46. .start = data->iobaseemmaprp,
  47. .end = data->iobaseemmaprp + data->iosizeemmaprp - 1,
  48. .flags = IORESOURCE_MEM,
  49. }, {
  50. .start = data->irqemmaprp,
  51. .end = data->irqemmaprp,
  52. .flags = IORESOURCE_IRQ,
  53. },
  54. };
  55. return imx_add_platform_device_dmamask(data->devid, 0,
  56. res, data->iobaseemmaprp ? 4 : 2,
  57. pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  58. }