common.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. /* linux/arch/arm/plat-s3c24xx/cpu.c
  2. *
  3. * Copyright (c) 2004-2005 Simtec Electronics
  4. * http://www.simtec.co.uk/products/SWLINUX/
  5. * Ben Dooks <ben@simtec.co.uk>
  6. *
  7. * Common code for S3C24XX machines
  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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. */
  23. #include <linux/init.h>
  24. #include <linux/module.h>
  25. #include <linux/interrupt.h>
  26. #include <linux/ioport.h>
  27. #include <linux/serial_core.h>
  28. #include <clocksource/samsung_pwm.h>
  29. #include <linux/platform_device.h>
  30. #include <linux/delay.h>
  31. #include <linux/io.h>
  32. #include <linux/platform_data/dma-s3c24xx.h>
  33. #include <mach/hardware.h>
  34. #include <mach/regs-clock.h>
  35. #include <asm/irq.h>
  36. #include <asm/cacheflush.h>
  37. #include <asm/system_info.h>
  38. #include <asm/system_misc.h>
  39. #include <asm/mach/arch.h>
  40. #include <asm/mach/map.h>
  41. #include <mach/regs-gpio.h>
  42. #include <plat/regs-serial.h>
  43. #include <mach/dma.h>
  44. #include <plat/cpu.h>
  45. #include <plat/devs.h>
  46. #include <plat/clock.h>
  47. #include <plat/cpu-freq.h>
  48. #include <plat/pll.h>
  49. #include <plat/pwm-core.h>
  50. #include "common.h"
  51. /* table of supported CPUs */
  52. static const char name_s3c2410[] = "S3C2410";
  53. static const char name_s3c2412[] = "S3C2412";
  54. static const char name_s3c2416[] = "S3C2416/S3C2450";
  55. static const char name_s3c2440[] = "S3C2440";
  56. static const char name_s3c2442[] = "S3C2442";
  57. static const char name_s3c2442b[] = "S3C2442B";
  58. static const char name_s3c2443[] = "S3C2443";
  59. static const char name_s3c2410a[] = "S3C2410A";
  60. static const char name_s3c2440a[] = "S3C2440A";
  61. static struct cpu_table cpu_ids[] __initdata = {
  62. {
  63. .idcode = 0x32410000,
  64. .idmask = 0xffffffff,
  65. .map_io = s3c2410_map_io,
  66. .init_clocks = s3c2410_init_clocks,
  67. .init_uarts = s3c2410_init_uarts,
  68. .init = s3c2410_init,
  69. .name = name_s3c2410
  70. },
  71. {
  72. .idcode = 0x32410002,
  73. .idmask = 0xffffffff,
  74. .map_io = s3c2410_map_io,
  75. .init_clocks = s3c2410_init_clocks,
  76. .init_uarts = s3c2410_init_uarts,
  77. .init = s3c2410a_init,
  78. .name = name_s3c2410a
  79. },
  80. {
  81. .idcode = 0x32440000,
  82. .idmask = 0xffffffff,
  83. .map_io = s3c2440_map_io,
  84. .init_clocks = s3c244x_init_clocks,
  85. .init_uarts = s3c244x_init_uarts,
  86. .init = s3c2440_init,
  87. .name = name_s3c2440
  88. },
  89. {
  90. .idcode = 0x32440001,
  91. .idmask = 0xffffffff,
  92. .map_io = s3c2440_map_io,
  93. .init_clocks = s3c244x_init_clocks,
  94. .init_uarts = s3c244x_init_uarts,
  95. .init = s3c2440_init,
  96. .name = name_s3c2440a
  97. },
  98. {
  99. .idcode = 0x32440aaa,
  100. .idmask = 0xffffffff,
  101. .map_io = s3c2442_map_io,
  102. .init_clocks = s3c244x_init_clocks,
  103. .init_uarts = s3c244x_init_uarts,
  104. .init = s3c2442_init,
  105. .name = name_s3c2442
  106. },
  107. {
  108. .idcode = 0x32440aab,
  109. .idmask = 0xffffffff,
  110. .map_io = s3c2442_map_io,
  111. .init_clocks = s3c244x_init_clocks,
  112. .init_uarts = s3c244x_init_uarts,
  113. .init = s3c2442_init,
  114. .name = name_s3c2442b
  115. },
  116. {
  117. .idcode = 0x32412001,
  118. .idmask = 0xffffffff,
  119. .map_io = s3c2412_map_io,
  120. .init_clocks = s3c2412_init_clocks,
  121. .init_uarts = s3c2412_init_uarts,
  122. .init = s3c2412_init,
  123. .name = name_s3c2412,
  124. },
  125. { /* a newer version of the s3c2412 */
  126. .idcode = 0x32412003,
  127. .idmask = 0xffffffff,
  128. .map_io = s3c2412_map_io,
  129. .init_clocks = s3c2412_init_clocks,
  130. .init_uarts = s3c2412_init_uarts,
  131. .init = s3c2412_init,
  132. .name = name_s3c2412,
  133. },
  134. { /* a strange version of the s3c2416 */
  135. .idcode = 0x32450003,
  136. .idmask = 0xffffffff,
  137. .map_io = s3c2416_map_io,
  138. .init_clocks = s3c2416_init_clocks,
  139. .init_uarts = s3c2416_init_uarts,
  140. .init = s3c2416_init,
  141. .name = name_s3c2416,
  142. },
  143. {
  144. .idcode = 0x32443001,
  145. .idmask = 0xffffffff,
  146. .map_io = s3c2443_map_io,
  147. .init_clocks = s3c2443_init_clocks,
  148. .init_uarts = s3c2443_init_uarts,
  149. .init = s3c2443_init,
  150. .name = name_s3c2443,
  151. },
  152. };
  153. /* minimal IO mapping */
  154. static struct map_desc s3c_iodesc[] __initdata = {
  155. IODESC_ENT(GPIO),
  156. IODESC_ENT(IRQ),
  157. IODESC_ENT(MEMCTRL),
  158. IODESC_ENT(UART)
  159. };
  160. /* read cpu identificaiton code */
  161. static unsigned long s3c24xx_read_idcode_v5(void)
  162. {
  163. #if defined(CONFIG_CPU_S3C2416)
  164. /* s3c2416 is v5, with S3C24XX_GSTATUS1 instead of S3C2412_GSTATUS1 */
  165. u32 gs = __raw_readl(S3C24XX_GSTATUS1);
  166. /* test for s3c2416 or similar device */
  167. if ((gs >> 16) == 0x3245)
  168. return gs;
  169. #endif
  170. #if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
  171. return __raw_readl(S3C2412_GSTATUS1);
  172. #else
  173. return 1UL; /* don't look like an 2400 */
  174. #endif
  175. }
  176. static unsigned long s3c24xx_read_idcode_v4(void)
  177. {
  178. return __raw_readl(S3C2410_GSTATUS1);
  179. }
  180. static void s3c24xx_default_idle(void)
  181. {
  182. unsigned long tmp = 0;
  183. int i;
  184. /* idle the system by using the idle mode which will wait for an
  185. * interrupt to happen before restarting the system.
  186. */
  187. /* Warning: going into idle state upsets jtag scanning */
  188. __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
  189. S3C2410_CLKCON);
  190. /* the samsung port seems to do a loop and then unset idle.. */
  191. for (i = 0; i < 50; i++)
  192. tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
  193. /* this bit is not cleared on re-start... */
  194. __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
  195. S3C2410_CLKCON);
  196. }
  197. static struct samsung_pwm_variant s3c24xx_pwm_variant = {
  198. .bits = 16,
  199. .div_base = 1,
  200. .has_tint_cstat = false,
  201. .tclk_mask = (1 << 4),
  202. };
  203. void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
  204. {
  205. arm_pm_idle = s3c24xx_default_idle;
  206. /* initialise the io descriptors we need for initialisation */
  207. iotable_init(mach_desc, size);
  208. iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
  209. if (cpu_architecture() >= CPU_ARCH_ARMv5) {
  210. samsung_cpu_id = s3c24xx_read_idcode_v5();
  211. } else {
  212. samsung_cpu_id = s3c24xx_read_idcode_v4();
  213. }
  214. s3c24xx_init_cpu();
  215. s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
  216. samsung_pwm_set_platdata(&s3c24xx_pwm_variant);
  217. }
  218. void __init samsung_set_timer_source(unsigned int event, unsigned int source)
  219. {
  220. s3c24xx_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
  221. s3c24xx_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
  222. }
  223. void __init samsung_timer_init(void)
  224. {
  225. unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
  226. IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2, IRQ_TIMER3, IRQ_TIMER4,
  227. };
  228. samsung_pwm_clocksource_init(S3C_VA_TIMER,
  229. timer_irqs, &s3c24xx_pwm_variant);
  230. }
  231. /* Serial port registrations */
  232. #define S3C2410_PA_UART0 (S3C24XX_PA_UART)
  233. #define S3C2410_PA_UART1 (S3C24XX_PA_UART + 0x4000 )
  234. #define S3C2410_PA_UART2 (S3C24XX_PA_UART + 0x8000 )
  235. #define S3C2443_PA_UART3 (S3C24XX_PA_UART + 0xC000 )
  236. static struct resource s3c2410_uart0_resource[] = {
  237. [0] = DEFINE_RES_MEM(S3C2410_PA_UART0, SZ_16K),
  238. [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX0, \
  239. IRQ_S3CUART_ERR0 - IRQ_S3CUART_RX0 + 1, \
  240. NULL, IORESOURCE_IRQ)
  241. };
  242. static struct resource s3c2410_uart1_resource[] = {
  243. [0] = DEFINE_RES_MEM(S3C2410_PA_UART1, SZ_16K),
  244. [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX1, \
  245. IRQ_S3CUART_ERR1 - IRQ_S3CUART_RX1 + 1, \
  246. NULL, IORESOURCE_IRQ)
  247. };
  248. static struct resource s3c2410_uart2_resource[] = {
  249. [0] = DEFINE_RES_MEM(S3C2410_PA_UART2, SZ_16K),
  250. [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX2, \
  251. IRQ_S3CUART_ERR2 - IRQ_S3CUART_RX2 + 1, \
  252. NULL, IORESOURCE_IRQ)
  253. };
  254. static struct resource s3c2410_uart3_resource[] = {
  255. [0] = DEFINE_RES_MEM(S3C2443_PA_UART3, SZ_16K),
  256. [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX3, \
  257. IRQ_S3CUART_ERR3 - IRQ_S3CUART_RX3 + 1, \
  258. NULL, IORESOURCE_IRQ)
  259. };
  260. struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
  261. [0] = {
  262. .resources = s3c2410_uart0_resource,
  263. .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
  264. },
  265. [1] = {
  266. .resources = s3c2410_uart1_resource,
  267. .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
  268. },
  269. [2] = {
  270. .resources = s3c2410_uart2_resource,
  271. .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
  272. },
  273. [3] = {
  274. .resources = s3c2410_uart3_resource,
  275. .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
  276. },
  277. };
  278. /* initialise all the clocks */
  279. void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk,
  280. unsigned long hclk,
  281. unsigned long pclk)
  282. {
  283. clk_upll.rate = s3c24xx_get_pll(__raw_readl(S3C2410_UPLLCON),
  284. clk_xtal.rate);
  285. clk_mpll.rate = fclk;
  286. clk_h.rate = hclk;
  287. clk_p.rate = pclk;
  288. clk_f.rate = fclk;
  289. }
  290. #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
  291. defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
  292. static struct resource s3c2410_dma_resource[] = {
  293. [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
  294. [1] = DEFINE_RES_IRQ(IRQ_DMA0),
  295. [2] = DEFINE_RES_IRQ(IRQ_DMA1),
  296. [3] = DEFINE_RES_IRQ(IRQ_DMA2),
  297. [4] = DEFINE_RES_IRQ(IRQ_DMA3),
  298. };
  299. #endif
  300. #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2442)
  301. static struct s3c24xx_dma_channel s3c2410_dma_channels[DMACH_MAX] = {
  302. [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
  303. [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
  304. [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
  305. S3C24XX_DMA_CHANREQ(2, 2) |
  306. S3C24XX_DMA_CHANREQ(1, 3),
  307. },
  308. [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
  309. [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
  310. [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
  311. [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
  312. [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
  313. [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
  314. S3C24XX_DMA_CHANREQ(3, 2) |
  315. S3C24XX_DMA_CHANREQ(3, 3),
  316. },
  317. [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
  318. S3C24XX_DMA_CHANREQ(1, 2),
  319. },
  320. [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 2), },
  321. [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
  322. [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
  323. [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
  324. [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
  325. };
  326. static struct s3c24xx_dma_platdata s3c2410_dma_platdata = {
  327. .num_phy_channels = 4,
  328. .channels = s3c2410_dma_channels,
  329. .num_channels = DMACH_MAX,
  330. };
  331. struct platform_device s3c2410_device_dma = {
  332. .name = "s3c2410-dma",
  333. .id = 0,
  334. .num_resources = ARRAY_SIZE(s3c2410_dma_resource),
  335. .resource = s3c2410_dma_resource,
  336. .dev = {
  337. .platform_data = &s3c2410_dma_platdata,
  338. },
  339. };
  340. #endif
  341. #ifdef CONFIG_CPU_S3C2412
  342. static struct s3c24xx_dma_channel s3c2412_dma_channels[DMACH_MAX] = {
  343. [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
  344. [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
  345. [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
  346. [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
  347. [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
  348. [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
  349. [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
  350. [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
  351. [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
  352. [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
  353. [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
  354. [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
  355. [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
  356. [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
  357. [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
  358. [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
  359. [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, 13 },
  360. [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, 14 },
  361. [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, 15 },
  362. [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 },
  363. };
  364. static struct s3c24xx_dma_platdata s3c2412_dma_platdata = {
  365. .num_phy_channels = 4,
  366. .channels = s3c2412_dma_channels,
  367. .num_channels = DMACH_MAX,
  368. };
  369. struct platform_device s3c2412_device_dma = {
  370. .name = "s3c2412-dma",
  371. .id = 0,
  372. .num_resources = ARRAY_SIZE(s3c2410_dma_resource),
  373. .resource = s3c2410_dma_resource,
  374. .dev = {
  375. .platform_data = &s3c2412_dma_platdata,
  376. },
  377. };
  378. #endif
  379. #if defined(CONFIG_CPU_S3C2440)
  380. static struct s3c24xx_dma_channel s3c2440_dma_channels[DMACH_MAX] = {
  381. [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
  382. [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
  383. [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
  384. S3C24XX_DMA_CHANREQ(6, 1) |
  385. S3C24XX_DMA_CHANREQ(2, 2) |
  386. S3C24XX_DMA_CHANREQ(1, 3),
  387. },
  388. [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
  389. [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
  390. [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
  391. [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
  392. [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
  393. [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
  394. S3C24XX_DMA_CHANREQ(3, 2) |
  395. S3C24XX_DMA_CHANREQ(3, 3),
  396. },
  397. [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
  398. S3C24XX_DMA_CHANREQ(1, 2),
  399. },
  400. [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 0) |
  401. S3C24XX_DMA_CHANREQ(0, 2),
  402. },
  403. [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 0) |
  404. S3C24XX_DMA_CHANREQ(5, 2),
  405. },
  406. [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 1) |
  407. S3C24XX_DMA_CHANREQ(6, 3),
  408. },
  409. [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 2) |
  410. S3C24XX_DMA_CHANREQ(5, 3),
  411. },
  412. [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
  413. [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
  414. [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
  415. [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
  416. };
  417. static struct s3c24xx_dma_platdata s3c2440_dma_platdata = {
  418. .num_phy_channels = 4,
  419. .channels = s3c2440_dma_channels,
  420. .num_channels = DMACH_MAX,
  421. };
  422. struct platform_device s3c2440_device_dma = {
  423. .name = "s3c2410-dma",
  424. .id = 0,
  425. .num_resources = ARRAY_SIZE(s3c2410_dma_resource),
  426. .resource = s3c2410_dma_resource,
  427. .dev = {
  428. .platform_data = &s3c2440_dma_platdata,
  429. },
  430. };
  431. #endif
  432. #if defined(CONFIG_CPUS_3C2443) || defined(CONFIG_CPU_S3C2416)
  433. static struct resource s3c2443_dma_resource[] = {
  434. [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
  435. [1] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA0),
  436. [2] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA1),
  437. [3] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA2),
  438. [4] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA3),
  439. [5] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA4),
  440. [6] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA5),
  441. };
  442. static struct s3c24xx_dma_channel s3c2443_dma_channels[DMACH_MAX] = {
  443. [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
  444. [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
  445. [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
  446. [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
  447. [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
  448. [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
  449. [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
  450. [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
  451. [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
  452. [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
  453. [DMACH_UART3] = { S3C24XX_DMA_APB, true, 25 },
  454. [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
  455. [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
  456. [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
  457. [DMACH_UART3_SRC2] = { S3C24XX_DMA_APB, true, 26 },
  458. [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
  459. [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
  460. [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
  461. [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, 28 },
  462. [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, 27 },
  463. [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 },
  464. };
  465. static struct s3c24xx_dma_platdata s3c2443_dma_platdata = {
  466. .num_phy_channels = 6,
  467. .channels = s3c2443_dma_channels,
  468. .num_channels = DMACH_MAX,
  469. };
  470. struct platform_device s3c2443_device_dma = {
  471. .name = "s3c2443-dma",
  472. .id = 0,
  473. .num_resources = ARRAY_SIZE(s3c2443_dma_resource),
  474. .resource = s3c2443_dma_resource,
  475. .dev = {
  476. .platform_data = &s3c2443_dma_platdata,
  477. },
  478. };
  479. #endif