cpu.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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 <plat/sdhci.h>
  19. #include <mach/regs-irq.h>
  20. void __iomem *gic_cpu_base_addr;
  21. extern int combiner_init(unsigned int combiner_nr, void __iomem *base,
  22. unsigned int irq_start);
  23. extern void combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq);
  24. /* Initial IO mappings */
  25. static struct map_desc s5pv310_iodesc[] __initdata = {
  26. {
  27. .virtual = (unsigned long)S5P_VA_SYSRAM,
  28. .pfn = __phys_to_pfn(S5PV310_PA_SYSRAM),
  29. .length = SZ_4K,
  30. .type = MT_DEVICE,
  31. }, {
  32. .virtual = (unsigned long)S5P_VA_CMU,
  33. .pfn = __phys_to_pfn(S5PV310_PA_CMU),
  34. .length = SZ_128K,
  35. .type = MT_DEVICE,
  36. }, {
  37. .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
  38. .pfn = __phys_to_pfn(S5PV310_PA_COMBINER),
  39. .length = SZ_4K,
  40. .type = MT_DEVICE,
  41. }, {
  42. .virtual = (unsigned long)S5P_VA_COREPERI_BASE,
  43. .pfn = __phys_to_pfn(S5PV310_PA_COREPERI),
  44. .length = SZ_8K,
  45. .type = MT_DEVICE,
  46. }, {
  47. .virtual = (unsigned long)S5P_VA_L2CC,
  48. .pfn = __phys_to_pfn(S5PV310_PA_L2CC),
  49. .length = SZ_4K,
  50. .type = MT_DEVICE,
  51. }, {
  52. .virtual = (unsigned long)S5P_VA_GPIO1,
  53. .pfn = __phys_to_pfn(S5PV310_PA_GPIO1),
  54. .length = SZ_4K,
  55. .type = MT_DEVICE,
  56. }, {
  57. .virtual = (unsigned long)S5P_VA_GPIO2,
  58. .pfn = __phys_to_pfn(S5PV310_PA_GPIO2),
  59. .length = SZ_4K,
  60. .type = MT_DEVICE,
  61. }, {
  62. .virtual = (unsigned long)S5P_VA_GPIO3,
  63. .pfn = __phys_to_pfn(S5PV310_PA_GPIO3),
  64. .length = SZ_256,
  65. .type = MT_DEVICE,
  66. }, {
  67. .virtual = (unsigned long)S3C_VA_UART,
  68. .pfn = __phys_to_pfn(S3C_PA_UART),
  69. .length = SZ_512K,
  70. .type = MT_DEVICE,
  71. },
  72. };
  73. static void s5pv310_idle(void)
  74. {
  75. if (!need_resched())
  76. cpu_do_idle();
  77. local_irq_enable();
  78. }
  79. /* s5pv310_map_io
  80. *
  81. * register the standard cpu IO areas
  82. */
  83. void __init s5pv310_map_io(void)
  84. {
  85. iotable_init(s5pv310_iodesc, ARRAY_SIZE(s5pv310_iodesc));
  86. /* initialize device information early */
  87. s5pv310_default_sdhci0();
  88. s5pv310_default_sdhci1();
  89. s5pv310_default_sdhci2();
  90. s5pv310_default_sdhci3();
  91. }
  92. void __init s5pv310_init_clocks(int xtal)
  93. {
  94. printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
  95. s3c24xx_register_baseclocks(xtal);
  96. s5p_register_clocks(xtal);
  97. s5pv310_register_clocks();
  98. s5pv310_setup_clocks();
  99. }
  100. void __init s5pv310_init_irq(void)
  101. {
  102. int irq;
  103. gic_cpu_base_addr = S5P_VA_GIC_CPU;
  104. gic_dist_init(0, S5P_VA_GIC_DIST, IRQ_LOCALTIMER);
  105. gic_cpu_init(0, S5P_VA_GIC_CPU);
  106. for (irq = 0; irq < MAX_COMBINER_NR; irq++) {
  107. combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
  108. COMBINER_IRQ(irq, 0));
  109. combiner_cascade_irq(irq, IRQ_SPI(irq));
  110. }
  111. /* The parameters of s5p_init_irq() are for VIC init.
  112. * Theses parameters should be NULL and 0 because S5PV310
  113. * uses GIC instead of VIC.
  114. */
  115. s5p_init_irq(NULL, 0);
  116. }
  117. struct sysdev_class s5pv310_sysclass = {
  118. .name = "s5pv310-core",
  119. };
  120. static struct sys_device s5pv310_sysdev = {
  121. .cls = &s5pv310_sysclass,
  122. };
  123. static int __init s5pv310_core_init(void)
  124. {
  125. return sysdev_class_register(&s5pv310_sysclass);
  126. }
  127. core_initcall(s5pv310_core_init);
  128. int __init s5pv310_init(void)
  129. {
  130. printk(KERN_INFO "S5PV310: Initializing architecture\n");
  131. /* set idle function */
  132. pm_idle = s5pv310_idle;
  133. return sysdev_register(&s5pv310_sysdev);
  134. }