common.c 17 KB

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