common.c 17 KB

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