dma.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /* linux/arch/arm/mach-s3c2412/dma.c
  2. *
  3. * Copyright (c) 2006 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * S3C2412 DMA selection
  7. *
  8. * http://armlinux.simtec.co.uk/
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/sysdev.h>
  17. #include <linux/serial_core.h>
  18. #include <asm/dma.h>
  19. #include <asm/arch/dma.h>
  20. #include <asm/io.h>
  21. #include <asm/plat-s3c24xx/dma.h>
  22. #include <asm/plat-s3c24xx/cpu.h>
  23. #include <asm/arch/regs-serial.h>
  24. #include <asm/arch/regs-gpio.h>
  25. #include <asm/arch/regs-ac97.h>
  26. #include <asm/arch/regs-mem.h>
  27. #include <asm/arch/regs-lcd.h>
  28. #include <asm/arch/regs-sdi.h>
  29. #include <asm/arch/regs-iis.h>
  30. #include <asm/arch/regs-spi.h>
  31. #define MAP(x) { (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID }
  32. static struct s3c24xx_dma_map __initdata s3c2412_dma_mappings[] = {
  33. [DMACH_XD0] = {
  34. .name = "xdreq0",
  35. .channels = MAP(S3C2412_DMAREQSEL_XDREQ0),
  36. },
  37. [DMACH_XD1] = {
  38. .name = "xdreq1",
  39. .channels = MAP(S3C2412_DMAREQSEL_XDREQ1),
  40. },
  41. [DMACH_SDI] = {
  42. .name = "sdi",
  43. .channels = MAP(S3C2412_DMAREQSEL_SDI),
  44. .hw_addr.to = S3C2410_PA_IIS + S3C2410_IISFIFO,
  45. .hw_addr.from = S3C2410_PA_IIS + S3C2410_IISFIFO,
  46. },
  47. [DMACH_SPI0] = {
  48. .name = "spi0",
  49. .channels = MAP(S3C2412_DMAREQSEL_SPI0TX),
  50. .hw_addr.to = S3C2410_PA_SPI + S3C2410_SPTDAT,
  51. .hw_addr.from = S3C2410_PA_SPI + S3C2410_SPRDAT,
  52. },
  53. [DMACH_SPI1] = {
  54. .name = "spi1",
  55. .channels = MAP(S3C2412_DMAREQSEL_SPI1TX),
  56. .hw_addr.to = S3C2410_PA_SPI + 0x20 + S3C2410_SPTDAT,
  57. .hw_addr.from = S3C2410_PA_SPI + 0x20 + S3C2410_SPRDAT,
  58. },
  59. [DMACH_UART0] = {
  60. .name = "uart0",
  61. .channels = MAP(S3C2412_DMAREQSEL_UART0_0),
  62. .hw_addr.to = S3C2410_PA_UART0 + S3C2410_UTXH,
  63. .hw_addr.from = S3C2410_PA_UART0 + S3C2410_URXH,
  64. },
  65. [DMACH_UART1] = {
  66. .name = "uart1",
  67. .channels = MAP(S3C2412_DMAREQSEL_UART1_0),
  68. .hw_addr.to = S3C2410_PA_UART1 + S3C2410_UTXH,
  69. .hw_addr.from = S3C2410_PA_UART1 + S3C2410_URXH,
  70. },
  71. [DMACH_UART2] = {
  72. .name = "uart2",
  73. .channels = MAP(S3C2412_DMAREQSEL_UART2_0),
  74. .hw_addr.to = S3C2410_PA_UART2 + S3C2410_UTXH,
  75. .hw_addr.from = S3C2410_PA_UART2 + S3C2410_URXH,
  76. },
  77. [DMACH_UART0_SRC2] = {
  78. .name = "uart0",
  79. .channels = MAP(S3C2412_DMAREQSEL_UART0_1),
  80. .hw_addr.to = S3C2410_PA_UART0 + S3C2410_UTXH,
  81. .hw_addr.from = S3C2410_PA_UART0 + S3C2410_URXH,
  82. },
  83. [DMACH_UART1_SRC2] = {
  84. .name = "uart1",
  85. .channels = MAP(S3C2412_DMAREQSEL_UART1_1),
  86. .hw_addr.to = S3C2410_PA_UART1 + S3C2410_UTXH,
  87. .hw_addr.from = S3C2410_PA_UART1 + S3C2410_URXH,
  88. },
  89. [DMACH_UART2_SRC2] = {
  90. .name = "uart2",
  91. .channels = MAP(S3C2412_DMAREQSEL_UART2_1),
  92. .hw_addr.to = S3C2410_PA_UART2 + S3C2410_UTXH,
  93. .hw_addr.from = S3C2410_PA_UART2 + S3C2410_URXH,
  94. },
  95. [DMACH_TIMER] = {
  96. .name = "timer",
  97. .channels = MAP(S3C2412_DMAREQSEL_TIMER),
  98. },
  99. [DMACH_I2S_IN] = {
  100. .name = "i2s-sdi",
  101. .channels = MAP(S3C2412_DMAREQSEL_I2SRX),
  102. .hw_addr.from = S3C2410_PA_IIS + S3C2410_IISFIFO,
  103. },
  104. [DMACH_I2S_OUT] = {
  105. .name = "i2s-sdo",
  106. .channels = MAP(S3C2412_DMAREQSEL_I2STX),
  107. .hw_addr.to = S3C2410_PA_IIS + S3C2410_IISFIFO,
  108. },
  109. [DMACH_USB_EP1] = {
  110. .name = "usb-ep1",
  111. .channels = MAP(S3C2412_DMAREQSEL_USBEP1),
  112. },
  113. [DMACH_USB_EP2] = {
  114. .name = "usb-ep2",
  115. .channels = MAP(S3C2412_DMAREQSEL_USBEP2),
  116. },
  117. [DMACH_USB_EP3] = {
  118. .name = "usb-ep3",
  119. .channels = MAP(S3C2412_DMAREQSEL_USBEP3),
  120. },
  121. [DMACH_USB_EP4] = {
  122. .name = "usb-ep4",
  123. .channels = MAP(S3C2412_DMAREQSEL_USBEP4),
  124. },
  125. };
  126. static void s3c2412_dma_select(struct s3c2410_dma_chan *chan,
  127. struct s3c24xx_dma_map *map)
  128. {
  129. writel(map->channels[0] | S3C2412_DMAREQSEL_HW,
  130. chan->regs + S3C2412_DMA_DMAREQSEL);
  131. }
  132. static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = {
  133. .select = s3c2412_dma_select,
  134. .dcon_mask = 0,
  135. .map = s3c2412_dma_mappings,
  136. .map_size = ARRAY_SIZE(s3c2412_dma_mappings),
  137. };
  138. static int s3c2412_dma_add(struct sys_device *sysdev)
  139. {
  140. s3c2410_dma_init();
  141. return s3c24xx_dma_init_map(&s3c2412_dma_sel);
  142. }
  143. static struct sysdev_driver s3c2412_dma_driver = {
  144. .add = s3c2412_dma_add,
  145. };
  146. static int __init s3c2412_dma_init(void)
  147. {
  148. return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_dma_driver);
  149. }
  150. arch_initcall(s3c2412_dma_init);