dma.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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/platform_device.h>
  24. #include <linux/dma-mapping.h>
  25. #include <mach/map.h>
  26. #include <mach/irqs.h>
  27. #include <mach/regs-clock.h>
  28. #include <plat/cpu.h>
  29. #include <plat/devs.h>
  30. #include <plat/s3c-pl330-pdata.h>
  31. static u64 dma_dmamask = DMA_BIT_MASK(32);
  32. static struct resource s5p64x0_pdma_resource[] = {
  33. [0] = {
  34. .start = S5P64X0_PA_PDMA,
  35. .end = S5P64X0_PA_PDMA + SZ_4K,
  36. .flags = IORESOURCE_MEM,
  37. },
  38. [1] = {
  39. .start = IRQ_DMA0,
  40. .end = IRQ_DMA0,
  41. .flags = IORESOURCE_IRQ,
  42. },
  43. };
  44. static struct s3c_pl330_platdata s5p6440_pdma_pdata = {
  45. .peri = {
  46. [0] = DMACH_UART0_RX,
  47. [1] = DMACH_UART0_TX,
  48. [2] = DMACH_UART1_RX,
  49. [3] = DMACH_UART1_TX,
  50. [4] = DMACH_UART2_RX,
  51. [5] = DMACH_UART2_TX,
  52. [6] = DMACH_UART3_RX,
  53. [7] = DMACH_UART3_TX,
  54. [8] = DMACH_MAX,
  55. [9] = DMACH_MAX,
  56. [10] = DMACH_PCM0_TX,
  57. [11] = DMACH_PCM0_RX,
  58. [12] = DMACH_I2S0_TX,
  59. [13] = DMACH_I2S0_RX,
  60. [14] = DMACH_SPI0_TX,
  61. [15] = DMACH_SPI0_RX,
  62. [16] = DMACH_MAX,
  63. [17] = DMACH_MAX,
  64. [18] = DMACH_MAX,
  65. [19] = DMACH_MAX,
  66. [20] = DMACH_SPI1_TX,
  67. [21] = DMACH_SPI1_RX,
  68. [22] = DMACH_MAX,
  69. [23] = DMACH_MAX,
  70. [24] = DMACH_MAX,
  71. [25] = DMACH_MAX,
  72. [26] = DMACH_MAX,
  73. [27] = DMACH_MAX,
  74. [28] = DMACH_MAX,
  75. [29] = DMACH_PWM,
  76. [30] = DMACH_MAX,
  77. [31] = DMACH_MAX,
  78. },
  79. };
  80. static struct s3c_pl330_platdata s5p6450_pdma_pdata = {
  81. .peri = {
  82. [0] = DMACH_UART0_RX,
  83. [1] = DMACH_UART0_TX,
  84. [2] = DMACH_UART1_RX,
  85. [3] = DMACH_UART1_TX,
  86. [4] = DMACH_UART2_RX,
  87. [5] = DMACH_UART2_TX,
  88. [6] = DMACH_UART3_RX,
  89. [7] = DMACH_UART3_TX,
  90. [8] = DMACH_UART4_RX,
  91. [9] = DMACH_UART4_TX,
  92. [10] = DMACH_PCM0_TX,
  93. [11] = DMACH_PCM0_RX,
  94. [12] = DMACH_I2S0_TX,
  95. [13] = DMACH_I2S0_RX,
  96. [14] = DMACH_SPI0_TX,
  97. [15] = DMACH_SPI0_RX,
  98. [16] = DMACH_PCM1_TX,
  99. [17] = DMACH_PCM1_RX,
  100. [18] = DMACH_PCM2_TX,
  101. [19] = DMACH_PCM2_RX,
  102. [20] = DMACH_SPI1_TX,
  103. [21] = DMACH_SPI1_RX,
  104. [22] = DMACH_USI_TX,
  105. [23] = DMACH_USI_RX,
  106. [24] = DMACH_MAX,
  107. [25] = DMACH_I2S1_TX,
  108. [26] = DMACH_I2S1_RX,
  109. [27] = DMACH_I2S2_TX,
  110. [28] = DMACH_I2S2_RX,
  111. [29] = DMACH_PWM,
  112. [30] = DMACH_UART5_RX,
  113. [31] = DMACH_UART5_TX,
  114. },
  115. };
  116. static struct platform_device s5p64x0_device_pdma = {
  117. .name = "s3c-pl330",
  118. .id = -1,
  119. .num_resources = ARRAY_SIZE(s5p64x0_pdma_resource),
  120. .resource = s5p64x0_pdma_resource,
  121. .dev = {
  122. .dma_mask = &dma_dmamask,
  123. .coherent_dma_mask = DMA_BIT_MASK(32),
  124. },
  125. };
  126. static int __init s5p64x0_dma_init(void)
  127. {
  128. if (soc_is_s5p6450())
  129. s5p64x0_device_pdma.dev.platform_data = &s5p6450_pdma_pdata;
  130. else
  131. s5p64x0_device_pdma.dev.platform_data = &s5p6440_pdma_pdata;
  132. platform_device_register(&s5p64x0_device_pdma);
  133. return 0;
  134. }
  135. arch_initcall(s5p64x0_dma_init);