platform-mxs-saif.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it under
  5. * the terms of the GNU General Public License version 2 as published by the
  6. * Free Software Foundation.
  7. */
  8. #include <linux/compiler.h>
  9. #include <linux/err.h>
  10. #include <linux/init.h>
  11. #include <mach/mx23.h>
  12. #include <mach/mx28.h>
  13. #include <mach/devices-common.h>
  14. #define mxs_saif_data_entry_single(soc, _id) \
  15. { \
  16. .id = _id, \
  17. .iobase = soc ## _SAIF ## _id ## _BASE_ADDR, \
  18. .irq = soc ## _INT_SAIF ## _id, \
  19. .dma = soc ## _DMA_SAIF ## _id, \
  20. .dmairq = soc ## _INT_SAIF ## _id ##_DMA, \
  21. }
  22. #define mxs_saif_data_entry(soc, _id) \
  23. [_id] = mxs_saif_data_entry_single(soc, _id)
  24. #ifdef CONFIG_SOC_IMX28
  25. const struct mxs_saif_data mx28_saif_data[] __initconst = {
  26. mxs_saif_data_entry(MX28, 0),
  27. mxs_saif_data_entry(MX28, 1),
  28. };
  29. #endif
  30. struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data,
  31. const struct mxs_saif_platform_data *pdata)
  32. {
  33. struct resource res[] = {
  34. {
  35. .start = data->iobase,
  36. .end = data->iobase + SZ_4K - 1,
  37. .flags = IORESOURCE_MEM,
  38. }, {
  39. .start = data->irq,
  40. .end = data->irq,
  41. .flags = IORESOURCE_IRQ,
  42. }, {
  43. .start = data->dma,
  44. .end = data->dma,
  45. .flags = IORESOURCE_DMA,
  46. }, {
  47. .start = data->dmairq,
  48. .end = data->dmairq,
  49. .flags = IORESOURCE_IRQ,
  50. },
  51. };
  52. return mxs_add_platform_device("mxs-saif", data->id, res,
  53. ARRAY_SIZE(res), pdata, sizeof(*pdata));
  54. }