platform-mxs-saif.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. {
  32. struct resource res[] = {
  33. {
  34. .start = data->iobase,
  35. .end = data->iobase + SZ_4K - 1,
  36. .flags = IORESOURCE_MEM,
  37. }, {
  38. .start = data->irq,
  39. .end = data->irq,
  40. .flags = IORESOURCE_IRQ,
  41. }, {
  42. .start = data->dma,
  43. .end = data->dma,
  44. .flags = IORESOURCE_DMA,
  45. }, {
  46. .start = data->dmairq,
  47. .end = data->dmairq,
  48. .flags = IORESOURCE_IRQ,
  49. },
  50. };
  51. return mxs_add_platform_device("mxs-saif", data->id, res,
  52. ARRAY_SIZE(res), NULL, 0);
  53. }