dma.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /* linux/arch/arm/mach-s5pc100/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. static u8 pdma0_peri[] = {
  34. DMACH_UART0_RX,
  35. DMACH_UART0_TX,
  36. DMACH_UART1_RX,
  37. DMACH_UART1_TX,
  38. DMACH_UART2_RX,
  39. DMACH_UART2_TX,
  40. DMACH_UART3_RX,
  41. DMACH_UART3_TX,
  42. DMACH_IRDA,
  43. DMACH_I2S0_RX,
  44. DMACH_I2S0_TX,
  45. DMACH_I2S0S_TX,
  46. DMACH_I2S1_RX,
  47. DMACH_I2S1_TX,
  48. DMACH_I2S2_RX,
  49. DMACH_I2S2_TX,
  50. DMACH_SPI0_RX,
  51. DMACH_SPI0_TX,
  52. DMACH_SPI1_RX,
  53. DMACH_SPI1_TX,
  54. DMACH_SPI2_RX,
  55. DMACH_SPI2_TX,
  56. DMACH_AC97_MICIN,
  57. DMACH_AC97_PCMIN,
  58. DMACH_AC97_PCMOUT,
  59. DMACH_EXTERNAL,
  60. DMACH_PWM,
  61. DMACH_SPDIF,
  62. DMACH_HSI_RX,
  63. DMACH_HSI_TX,
  64. };
  65. static struct dma_pl330_platdata s5pc100_pdma0_pdata = {
  66. .nr_valid_peri = ARRAY_SIZE(pdma0_peri),
  67. .peri_id = pdma0_peri,
  68. };
  69. static AMBA_AHB_DEVICE(s5pc100_pdma0, "dma-pl330.0", 0x00041330,
  70. S5PC100_PA_PDMA0, {IRQ_PDMA0}, &s5pc100_pdma0_pdata);
  71. static u8 pdma1_peri[] = {
  72. DMACH_UART0_RX,
  73. DMACH_UART0_TX,
  74. DMACH_UART1_RX,
  75. DMACH_UART1_TX,
  76. DMACH_UART2_RX,
  77. DMACH_UART2_TX,
  78. DMACH_UART3_RX,
  79. DMACH_UART3_TX,
  80. DMACH_IRDA,
  81. DMACH_I2S0_RX,
  82. DMACH_I2S0_TX,
  83. DMACH_I2S0S_TX,
  84. DMACH_I2S1_RX,
  85. DMACH_I2S1_TX,
  86. DMACH_I2S2_RX,
  87. DMACH_I2S2_TX,
  88. DMACH_SPI0_RX,
  89. DMACH_SPI0_TX,
  90. DMACH_SPI1_RX,
  91. DMACH_SPI1_TX,
  92. DMACH_SPI2_RX,
  93. DMACH_SPI2_TX,
  94. DMACH_PCM0_RX,
  95. DMACH_PCM0_TX,
  96. DMACH_PCM1_RX,
  97. DMACH_PCM1_TX,
  98. DMACH_MSM_REQ0,
  99. DMACH_MSM_REQ1,
  100. DMACH_MSM_REQ2,
  101. DMACH_MSM_REQ3,
  102. };
  103. static struct dma_pl330_platdata s5pc100_pdma1_pdata = {
  104. .nr_valid_peri = ARRAY_SIZE(pdma1_peri),
  105. .peri_id = pdma1_peri,
  106. };
  107. static AMBA_AHB_DEVICE(s5pc100_pdma1, "dma-pl330.1", 0x00041330,
  108. S5PC100_PA_PDMA1, {IRQ_PDMA1}, &s5pc100_pdma1_pdata);
  109. static int __init s5pc100_dma_init(void)
  110. {
  111. dma_cap_set(DMA_SLAVE, s5pc100_pdma0_pdata.cap_mask);
  112. dma_cap_set(DMA_CYCLIC, s5pc100_pdma0_pdata.cap_mask);
  113. amba_device_register(&s5pc100_pdma0_device, &iomem_resource);
  114. dma_cap_set(DMA_SLAVE, s5pc100_pdma1_pdata.cap_mask);
  115. dma_cap_set(DMA_CYCLIC, s5pc100_pdma1_pdata.cap_mask);
  116. amba_device_register(&s5pc100_pdma1_device, &iomem_resource);
  117. return 0;
  118. }
  119. arch_initcall(s5pc100_dma_init);