cpu.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /* linux/arch/arm/mach-s5pv210/cpu.c
  2. *
  3. * Copyright (c) 2010 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/types.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/list.h>
  14. #include <linux/timer.h>
  15. #include <linux/init.h>
  16. #include <linux/module.h>
  17. #include <linux/clk.h>
  18. #include <linux/io.h>
  19. #include <linux/sysdev.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/sched.h>
  22. #include <asm/mach/arch.h>
  23. #include <asm/mach/map.h>
  24. #include <asm/mach/irq.h>
  25. #include <asm/proc-fns.h>
  26. #include <mach/map.h>
  27. #include <mach/regs-clock.h>
  28. #include <plat/cpu.h>
  29. #include <plat/devs.h>
  30. #include <plat/clock.h>
  31. #include <plat/fb-core.h>
  32. #include <plat/s5pv210.h>
  33. #include <plat/adc-core.h>
  34. #include <plat/ata-core.h>
  35. #include <plat/fimc-core.h>
  36. #include <plat/iic-core.h>
  37. #include <plat/keypad-core.h>
  38. #include <plat/sdhci.h>
  39. #include <plat/reset.h>
  40. #include <plat/tv-core.h>
  41. /* Initial IO mappings */
  42. static struct map_desc s5pv210_iodesc[] __initdata = {
  43. {
  44. .virtual = (unsigned long)S5P_VA_SYSTIMER,
  45. .pfn = __phys_to_pfn(S5PV210_PA_SYSTIMER),
  46. .length = SZ_4K,
  47. .type = MT_DEVICE,
  48. }, {
  49. .virtual = (unsigned long)S5P_VA_GPIO,
  50. .pfn = __phys_to_pfn(S5PV210_PA_GPIO),
  51. .length = SZ_4K,
  52. .type = MT_DEVICE,
  53. }, {
  54. .virtual = (unsigned long)VA_VIC0,
  55. .pfn = __phys_to_pfn(S5PV210_PA_VIC0),
  56. .length = SZ_16K,
  57. .type = MT_DEVICE,
  58. }, {
  59. .virtual = (unsigned long)VA_VIC1,
  60. .pfn = __phys_to_pfn(S5PV210_PA_VIC1),
  61. .length = SZ_16K,
  62. .type = MT_DEVICE,
  63. }, {
  64. .virtual = (unsigned long)VA_VIC2,
  65. .pfn = __phys_to_pfn(S5PV210_PA_VIC2),
  66. .length = SZ_16K,
  67. .type = MT_DEVICE,
  68. }, {
  69. .virtual = (unsigned long)VA_VIC3,
  70. .pfn = __phys_to_pfn(S5PV210_PA_VIC3),
  71. .length = SZ_16K,
  72. .type = MT_DEVICE,
  73. }, {
  74. .virtual = (unsigned long)S3C_VA_UART,
  75. .pfn = __phys_to_pfn(S3C_PA_UART),
  76. .length = SZ_512K,
  77. .type = MT_DEVICE,
  78. }, {
  79. .virtual = (unsigned long)S5P_VA_DMC0,
  80. .pfn = __phys_to_pfn(S5PV210_PA_DMC0),
  81. .length = SZ_4K,
  82. .type = MT_DEVICE,
  83. }, {
  84. .virtual = (unsigned long)S5P_VA_DMC1,
  85. .pfn = __phys_to_pfn(S5PV210_PA_DMC1),
  86. .length = SZ_4K,
  87. .type = MT_DEVICE,
  88. }, {
  89. .virtual = (unsigned long)S3C_VA_USB_HSPHY,
  90. .pfn =__phys_to_pfn(S5PV210_PA_HSPHY),
  91. .length = SZ_4K,
  92. .type = MT_DEVICE,
  93. }
  94. };
  95. static void s5pv210_idle(void)
  96. {
  97. if (!need_resched())
  98. cpu_do_idle();
  99. local_irq_enable();
  100. }
  101. static void s5pv210_sw_reset(void)
  102. {
  103. __raw_writel(0x1, S5P_SWRESET);
  104. }
  105. /* s5pv210_map_io
  106. *
  107. * register the standard cpu IO areas
  108. */
  109. void __init s5pv210_map_io(void)
  110. {
  111. iotable_init(s5pv210_iodesc, ARRAY_SIZE(s5pv210_iodesc));
  112. /* initialise device information early */
  113. s5pv210_default_sdhci0();
  114. s5pv210_default_sdhci1();
  115. s5pv210_default_sdhci2();
  116. s5pv210_default_sdhci3();
  117. s3c_adc_setname("samsung-adc-v3");
  118. s3c_cfcon_setname("s5pv210-pata");
  119. s3c_fimc_setname(0, "s5pv210-fimc");
  120. s3c_fimc_setname(1, "s5pv210-fimc");
  121. s3c_fimc_setname(2, "s5pv210-fimc");
  122. /* the i2c devices are directly compatible with s3c2440 */
  123. s3c_i2c0_setname("s3c2440-i2c");
  124. s3c_i2c1_setname("s3c2440-i2c");
  125. s3c_i2c2_setname("s3c2440-i2c");
  126. s3c_fb_setname("s5pv210-fb");
  127. /* Use s5pv210-keypad instead of samsung-keypad */
  128. samsung_keypad_setname("s5pv210-keypad");
  129. /* setup TV devices */
  130. s5p_hdmi_setname("s5pv210-hdmi");
  131. }
  132. void __init s5pv210_init_clocks(int xtal)
  133. {
  134. printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
  135. s3c24xx_register_baseclocks(xtal);
  136. s5p_register_clocks(xtal);
  137. s5pv210_register_clocks();
  138. s5pv210_setup_clocks();
  139. }
  140. void __init s5pv210_init_irq(void)
  141. {
  142. u32 vic[4]; /* S5PV210 supports 4 VIC */
  143. /* All the VICs are fully populated. */
  144. vic[0] = ~0;
  145. vic[1] = ~0;
  146. vic[2] = ~0;
  147. vic[3] = ~0;
  148. s5p_init_irq(vic, ARRAY_SIZE(vic));
  149. }
  150. struct sysdev_class s5pv210_sysclass = {
  151. .name = "s5pv210-core",
  152. };
  153. static struct sys_device s5pv210_sysdev = {
  154. .cls = &s5pv210_sysclass,
  155. };
  156. static int __init s5pv210_core_init(void)
  157. {
  158. return sysdev_class_register(&s5pv210_sysclass);
  159. }
  160. core_initcall(s5pv210_core_init);
  161. int __init s5pv210_init(void)
  162. {
  163. printk(KERN_INFO "S5PV210: Initializing architecture\n");
  164. /* set idle function */
  165. pm_idle = s5pv210_idle;
  166. /* set sw_reset function */
  167. s5p_reset_hook = s5pv210_sw_reset;
  168. return sysdev_register(&s5pv210_sysdev);
  169. }