dma.c 3.6 KB

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