cpu.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /* linux/arch/arm/mach-s5p6440/cpu.c
  2. *
  3. * Copyright (c) 2009-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/clk.h>
  17. #include <linux/io.h>
  18. #include <linux/sysdev.h>
  19. #include <linux/serial_core.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/hardware.h>
  27. #include <mach/map.h>
  28. #include <asm/irq.h>
  29. #include <plat/regs-serial.h>
  30. #include <mach/regs-clock.h>
  31. #include <plat/cpu.h>
  32. #include <plat/devs.h>
  33. #include <plat/clock.h>
  34. #include <plat/s5p6440.h>
  35. #include <plat/adc-core.h>
  36. /* Initial IO mappings */
  37. static struct map_desc s5p6440_iodesc[] __initdata = {
  38. {
  39. .virtual = (unsigned long)S5P_VA_GPIO,
  40. .pfn = __phys_to_pfn(S5P6440_PA_GPIO),
  41. .length = SZ_4K,
  42. .type = MT_DEVICE,
  43. }, {
  44. .virtual = (unsigned long)VA_VIC0,
  45. .pfn = __phys_to_pfn(S5P6440_PA_VIC0),
  46. .length = SZ_16K,
  47. .type = MT_DEVICE,
  48. }, {
  49. .virtual = (unsigned long)VA_VIC1,
  50. .pfn = __phys_to_pfn(S5P6440_PA_VIC1),
  51. .length = SZ_16K,
  52. .type = MT_DEVICE,
  53. }, {
  54. .virtual = (unsigned long)S3C_VA_UART,
  55. .pfn = __phys_to_pfn(S3C_PA_UART),
  56. .length = SZ_512K,
  57. .type = MT_DEVICE,
  58. }
  59. };
  60. static void s5p6440_idle(void)
  61. {
  62. unsigned long val;
  63. if (!need_resched()) {
  64. val = __raw_readl(S5P_PWR_CFG);
  65. val &= ~(0x3<<5);
  66. val |= (0x1<<5);
  67. __raw_writel(val, S5P_PWR_CFG);
  68. cpu_do_idle();
  69. }
  70. local_irq_enable();
  71. }
  72. /*
  73. * s5p6440_map_io
  74. *
  75. * register the standard cpu IO areas
  76. */
  77. void __init s5p6440_map_io(void)
  78. {
  79. /* initialize any device information early */
  80. s3c_adc_setname("s3c64xx-adc");
  81. iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc));
  82. }
  83. void __init s5p6440_init_clocks(int xtal)
  84. {
  85. printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
  86. s3c24xx_register_baseclocks(xtal);
  87. s5p_register_clocks(xtal);
  88. s5p6440_register_clocks();
  89. s5p6440_setup_clocks();
  90. }
  91. void __init s5p6440_init_irq(void)
  92. {
  93. /* S5P6440 supports only 2 VIC */
  94. u32 vic[2];
  95. /*
  96. * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)]
  97. * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22]
  98. */
  99. vic[0] = 0xff800ae7;
  100. vic[1] = 0xffbf23e5;
  101. s5p_init_irq(vic, ARRAY_SIZE(vic));
  102. }
  103. struct sysdev_class s5p6440_sysclass = {
  104. .name = "s5p6440-core",
  105. };
  106. static struct sys_device s5p6440_sysdev = {
  107. .cls = &s5p6440_sysclass,
  108. };
  109. static int __init s5p6440_core_init(void)
  110. {
  111. return sysdev_class_register(&s5p6440_sysclass);
  112. }
  113. core_initcall(s5p6440_core_init);
  114. int __init s5p6440_init(void)
  115. {
  116. printk(KERN_INFO "S5P6440: Initializing architecture\n");
  117. /* set idle function */
  118. pm_idle = s5p6440_idle;
  119. return sysdev_register(&s5p6440_sysdev);
  120. }