cpu.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* linux/arch/arm/mach-s5pv310/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/sched.h>
  11. #include <linux/sysdev.h>
  12. #include <asm/mach/map.h>
  13. #include <asm/mach/irq.h>
  14. #include <asm/proc-fns.h>
  15. #include <plat/cpu.h>
  16. #include <plat/clock.h>
  17. #include <plat/s5pv310.h>
  18. #include <mach/regs-irq.h>
  19. void __iomem *gic_cpu_base_addr;
  20. extern int combiner_init(unsigned int combiner_nr, void __iomem *base,
  21. unsigned int irq_start);
  22. extern void combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq);
  23. /* Initial IO mappings */
  24. static struct map_desc s5pv310_iodesc[] __initdata = {
  25. {
  26. .virtual = (unsigned long)S5P_VA_COREPERI_BASE,
  27. .pfn = __phys_to_pfn(S5PV310_PA_COREPERI),
  28. .length = SZ_8K,
  29. .type = MT_DEVICE,
  30. }, {
  31. .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
  32. .pfn = __phys_to_pfn(S5PV310_PA_COMBINER),
  33. .length = SZ_4K,
  34. .type = MT_DEVICE,
  35. }, {
  36. .virtual = (unsigned long)S5P_VA_L2CC,
  37. .pfn = __phys_to_pfn(S5PV310_PA_L2CC),
  38. .length = SZ_4K,
  39. .type = MT_DEVICE,
  40. }, {
  41. .virtual = (unsigned long)S5P_VA_SYSRAM,
  42. .pfn = __phys_to_pfn(S5PV310_PA_SYSRAM),
  43. .length = SZ_4K,
  44. .type = MT_DEVICE,
  45. }, {
  46. .virtual = (unsigned long)S5P_VA_CMU,
  47. .pfn = __phys_to_pfn(S5PV310_PA_CMU),
  48. .length = SZ_128K,
  49. .type = MT_DEVICE,
  50. },
  51. };
  52. static void s5pv310_idle(void)
  53. {
  54. if (!need_resched())
  55. cpu_do_idle();
  56. local_irq_enable();
  57. }
  58. /* s5pv310_map_io
  59. *
  60. * register the standard cpu IO areas
  61. */
  62. void __init s5pv310_map_io(void)
  63. {
  64. iotable_init(s5pv310_iodesc, ARRAY_SIZE(s5pv310_iodesc));
  65. }
  66. void __init s5pv310_init_clocks(int xtal)
  67. {
  68. printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
  69. s3c24xx_register_baseclocks(xtal);
  70. s5p_register_clocks(xtal);
  71. s5pv310_register_clocks();
  72. s5pv310_setup_clocks();
  73. }
  74. void __init s5pv310_init_irq(void)
  75. {
  76. int irq;
  77. gic_cpu_base_addr = S5P_VA_GIC_CPU;
  78. gic_dist_init(0, S5P_VA_GIC_DIST, IRQ_LOCALTIMER);
  79. gic_cpu_init(0, S5P_VA_GIC_CPU);
  80. for (irq = 0; irq < MAX_COMBINER_NR; irq++) {
  81. combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
  82. COMBINER_IRQ(irq, 0));
  83. combiner_cascade_irq(irq, IRQ_SPI(irq));
  84. }
  85. /* The parameters of s5p_init_irq() are for VIC init.
  86. * Theses parameters should be NULL and 0 because S5PV310
  87. * uses GIC instead of VIC.
  88. */
  89. s5p_init_irq(NULL, 0);
  90. }
  91. struct sysdev_class s5pv310_sysclass = {
  92. .name = "s5pv310-core",
  93. };
  94. static struct sys_device s5pv310_sysdev = {
  95. .cls = &s5pv310_sysclass,
  96. };
  97. static int __init s5pv310_core_init(void)
  98. {
  99. return sysdev_class_register(&s5pv310_sysclass);
  100. }
  101. core_initcall(s5pv310_core_init);
  102. int __init s5pv310_init(void)
  103. {
  104. printk(KERN_INFO "S5PV310: Initializing architecture\n");
  105. /* set idle function */
  106. pm_idle = s5pv310_idle;
  107. return sysdev_register(&s5pv310_sysdev);
  108. }