dma.c 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /* linux/arch/arm/mach-s5pv210/dma.c
  2. *
  3. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com
  5. *
  6. * Copyright (C) 2010 Samsung Electronics Co. Ltd.
  7. * Jaswinder Singh <jassi.brar@samsung.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */
  23. #include <linux/dma-mapping.h>
  24. #include <linux/amba/bus.h>
  25. #include <linux/amba/pl330.h>
  26. #include <asm/irq.h>
  27. #include <plat/devs.h>
  28. #include <plat/irqs.h>
  29. #include <mach/map.h>
  30. #include <mach/irqs.h>
  31. #include <mach/dma.h>
  32. static u64 dma_dmamask = DMA_BIT_MASK(32);
  33. struct dma_pl330_peri pdma0_peri[28] = {
  34. {
  35. .peri_id = (u8)DMACH_UART0_RX,
  36. .rqtype = DEVTOMEM,
  37. }, {
  38. .peri_id = (u8)DMACH_UART0_TX,
  39. .rqtype = MEMTODEV,
  40. }, {
  41. .peri_id = (u8)DMACH_UART1_RX,
  42. .rqtype = DEVTOMEM,
  43. }, {
  44. .peri_id = (u8)DMACH_UART1_TX,
  45. .rqtype = MEMTODEV,
  46. }, {
  47. .peri_id = (u8)DMACH_UART2_RX,
  48. .rqtype = DEVTOMEM,
  49. }, {
  50. .peri_id = (u8)DMACH_UART2_TX,
  51. .rqtype = MEMTODEV,
  52. }, {
  53. .peri_id = (u8)DMACH_UART3_RX,
  54. .rqtype = DEVTOMEM,
  55. }, {
  56. .peri_id = (u8)DMACH_UART3_TX,
  57. .rqtype = MEMTODEV,
  58. }, {
  59. .peri_id = DMACH_MAX,
  60. }, {
  61. .peri_id = (u8)DMACH_I2S0_RX,
  62. .rqtype = DEVTOMEM,
  63. }, {
  64. .peri_id = (u8)DMACH_I2S0_TX,
  65. .rqtype = MEMTODEV,
  66. }, {
  67. .peri_id = (u8)DMACH_I2S0S_TX,
  68. .rqtype = MEMTODEV,
  69. }, {
  70. .peri_id = (u8)DMACH_I2S1_RX,
  71. .rqtype = DEVTOMEM,
  72. }, {
  73. .peri_id = (u8)DMACH_I2S1_TX,
  74. .rqtype = MEMTODEV,
  75. }, {
  76. .peri_id = (u8)DMACH_MAX,
  77. }, {
  78. .peri_id = (u8)DMACH_MAX,
  79. }, {
  80. .peri_id = (u8)DMACH_SPI0_RX,
  81. .rqtype = DEVTOMEM,
  82. }, {
  83. .peri_id = (u8)DMACH_SPI0_TX,
  84. .rqtype = MEMTODEV,
  85. }, {
  86. .peri_id = (u8)DMACH_SPI1_RX,
  87. .rqtype = DEVTOMEM,
  88. }, {
  89. .peri_id = (u8)DMACH_SPI1_TX,
  90. .rqtype = MEMTODEV,
  91. }, {
  92. .peri_id = (u8)DMACH_MAX,
  93. }, {
  94. .peri_id = (u8)DMACH_MAX,
  95. }, {
  96. .peri_id = (u8)DMACH_AC97_MICIN,
  97. .rqtype = DEVTOMEM,
  98. }, {
  99. .peri_id = (u8)DMACH_AC97_PCMIN,
  100. .rqtype = DEVTOMEM,
  101. }, {
  102. .peri_id = (u8)DMACH_AC97_PCMOUT,
  103. .rqtype = MEMTODEV,
  104. }, {
  105. .peri_id = (u8)DMACH_MAX,
  106. }, {
  107. .peri_id = (u8)DMACH_PWM,
  108. }, {
  109. .peri_id = (u8)DMACH_SPDIF,
  110. .rqtype = MEMTODEV,
  111. },
  112. };
  113. struct dma_pl330_platdata s5pv210_pdma0_pdata = {
  114. .nr_valid_peri = ARRAY_SIZE(pdma0_peri),
  115. .peri = pdma0_peri,
  116. };
  117. struct amba_device s5pv210_device_pdma0 = {
  118. .dev = {
  119. .init_name = "dma-pl330.0",
  120. .dma_mask = &dma_dmamask,
  121. .coherent_dma_mask = DMA_BIT_MASK(32),
  122. .platform_data = &s5pv210_pdma0_pdata,
  123. },
  124. .res = {
  125. .start = S5PV210_PA_PDMA0,
  126. .end = S5PV210_PA_PDMA0 + SZ_4K,
  127. .flags = IORESOURCE_MEM,
  128. },
  129. .irq = {IRQ_PDMA0, NO_IRQ},
  130. .periphid = 0x00041330,
  131. };
  132. struct dma_pl330_peri pdma1_peri[32] = {
  133. {
  134. .peri_id = (u8)DMACH_UART0_RX,
  135. .rqtype = DEVTOMEM,
  136. }, {
  137. .peri_id = (u8)DMACH_UART0_TX,
  138. .rqtype = MEMTODEV,
  139. }, {
  140. .peri_id = (u8)DMACH_UART1_RX,
  141. .rqtype = DEVTOMEM,
  142. }, {
  143. .peri_id = (u8)DMACH_UART1_TX,
  144. .rqtype = MEMTODEV,
  145. }, {
  146. .peri_id = (u8)DMACH_UART2_RX,
  147. .rqtype = DEVTOMEM,
  148. }, {
  149. .peri_id = (u8)DMACH_UART2_TX,
  150. .rqtype = MEMTODEV,
  151. }, {
  152. .peri_id = (u8)DMACH_UART3_RX,
  153. .rqtype = DEVTOMEM,
  154. }, {
  155. .peri_id = (u8)DMACH_UART3_TX,
  156. .rqtype = MEMTODEV,
  157. }, {
  158. .peri_id = DMACH_MAX,
  159. }, {
  160. .peri_id = (u8)DMACH_I2S0_RX,
  161. .rqtype = DEVTOMEM,
  162. }, {
  163. .peri_id = (u8)DMACH_I2S0_TX,
  164. .rqtype = MEMTODEV,
  165. }, {
  166. .peri_id = (u8)DMACH_I2S0S_TX,
  167. .rqtype = MEMTODEV,
  168. }, {
  169. .peri_id = (u8)DMACH_I2S1_RX,
  170. .rqtype = DEVTOMEM,
  171. }, {
  172. .peri_id = (u8)DMACH_I2S1_TX,
  173. .rqtype = MEMTODEV,
  174. }, {
  175. .peri_id = (u8)DMACH_I2S2_RX,
  176. .rqtype = DEVTOMEM,
  177. }, {
  178. .peri_id = (u8)DMACH_I2S2_TX,
  179. .rqtype = MEMTODEV,
  180. }, {
  181. .peri_id = (u8)DMACH_SPI0_RX,
  182. .rqtype = DEVTOMEM,
  183. }, {
  184. .peri_id = (u8)DMACH_SPI0_TX,
  185. .rqtype = MEMTODEV,
  186. }, {
  187. .peri_id = (u8)DMACH_SPI1_RX,
  188. .rqtype = DEVTOMEM,
  189. }, {
  190. .peri_id = (u8)DMACH_SPI1_TX,
  191. .rqtype = MEMTODEV,
  192. }, {
  193. .peri_id = (u8)DMACH_MAX,
  194. }, {
  195. .peri_id = (u8)DMACH_MAX,
  196. }, {
  197. .peri_id = (u8)DMACH_PCM0_RX,
  198. .rqtype = DEVTOMEM,
  199. }, {
  200. .peri_id = (u8)DMACH_PCM0_TX,
  201. .rqtype = MEMTODEV,
  202. }, {
  203. .peri_id = (u8)DMACH_PCM1_RX,
  204. .rqtype = DEVTOMEM,
  205. }, {
  206. .peri_id = (u8)DMACH_PCM1_TX,
  207. .rqtype = MEMTODEV,
  208. }, {
  209. .peri_id = (u8)DMACH_MSM_REQ0,
  210. }, {
  211. .peri_id = (u8)DMACH_MSM_REQ1,
  212. }, {
  213. .peri_id = (u8)DMACH_MSM_REQ2,
  214. }, {
  215. .peri_id = (u8)DMACH_MSM_REQ3,
  216. }, {
  217. .peri_id = (u8)DMACH_PCM2_RX,
  218. .rqtype = DEVTOMEM,
  219. }, {
  220. .peri_id = (u8)DMACH_PCM2_TX,
  221. .rqtype = MEMTODEV,
  222. },
  223. };
  224. struct dma_pl330_platdata s5pv210_pdma1_pdata = {
  225. .nr_valid_peri = ARRAY_SIZE(pdma1_peri),
  226. .peri = pdma1_peri,
  227. };
  228. struct amba_device s5pv210_device_pdma1 = {
  229. .dev = {
  230. .init_name = "dma-pl330.1",
  231. .dma_mask = &dma_dmamask,
  232. .coherent_dma_mask = DMA_BIT_MASK(32),
  233. .platform_data = &s5pv210_pdma1_pdata,
  234. },
  235. .res = {
  236. .start = S5PV210_PA_PDMA1,
  237. .end = S5PV210_PA_PDMA1 + SZ_4K,
  238. .flags = IORESOURCE_MEM,
  239. },
  240. .irq = {IRQ_PDMA1, NO_IRQ},
  241. .periphid = 0x00041330,
  242. };
  243. static int __init s5pv210_dma_init(void)
  244. {
  245. amba_device_register(&s5pv210_device_pdma0, &iomem_resource);
  246. amba_device_register(&s5pv210_device_pdma1, &iomem_resource);
  247. return 0;
  248. }
  249. arch_initcall(s5pv210_dma_init);