platform-imx-ssi.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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_imx_ssi_data_entry(soc, _id, _hwid, _size) \
  12. [_id] = { \
  13. .id = _id, \
  14. .iobase = soc ## _SSI ## _hwid ## _BASE_ADDR, \
  15. .iosize = _size, \
  16. .irq = soc ## _INT_SSI ## _hwid, \
  17. .dmatx0 = soc ## _DMA_REQ_SSI ## _hwid ## _TX0, \
  18. .dmarx0 = soc ## _DMA_REQ_SSI ## _hwid ## _RX0, \
  19. .dmatx1 = soc ## _DMA_REQ_SSI ## _hwid ## _TX1, \
  20. .dmarx1 = soc ## _DMA_REQ_SSI ## _hwid ## _RX1, \
  21. }
  22. #ifdef CONFIG_SOC_IMX21
  23. const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst = {
  24. #define imx21_imx_ssi_data_entry(_id, _hwid) \
  25. imx_imx_ssi_data_entry(MX21, _id, _hwid, SZ_4K)
  26. imx21_imx_ssi_data_entry(0, 1),
  27. imx21_imx_ssi_data_entry(1, 2),
  28. };
  29. #endif /* ifdef CONFIG_SOC_IMX21 */
  30. #ifdef CONFIG_SOC_IMX27
  31. const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst = {
  32. #define imx27_imx_ssi_data_entry(_id, _hwid) \
  33. imx_imx_ssi_data_entry(MX27, _id, _hwid, SZ_4K)
  34. imx27_imx_ssi_data_entry(0, 1),
  35. imx27_imx_ssi_data_entry(1, 2),
  36. };
  37. #endif /* ifdef CONFIG_SOC_IMX27 */
  38. #ifdef CONFIG_SOC_IMX31
  39. const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst = {
  40. #define imx31_imx_ssi_data_entry(_id, _hwid) \
  41. imx_imx_ssi_data_entry(MX31, _id, _hwid, SZ_4K)
  42. imx31_imx_ssi_data_entry(0, 1),
  43. imx31_imx_ssi_data_entry(1, 2),
  44. };
  45. #endif /* ifdef CONFIG_SOC_IMX31 */
  46. #ifdef CONFIG_SOC_IMX35
  47. const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst = {
  48. #define imx35_imx_ssi_data_entry(_id, _hwid) \
  49. imx_imx_ssi_data_entry(MX35, _id, _hwid, SZ_4K)
  50. imx35_imx_ssi_data_entry(0, 1),
  51. imx35_imx_ssi_data_entry(1, 2),
  52. };
  53. #endif /* ifdef CONFIG_SOC_IMX35 */
  54. struct platform_device *__init imx_add_imx_ssi(
  55. const struct imx_imx_ssi_data *data,
  56. const struct imx_ssi_platform_data *pdata)
  57. {
  58. struct resource res[] = {
  59. {
  60. .start = data->iobase,
  61. .end = data->iobase + data->iosize - 1,
  62. .flags = IORESOURCE_MEM,
  63. }, {
  64. .start = data->irq,
  65. .end = data->irq,
  66. .flags = IORESOURCE_IRQ,
  67. },
  68. #define DMARES(_name) { \
  69. .name = #_name, \
  70. .start = data->dma ## _name, \
  71. .end = data->dma ## _name, \
  72. .flags = IORESOURCE_DMA, \
  73. }
  74. DMARES(tx0),
  75. DMARES(rx0),
  76. DMARES(tx1),
  77. DMARES(rx1),
  78. };
  79. return imx_add_platform_device("imx-ssi", data->id,
  80. res, ARRAY_SIZE(res),
  81. pdata, sizeof(*pdata));
  82. }