dma.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /* linux/arch/arm/mach-s5pc100/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[30] = {
  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_IRDA,
  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_I2S2_RX,
  77. .rqtype = DEVTOMEM,
  78. }, {
  79. .peri_id = (u8)DMACH_I2S2_TX,
  80. .rqtype = MEMTODEV,
  81. }, {
  82. .peri_id = (u8)DMACH_SPI0_RX,
  83. .rqtype = DEVTOMEM,
  84. }, {
  85. .peri_id = (u8)DMACH_SPI0_TX,
  86. .rqtype = MEMTODEV,
  87. }, {
  88. .peri_id = (u8)DMACH_SPI1_RX,
  89. .rqtype = DEVTOMEM,
  90. }, {
  91. .peri_id = (u8)DMACH_SPI1_TX,
  92. .rqtype = MEMTODEV,
  93. }, {
  94. .peri_id = (u8)DMACH_SPI2_RX,
  95. .rqtype = DEVTOMEM,
  96. }, {
  97. .peri_id = (u8)DMACH_SPI2_TX,
  98. .rqtype = MEMTODEV,
  99. }, {
  100. .peri_id = (u8)DMACH_AC97_MICIN,
  101. .rqtype = DEVTOMEM,
  102. }, {
  103. .peri_id = (u8)DMACH_AC97_PCMIN,
  104. .rqtype = DEVTOMEM,
  105. }, {
  106. .peri_id = (u8)DMACH_AC97_PCMOUT,
  107. .rqtype = MEMTODEV,
  108. }, {
  109. .peri_id = (u8)DMACH_EXTERNAL,
  110. }, {
  111. .peri_id = (u8)DMACH_PWM,
  112. }, {
  113. .peri_id = (u8)DMACH_SPDIF,
  114. .rqtype = MEMTODEV,
  115. }, {
  116. .peri_id = (u8)DMACH_HSI_RX,
  117. .rqtype = DEVTOMEM,
  118. }, {
  119. .peri_id = (u8)DMACH_HSI_TX,
  120. .rqtype = MEMTODEV,
  121. },
  122. };
  123. struct dma_pl330_platdata s5pc100_pdma0_pdata = {
  124. .nr_valid_peri = ARRAY_SIZE(pdma0_peri),
  125. .peri = pdma0_peri,
  126. };
  127. struct amba_device s5pc100_device_pdma0 = {
  128. .dev = {
  129. .init_name = "dma-pl330.0",
  130. .dma_mask = &dma_dmamask,
  131. .coherent_dma_mask = DMA_BIT_MASK(32),
  132. .platform_data = &s5pc100_pdma0_pdata,
  133. },
  134. .res = {
  135. .start = S5PC100_PA_PDMA0,
  136. .end = S5PC100_PA_PDMA0 + SZ_4K,
  137. .flags = IORESOURCE_MEM,
  138. },
  139. .irq = {IRQ_PDMA0, NO_IRQ},
  140. .periphid = 0x00041330,
  141. };
  142. struct dma_pl330_peri pdma1_peri[30] = {
  143. {
  144. .peri_id = (u8)DMACH_UART0_RX,
  145. .rqtype = DEVTOMEM,
  146. }, {
  147. .peri_id = (u8)DMACH_UART0_TX,
  148. .rqtype = MEMTODEV,
  149. }, {
  150. .peri_id = (u8)DMACH_UART1_RX,
  151. .rqtype = DEVTOMEM,
  152. }, {
  153. .peri_id = (u8)DMACH_UART1_TX,
  154. .rqtype = MEMTODEV,
  155. }, {
  156. .peri_id = (u8)DMACH_UART2_RX,
  157. .rqtype = DEVTOMEM,
  158. }, {
  159. .peri_id = (u8)DMACH_UART2_TX,
  160. .rqtype = MEMTODEV,
  161. }, {
  162. .peri_id = (u8)DMACH_UART3_RX,
  163. .rqtype = DEVTOMEM,
  164. }, {
  165. .peri_id = (u8)DMACH_UART3_TX,
  166. .rqtype = MEMTODEV,
  167. }, {
  168. .peri_id = DMACH_IRDA,
  169. }, {
  170. .peri_id = (u8)DMACH_I2S0_RX,
  171. .rqtype = DEVTOMEM,
  172. }, {
  173. .peri_id = (u8)DMACH_I2S0_TX,
  174. .rqtype = MEMTODEV,
  175. }, {
  176. .peri_id = (u8)DMACH_I2S0S_TX,
  177. .rqtype = MEMTODEV,
  178. }, {
  179. .peri_id = (u8)DMACH_I2S1_RX,
  180. .rqtype = DEVTOMEM,
  181. }, {
  182. .peri_id = (u8)DMACH_I2S1_TX,
  183. .rqtype = MEMTODEV,
  184. }, {
  185. .peri_id = (u8)DMACH_I2S2_RX,
  186. .rqtype = DEVTOMEM,
  187. }, {
  188. .peri_id = (u8)DMACH_I2S2_TX,
  189. .rqtype = MEMTODEV,
  190. }, {
  191. .peri_id = (u8)DMACH_SPI0_RX,
  192. .rqtype = DEVTOMEM,
  193. }, {
  194. .peri_id = (u8)DMACH_SPI0_TX,
  195. .rqtype = MEMTODEV,
  196. }, {
  197. .peri_id = (u8)DMACH_SPI1_RX,
  198. .rqtype = DEVTOMEM,
  199. }, {
  200. .peri_id = (u8)DMACH_SPI1_TX,
  201. .rqtype = MEMTODEV,
  202. }, {
  203. .peri_id = (u8)DMACH_SPI2_RX,
  204. .rqtype = DEVTOMEM,
  205. }, {
  206. .peri_id = (u8)DMACH_SPI2_TX,
  207. .rqtype = MEMTODEV,
  208. }, {
  209. .peri_id = (u8)DMACH_PCM0_RX,
  210. .rqtype = DEVTOMEM,
  211. }, {
  212. .peri_id = (u8)DMACH_PCM1_TX,
  213. .rqtype = MEMTODEV,
  214. }, {
  215. .peri_id = (u8)DMACH_PCM1_RX,
  216. .rqtype = DEVTOMEM,
  217. }, {
  218. .peri_id = (u8)DMACH_PCM1_TX,
  219. .rqtype = MEMTODEV,
  220. }, {
  221. .peri_id = (u8)DMACH_MSM_REQ0,
  222. }, {
  223. .peri_id = (u8)DMACH_MSM_REQ1,
  224. }, {
  225. .peri_id = (u8)DMACH_MSM_REQ2,
  226. }, {
  227. .peri_id = (u8)DMACH_MSM_REQ3,
  228. },
  229. };
  230. struct dma_pl330_platdata s5pc100_pdma1_pdata = {
  231. .nr_valid_peri = ARRAY_SIZE(pdma1_peri),
  232. .peri = pdma1_peri,
  233. };
  234. struct amba_device s5pc100_device_pdma1 = {
  235. .dev = {
  236. .init_name = "dma-pl330.1",
  237. .dma_mask = &dma_dmamask,
  238. .coherent_dma_mask = DMA_BIT_MASK(32),
  239. .platform_data = &s5pc100_pdma1_pdata,
  240. },
  241. .res = {
  242. .start = S5PC100_PA_PDMA1,
  243. .end = S5PC100_PA_PDMA1 + SZ_4K,
  244. .flags = IORESOURCE_MEM,
  245. },
  246. .irq = {IRQ_PDMA1, NO_IRQ},
  247. .periphid = 0x00041330,
  248. };
  249. static int __init s5pc100_dma_init(void)
  250. {
  251. amba_device_register(&s5pc100_device_pdma0, &iomem_resource);
  252. amba_device_register(&s5pc100_device_pdma1, &iomem_resource);
  253. return 0;
  254. }
  255. arch_initcall(s5pc100_dma_init);