dma.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * Copyright (C) 2010 Samsung Electronics Co. Ltd.
  3. * Jaswinder Singh <jassi.brar@samsung.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. #include <linux/platform_device.h>
  20. #include <linux/dma-mapping.h>
  21. #include <plat/devs.h>
  22. #include <plat/irqs.h>
  23. #include <mach/map.h>
  24. #include <mach/irqs.h>
  25. #include <plat/s3c-pl330-pdata.h>
  26. static u64 dma_dmamask = DMA_BIT_MASK(32);
  27. static struct resource s5pv210_pdma0_resource[] = {
  28. [0] = {
  29. .start = S5PV210_PA_PDMA0,
  30. .end = S5PV210_PA_PDMA0 + SZ_4K,
  31. .flags = IORESOURCE_MEM,
  32. },
  33. [1] = {
  34. .start = IRQ_PDMA0,
  35. .end = IRQ_PDMA0,
  36. .flags = IORESOURCE_IRQ,
  37. },
  38. };
  39. static struct s3c_pl330_platdata s5pv210_pdma0_pdata = {
  40. .peri = {
  41. [0] = DMACH_UART0_RX,
  42. [1] = DMACH_UART0_TX,
  43. [2] = DMACH_UART1_RX,
  44. [3] = DMACH_UART1_TX,
  45. [4] = DMACH_UART2_RX,
  46. [5] = DMACH_UART2_TX,
  47. [6] = DMACH_UART3_RX,
  48. [7] = DMACH_UART3_TX,
  49. [8] = DMACH_MAX,
  50. [9] = DMACH_I2S0_RX,
  51. [10] = DMACH_I2S0_TX,
  52. [11] = DMACH_I2S0S_TX,
  53. [12] = DMACH_I2S1_RX,
  54. [13] = DMACH_I2S1_TX,
  55. [14] = DMACH_MAX,
  56. [15] = DMACH_MAX,
  57. [16] = DMACH_SPI0_RX,
  58. [17] = DMACH_SPI0_TX,
  59. [18] = DMACH_SPI1_RX,
  60. [19] = DMACH_SPI1_TX,
  61. [20] = DMACH_MAX,
  62. [21] = DMACH_MAX,
  63. [22] = DMACH_AC97_MICIN,
  64. [23] = DMACH_AC97_PCMIN,
  65. [24] = DMACH_AC97_PCMOUT,
  66. [25] = DMACH_MAX,
  67. [26] = DMACH_PWM,
  68. [27] = DMACH_SPDIF,
  69. [28] = DMACH_MAX,
  70. [29] = DMACH_MAX,
  71. [30] = DMACH_MAX,
  72. [31] = DMACH_MAX,
  73. },
  74. };
  75. static struct platform_device s5pv210_device_pdma0 = {
  76. .name = "s3c-pl330",
  77. .id = 0,
  78. .num_resources = ARRAY_SIZE(s5pv210_pdma0_resource),
  79. .resource = s5pv210_pdma0_resource,
  80. .dev = {
  81. .dma_mask = &dma_dmamask,
  82. .coherent_dma_mask = DMA_BIT_MASK(32),
  83. .platform_data = &s5pv210_pdma0_pdata,
  84. },
  85. };
  86. static struct resource s5pv210_pdma1_resource[] = {
  87. [0] = {
  88. .start = S5PV210_PA_PDMA1,
  89. .end = S5PV210_PA_PDMA1 + SZ_4K,
  90. .flags = IORESOURCE_MEM,
  91. },
  92. [1] = {
  93. .start = IRQ_PDMA1,
  94. .end = IRQ_PDMA1,
  95. .flags = IORESOURCE_IRQ,
  96. },
  97. };
  98. static struct s3c_pl330_platdata s5pv210_pdma1_pdata = {
  99. .peri = {
  100. [0] = DMACH_UART0_RX,
  101. [1] = DMACH_UART0_TX,
  102. [2] = DMACH_UART1_RX,
  103. [3] = DMACH_UART1_TX,
  104. [4] = DMACH_UART2_RX,
  105. [5] = DMACH_UART2_TX,
  106. [6] = DMACH_UART3_RX,
  107. [7] = DMACH_UART3_TX,
  108. [8] = DMACH_MAX,
  109. [9] = DMACH_I2S0_RX,
  110. [10] = DMACH_I2S0_TX,
  111. [11] = DMACH_I2S0S_TX,
  112. [12] = DMACH_I2S1_RX,
  113. [13] = DMACH_I2S1_TX,
  114. [14] = DMACH_I2S2_RX,
  115. [15] = DMACH_I2S2_TX,
  116. [16] = DMACH_SPI0_RX,
  117. [17] = DMACH_SPI0_TX,
  118. [18] = DMACH_SPI1_RX,
  119. [19] = DMACH_SPI1_TX,
  120. [20] = DMACH_MAX,
  121. [21] = DMACH_MAX,
  122. [22] = DMACH_PCM0_RX,
  123. [23] = DMACH_PCM0_TX,
  124. [24] = DMACH_PCM1_RX,
  125. [25] = DMACH_PCM1_TX,
  126. [26] = DMACH_MSM_REQ0,
  127. [27] = DMACH_MSM_REQ1,
  128. [28] = DMACH_MSM_REQ2,
  129. [29] = DMACH_MSM_REQ3,
  130. [30] = DMACH_PCM2_RX,
  131. [31] = DMACH_PCM2_TX,
  132. },
  133. };
  134. static struct platform_device s5pv210_device_pdma1 = {
  135. .name = "s3c-pl330",
  136. .id = 1,
  137. .num_resources = ARRAY_SIZE(s5pv210_pdma1_resource),
  138. .resource = s5pv210_pdma1_resource,
  139. .dev = {
  140. .dma_mask = &dma_dmamask,
  141. .coherent_dma_mask = DMA_BIT_MASK(32),
  142. .platform_data = &s5pv210_pdma1_pdata,
  143. },
  144. };
  145. static struct platform_device *s5pv210_dmacs[] __initdata = {
  146. &s5pv210_device_pdma0,
  147. &s5pv210_device_pdma1,
  148. };
  149. static int __init s5pv210_dma_init(void)
  150. {
  151. platform_add_devices(s5pv210_dmacs, ARRAY_SIZE(s5pv210_dmacs));
  152. return 0;
  153. }
  154. arch_initcall(s5pv210_dma_init);