platsmp.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * linux/arch/arm/mach-vexpress/platsmp.c
  3. *
  4. * Copyright (C) 2002 ARM Ltd.
  5. * All Rights Reserved
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/errno.h>
  13. #include <linux/smp.h>
  14. #include <linux/io.h>
  15. #include <linux/of_address.h>
  16. #include <linux/vexpress.h>
  17. #include <asm/mcpm.h>
  18. #include <asm/smp_scu.h>
  19. #include <asm/mach/map.h>
  20. #include <mach/motherboard.h>
  21. #include <plat/platsmp.h>
  22. #include "core.h"
  23. /*
  24. * Initialise the CPU possible map early - this describes the CPUs
  25. * which may be present or become present in the system.
  26. */
  27. static void __init vexpress_smp_init_cpus(void)
  28. {
  29. ct_desc->init_cpu_map();
  30. }
  31. static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus)
  32. {
  33. /*
  34. * Initialise the present map, which describes the set of CPUs
  35. * actually populated at the present time.
  36. */
  37. ct_desc->smp_enable(max_cpus);
  38. /*
  39. * Write the address of secondary startup into the
  40. * system-wide flags register. The boot monitor waits
  41. * until it receives a soft interrupt, and then the
  42. * secondary CPU branches to this address.
  43. */
  44. vexpress_flags_set(virt_to_phys(versatile_secondary_startup));
  45. }
  46. struct smp_operations __initdata vexpress_smp_ops = {
  47. .smp_init_cpus = vexpress_smp_init_cpus,
  48. .smp_prepare_cpus = vexpress_smp_prepare_cpus,
  49. .smp_secondary_init = versatile_secondary_init,
  50. .smp_boot_secondary = versatile_boot_secondary,
  51. #ifdef CONFIG_HOTPLUG_CPU
  52. .cpu_die = vexpress_cpu_die,
  53. #endif
  54. };
  55. bool __init vexpress_smp_init_ops(void)
  56. {
  57. #ifdef CONFIG_MCPM
  58. /*
  59. * The best way to detect a multi-cluster configuration at the moment
  60. * is to look for the presence of a CCI in the system.
  61. * Override the default vexpress_smp_ops if so.
  62. */
  63. struct device_node *node;
  64. node = of_find_compatible_node(NULL, NULL, "arm,cci-400");
  65. if (node && of_device_is_available(node)) {
  66. mcpm_smp_set_ops();
  67. return true;
  68. }
  69. #endif
  70. return false;
  71. }
  72. #if defined(CONFIG_OF)
  73. static const struct of_device_id vexpress_smp_dt_scu_match[] __initconst = {
  74. { .compatible = "arm,cortex-a5-scu", },
  75. { .compatible = "arm,cortex-a9-scu", },
  76. {}
  77. };
  78. static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
  79. {
  80. struct device_node *scu = of_find_matching_node(NULL,
  81. vexpress_smp_dt_scu_match);
  82. if (scu)
  83. scu_enable(of_iomap(scu, 0));
  84. /*
  85. * Write the address of secondary startup into the
  86. * system-wide flags register. The boot monitor waits
  87. * until it receives a soft interrupt, and then the
  88. * secondary CPU branches to this address.
  89. */
  90. vexpress_flags_set(virt_to_phys(versatile_secondary_startup));
  91. }
  92. struct smp_operations __initdata vexpress_smp_dt_ops = {
  93. .smp_prepare_cpus = vexpress_smp_dt_prepare_cpus,
  94. .smp_secondary_init = versatile_secondary_init,
  95. .smp_boot_secondary = versatile_boot_secondary,
  96. #ifdef CONFIG_HOTPLUG_CPU
  97. .cpu_die = vexpress_cpu_die,
  98. #endif
  99. };
  100. #endif