dma.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /* linux/arch/arm/mach-s5p64x0/dma.c
  2. *
  3. * Copyright (c) 2010 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 <mach/map.h>
  28. #include <mach/irqs.h>
  29. #include <mach/regs-clock.h>
  30. #include <mach/dma.h>
  31. #include <plat/cpu.h>
  32. #include <plat/devs.h>
  33. #include <plat/irqs.h>
  34. static u64 dma_dmamask = DMA_BIT_MASK(32);
  35. struct dma_pl330_peri s5p6440_pdma_peri[22] = {
  36. {
  37. .peri_id = (u8)DMACH_UART0_RX,
  38. .rqtype = DEVTOMEM,
  39. }, {
  40. .peri_id = (u8)DMACH_UART0_TX,
  41. .rqtype = MEMTODEV,
  42. }, {
  43. .peri_id = (u8)DMACH_UART1_RX,
  44. .rqtype = DEVTOMEM,
  45. }, {
  46. .peri_id = (u8)DMACH_UART1_TX,
  47. .rqtype = MEMTODEV,
  48. }, {
  49. .peri_id = (u8)DMACH_UART2_RX,
  50. .rqtype = DEVTOMEM,
  51. }, {
  52. .peri_id = (u8)DMACH_UART2_TX,
  53. .rqtype = MEMTODEV,
  54. }, {
  55. .peri_id = (u8)DMACH_UART3_RX,
  56. .rqtype = DEVTOMEM,
  57. }, {
  58. .peri_id = (u8)DMACH_UART3_TX,
  59. .rqtype = MEMTODEV,
  60. }, {
  61. .peri_id = DMACH_MAX,
  62. }, {
  63. .peri_id = DMACH_MAX,
  64. }, {
  65. .peri_id = (u8)DMACH_PCM0_TX,
  66. .rqtype = MEMTODEV,
  67. }, {
  68. .peri_id = (u8)DMACH_PCM0_RX,
  69. .rqtype = DEVTOMEM,
  70. }, {
  71. .peri_id = (u8)DMACH_I2S0_TX,
  72. .rqtype = MEMTODEV,
  73. }, {
  74. .peri_id = (u8)DMACH_I2S0_RX,
  75. .rqtype = DEVTOMEM,
  76. }, {
  77. .peri_id = (u8)DMACH_SPI0_TX,
  78. .rqtype = MEMTODEV,
  79. }, {
  80. .peri_id = (u8)DMACH_SPI0_RX,
  81. .rqtype = DEVTOMEM,
  82. }, {
  83. .peri_id = (u8)DMACH_MAX,
  84. }, {
  85. .peri_id = (u8)DMACH_MAX,
  86. }, {
  87. .peri_id = (u8)DMACH_MAX,
  88. }, {
  89. .peri_id = (u8)DMACH_MAX,
  90. }, {
  91. .peri_id = (u8)DMACH_SPI1_TX,
  92. .rqtype = MEMTODEV,
  93. }, {
  94. .peri_id = (u8)DMACH_SPI1_RX,
  95. .rqtype = DEVTOMEM,
  96. },
  97. };
  98. struct dma_pl330_platdata s5p6440_pdma_pdata = {
  99. .nr_valid_peri = ARRAY_SIZE(s5p6440_pdma_peri),
  100. .peri = s5p6440_pdma_peri,
  101. };
  102. struct dma_pl330_peri s5p6450_pdma_peri[32] = {
  103. {
  104. .peri_id = (u8)DMACH_UART0_RX,
  105. .rqtype = DEVTOMEM,
  106. }, {
  107. .peri_id = (u8)DMACH_UART0_TX,
  108. .rqtype = MEMTODEV,
  109. }, {
  110. .peri_id = (u8)DMACH_UART1_RX,
  111. .rqtype = DEVTOMEM,
  112. }, {
  113. .peri_id = (u8)DMACH_UART1_TX,
  114. .rqtype = MEMTODEV,
  115. }, {
  116. .peri_id = (u8)DMACH_UART2_RX,
  117. .rqtype = DEVTOMEM,
  118. }, {
  119. .peri_id = (u8)DMACH_UART2_TX,
  120. .rqtype = MEMTODEV,
  121. }, {
  122. .peri_id = (u8)DMACH_UART3_RX,
  123. .rqtype = DEVTOMEM,
  124. }, {
  125. .peri_id = (u8)DMACH_UART3_TX,
  126. .rqtype = MEMTODEV,
  127. }, {
  128. .peri_id = (u8)DMACH_UART4_RX,
  129. .rqtype = DEVTOMEM,
  130. }, {
  131. .peri_id = (u8)DMACH_UART4_TX,
  132. .rqtype = MEMTODEV,
  133. }, {
  134. .peri_id = (u8)DMACH_PCM0_TX,
  135. .rqtype = MEMTODEV,
  136. }, {
  137. .peri_id = (u8)DMACH_PCM0_RX,
  138. .rqtype = DEVTOMEM,
  139. }, {
  140. .peri_id = (u8)DMACH_I2S0_TX,
  141. .rqtype = MEMTODEV,
  142. }, {
  143. .peri_id = (u8)DMACH_I2S0_RX,
  144. .rqtype = DEVTOMEM,
  145. }, {
  146. .peri_id = (u8)DMACH_SPI0_TX,
  147. .rqtype = MEMTODEV,
  148. }, {
  149. .peri_id = (u8)DMACH_SPI0_RX,
  150. .rqtype = DEVTOMEM,
  151. }, {
  152. .peri_id = (u8)DMACH_PCM1_TX,
  153. .rqtype = MEMTODEV,
  154. }, {
  155. .peri_id = (u8)DMACH_PCM1_RX,
  156. .rqtype = DEVTOMEM,
  157. }, {
  158. .peri_id = (u8)DMACH_PCM2_TX,
  159. .rqtype = MEMTODEV,
  160. }, {
  161. .peri_id = (u8)DMACH_PCM2_RX,
  162. .rqtype = DEVTOMEM,
  163. }, {
  164. .peri_id = (u8)DMACH_SPI1_TX,
  165. .rqtype = MEMTODEV,
  166. }, {
  167. .peri_id = (u8)DMACH_SPI1_RX,
  168. .rqtype = DEVTOMEM,
  169. }, {
  170. .peri_id = (u8)DMACH_USI_TX,
  171. .rqtype = MEMTODEV,
  172. }, {
  173. .peri_id = (u8)DMACH_USI_RX,
  174. .rqtype = DEVTOMEM,
  175. }, {
  176. .peri_id = (u8)DMACH_MAX,
  177. }, {
  178. .peri_id = (u8)DMACH_I2S1_TX,
  179. .rqtype = MEMTODEV,
  180. }, {
  181. .peri_id = (u8)DMACH_I2S1_RX,
  182. .rqtype = DEVTOMEM,
  183. }, {
  184. .peri_id = (u8)DMACH_I2S2_TX,
  185. .rqtype = MEMTODEV,
  186. }, {
  187. .peri_id = (u8)DMACH_I2S2_RX,
  188. .rqtype = DEVTOMEM,
  189. }, {
  190. .peri_id = (u8)DMACH_PWM,
  191. }, {
  192. .peri_id = (u8)DMACH_UART5_RX,
  193. .rqtype = DEVTOMEM,
  194. }, {
  195. .peri_id = (u8)DMACH_UART5_TX,
  196. .rqtype = MEMTODEV,
  197. },
  198. };
  199. struct dma_pl330_platdata s5p6450_pdma_pdata = {
  200. .nr_valid_peri = ARRAY_SIZE(s5p6450_pdma_peri),
  201. .peri = s5p6450_pdma_peri,
  202. };
  203. struct amba_device s5p64x0_device_pdma = {
  204. .dev = {
  205. .init_name = "dma-pl330",
  206. .dma_mask = &dma_dmamask,
  207. .coherent_dma_mask = DMA_BIT_MASK(32),
  208. },
  209. .res = {
  210. .start = S5P64X0_PA_PDMA,
  211. .end = S5P64X0_PA_PDMA + SZ_4K,
  212. .flags = IORESOURCE_MEM,
  213. },
  214. .irq = {IRQ_DMA0, NO_IRQ},
  215. .periphid = 0x00041330,
  216. };
  217. static int __init s5p64x0_dma_init(void)
  218. {
  219. if (soc_is_s5p6450())
  220. s5p64x0_device_pdma.dev.platform_data = &s5p6450_pdma_pdata;
  221. else
  222. s5p64x0_device_pdma.dev.platform_data = &s5p6440_pdma_pdata;
  223. amba_device_register(&s5p64x0_device_pdma, &iomem_resource);
  224. return 0;
  225. }
  226. arch_initcall(s5p64x0_dma_init);