dma.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /* linux/arch/arm/mach-exynos4/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_PCM0_RX,
  36. .rqtype = DEVTOMEM,
  37. }, {
  38. .peri_id = (u8)DMACH_PCM0_TX,
  39. .rqtype = MEMTODEV,
  40. }, {
  41. .peri_id = (u8)DMACH_PCM2_RX,
  42. .rqtype = DEVTOMEM,
  43. }, {
  44. .peri_id = (u8)DMACH_PCM2_TX,
  45. .rqtype = MEMTODEV,
  46. }, {
  47. .peri_id = (u8)DMACH_MSM_REQ0,
  48. }, {
  49. .peri_id = (u8)DMACH_MSM_REQ2,
  50. }, {
  51. .peri_id = (u8)DMACH_SPI0_RX,
  52. .rqtype = DEVTOMEM,
  53. }, {
  54. .peri_id = (u8)DMACH_SPI0_TX,
  55. .rqtype = MEMTODEV,
  56. }, {
  57. .peri_id = (u8)DMACH_SPI2_RX,
  58. .rqtype = DEVTOMEM,
  59. }, {
  60. .peri_id = (u8)DMACH_SPI2_TX,
  61. .rqtype = MEMTODEV,
  62. }, {
  63. .peri_id = (u8)DMACH_I2S0S_TX,
  64. .rqtype = MEMTODEV,
  65. }, {
  66. .peri_id = (u8)DMACH_I2S0_RX,
  67. .rqtype = DEVTOMEM,
  68. }, {
  69. .peri_id = (u8)DMACH_I2S0_TX,
  70. .rqtype = MEMTODEV,
  71. }, {
  72. .peri_id = (u8)DMACH_UART0_RX,
  73. .rqtype = DEVTOMEM,
  74. }, {
  75. .peri_id = (u8)DMACH_UART0_TX,
  76. .rqtype = MEMTODEV,
  77. }, {
  78. .peri_id = (u8)DMACH_UART2_RX,
  79. .rqtype = DEVTOMEM,
  80. }, {
  81. .peri_id = (u8)DMACH_UART2_TX,
  82. .rqtype = MEMTODEV,
  83. }, {
  84. .peri_id = (u8)DMACH_UART4_RX,
  85. .rqtype = DEVTOMEM,
  86. }, {
  87. .peri_id = (u8)DMACH_UART4_TX,
  88. .rqtype = MEMTODEV,
  89. }, {
  90. .peri_id = (u8)DMACH_SLIMBUS0_RX,
  91. .rqtype = DEVTOMEM,
  92. }, {
  93. .peri_id = (u8)DMACH_SLIMBUS0_TX,
  94. .rqtype = MEMTODEV,
  95. }, {
  96. .peri_id = (u8)DMACH_SLIMBUS2_RX,
  97. .rqtype = DEVTOMEM,
  98. }, {
  99. .peri_id = (u8)DMACH_SLIMBUS2_TX,
  100. .rqtype = MEMTODEV,
  101. }, {
  102. .peri_id = (u8)DMACH_SLIMBUS4_RX,
  103. .rqtype = DEVTOMEM,
  104. }, {
  105. .peri_id = (u8)DMACH_SLIMBUS4_TX,
  106. .rqtype = MEMTODEV,
  107. }, {
  108. .peri_id = (u8)DMACH_AC97_MICIN,
  109. .rqtype = DEVTOMEM,
  110. }, {
  111. .peri_id = (u8)DMACH_AC97_PCMIN,
  112. .rqtype = DEVTOMEM,
  113. }, {
  114. .peri_id = (u8)DMACH_AC97_PCMOUT,
  115. .rqtype = MEMTODEV,
  116. },
  117. };
  118. struct dma_pl330_platdata exynos4_pdma0_pdata = {
  119. .nr_valid_peri = ARRAY_SIZE(pdma0_peri),
  120. .peri = pdma0_peri,
  121. };
  122. struct amba_device exynos4_device_pdma0 = {
  123. .dev = {
  124. .init_name = "dma-pl330.0",
  125. .dma_mask = &dma_dmamask,
  126. .coherent_dma_mask = DMA_BIT_MASK(32),
  127. .platform_data = &exynos4_pdma0_pdata,
  128. },
  129. .res = {
  130. .start = EXYNOS4_PA_PDMA0,
  131. .end = EXYNOS4_PA_PDMA0 + SZ_4K,
  132. .flags = IORESOURCE_MEM,
  133. },
  134. .irq = {IRQ_PDMA0, NO_IRQ},
  135. .periphid = 0x00041330,
  136. };
  137. struct dma_pl330_peri pdma1_peri[25] = {
  138. {
  139. .peri_id = (u8)DMACH_PCM0_RX,
  140. .rqtype = DEVTOMEM,
  141. }, {
  142. .peri_id = (u8)DMACH_PCM0_TX,
  143. .rqtype = MEMTODEV,
  144. }, {
  145. .peri_id = (u8)DMACH_PCM1_RX,
  146. .rqtype = DEVTOMEM,
  147. }, {
  148. .peri_id = (u8)DMACH_PCM1_TX,
  149. .rqtype = MEMTODEV,
  150. }, {
  151. .peri_id = (u8)DMACH_MSM_REQ1,
  152. }, {
  153. .peri_id = (u8)DMACH_MSM_REQ3,
  154. }, {
  155. .peri_id = (u8)DMACH_SPI1_RX,
  156. .rqtype = DEVTOMEM,
  157. }, {
  158. .peri_id = (u8)DMACH_SPI1_TX,
  159. .rqtype = MEMTODEV,
  160. }, {
  161. .peri_id = (u8)DMACH_I2S0S_TX,
  162. .rqtype = MEMTODEV,
  163. }, {
  164. .peri_id = (u8)DMACH_I2S0_RX,
  165. .rqtype = DEVTOMEM,
  166. }, {
  167. .peri_id = (u8)DMACH_I2S0_TX,
  168. .rqtype = MEMTODEV,
  169. }, {
  170. .peri_id = (u8)DMACH_I2S1_RX,
  171. .rqtype = DEVTOMEM,
  172. }, {
  173. .peri_id = (u8)DMACH_I2S1_TX,
  174. .rqtype = MEMTODEV,
  175. }, {
  176. .peri_id = (u8)DMACH_UART0_RX,
  177. .rqtype = DEVTOMEM,
  178. }, {
  179. .peri_id = (u8)DMACH_UART0_TX,
  180. .rqtype = MEMTODEV,
  181. }, {
  182. .peri_id = (u8)DMACH_UART1_RX,
  183. .rqtype = DEVTOMEM,
  184. }, {
  185. .peri_id = (u8)DMACH_UART1_TX,
  186. .rqtype = MEMTODEV,
  187. }, {
  188. .peri_id = (u8)DMACH_UART3_RX,
  189. .rqtype = DEVTOMEM,
  190. }, {
  191. .peri_id = (u8)DMACH_UART3_TX,
  192. .rqtype = MEMTODEV,
  193. }, {
  194. .peri_id = (u8)DMACH_SLIMBUS1_RX,
  195. .rqtype = DEVTOMEM,
  196. }, {
  197. .peri_id = (u8)DMACH_SLIMBUS1_TX,
  198. .rqtype = MEMTODEV,
  199. }, {
  200. .peri_id = (u8)DMACH_SLIMBUS3_RX,
  201. .rqtype = DEVTOMEM,
  202. }, {
  203. .peri_id = (u8)DMACH_SLIMBUS3_TX,
  204. .rqtype = MEMTODEV,
  205. }, {
  206. .peri_id = (u8)DMACH_SLIMBUS5_RX,
  207. .rqtype = DEVTOMEM,
  208. }, {
  209. .peri_id = (u8)DMACH_SLIMBUS5_TX,
  210. .rqtype = MEMTODEV,
  211. },
  212. };
  213. struct dma_pl330_platdata exynos4_pdma1_pdata = {
  214. .nr_valid_peri = ARRAY_SIZE(pdma1_peri),
  215. .peri = pdma1_peri,
  216. };
  217. struct amba_device exynos4_device_pdma1 = {
  218. .dev = {
  219. .init_name = "dma-pl330.1",
  220. .dma_mask = &dma_dmamask,
  221. .coherent_dma_mask = DMA_BIT_MASK(32),
  222. .platform_data = &exynos4_pdma1_pdata,
  223. },
  224. .res = {
  225. .start = EXYNOS4_PA_PDMA1,
  226. .end = EXYNOS4_PA_PDMA1 + SZ_4K,
  227. .flags = IORESOURCE_MEM,
  228. },
  229. .irq = {IRQ_PDMA1, NO_IRQ},
  230. .periphid = 0x00041330,
  231. };
  232. static int __init exynos4_dma_init(void)
  233. {
  234. amba_device_register(&exynos4_device_pdma0, &iomem_resource);
  235. amba_device_register(&exynos4_device_pdma1, &iomem_resource);
  236. return 0;
  237. }
  238. arch_initcall(exynos4_dma_init);