dma.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. static u8 s5p6440_pdma_peri[] = {
  36. DMACH_UART0_RX,
  37. DMACH_UART0_TX,
  38. DMACH_UART1_RX,
  39. DMACH_UART1_TX,
  40. DMACH_UART2_RX,
  41. DMACH_UART2_TX,
  42. DMACH_UART3_RX,
  43. DMACH_UART3_TX,
  44. DMACH_MAX,
  45. DMACH_MAX,
  46. DMACH_PCM0_TX,
  47. DMACH_PCM0_RX,
  48. DMACH_I2S0_TX,
  49. DMACH_I2S0_RX,
  50. DMACH_SPI0_TX,
  51. DMACH_SPI0_RX,
  52. DMACH_MAX,
  53. DMACH_MAX,
  54. DMACH_MAX,
  55. DMACH_MAX,
  56. DMACH_SPI1_TX,
  57. DMACH_SPI1_RX,
  58. };
  59. static struct dma_pl330_platdata s5p6440_pdma_pdata = {
  60. .nr_valid_peri = ARRAY_SIZE(s5p6440_pdma_peri),
  61. .peri_id = s5p6440_pdma_peri,
  62. };
  63. static u8 s5p6450_pdma_peri[] = {
  64. DMACH_UART0_RX,
  65. DMACH_UART0_TX,
  66. DMACH_UART1_RX,
  67. DMACH_UART1_TX,
  68. DMACH_UART2_RX,
  69. DMACH_UART2_TX,
  70. DMACH_UART3_RX,
  71. DMACH_UART3_TX,
  72. DMACH_UART4_RX,
  73. DMACH_UART4_TX,
  74. DMACH_PCM0_TX,
  75. DMACH_PCM0_RX,
  76. DMACH_I2S0_TX,
  77. DMACH_I2S0_RX,
  78. DMACH_SPI0_TX,
  79. DMACH_SPI0_RX,
  80. DMACH_PCM1_TX,
  81. DMACH_PCM1_RX,
  82. DMACH_PCM2_TX,
  83. DMACH_PCM2_RX,
  84. DMACH_SPI1_TX,
  85. DMACH_SPI1_RX,
  86. DMACH_USI_TX,
  87. DMACH_USI_RX,
  88. DMACH_MAX,
  89. DMACH_I2S1_TX,
  90. DMACH_I2S1_RX,
  91. DMACH_I2S2_TX,
  92. DMACH_I2S2_RX,
  93. DMACH_PWM,
  94. DMACH_UART5_RX,
  95. DMACH_UART5_TX,
  96. };
  97. static struct dma_pl330_platdata s5p6450_pdma_pdata = {
  98. .nr_valid_peri = ARRAY_SIZE(s5p6450_pdma_peri),
  99. .peri_id = s5p6450_pdma_peri,
  100. };
  101. static AMBA_AHB_DEVICE(s5p64x0_pdma, "dma-pl330", 0x00041330,
  102. S5P64X0_PA_PDMA, {IRQ_DMA0}, NULL);
  103. static int __init s5p64x0_dma_init(void)
  104. {
  105. if (soc_is_s5p6450()) {
  106. dma_cap_set(DMA_SLAVE, s5p6450_pdma_pdata.cap_mask);
  107. dma_cap_set(DMA_CYCLIC, s5p6450_pdma_pdata.cap_mask);
  108. s5p64x0_pdma_device.dev.platform_data = &s5p6450_pdma_pdata;
  109. } else {
  110. dma_cap_set(DMA_SLAVE, s5p6440_pdma_pdata.cap_mask);
  111. dma_cap_set(DMA_CYCLIC, s5p6440_pdma_pdata.cap_mask);
  112. s5p64x0_pdma_device.dev.platform_data = &s5p6440_pdma_pdata;
  113. }
  114. amba_device_register(&s5p64x0_pdma_device, &iomem_resource);
  115. return 0;
  116. }
  117. arch_initcall(s5p64x0_dma_init);