platsmp.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 <plat/platsmp.h>
  21. #include "core.h"
  22. bool __init vexpress_smp_init_ops(void)
  23. {
  24. #ifdef CONFIG_MCPM
  25. /*
  26. * The best way to detect a multi-cluster configuration at the moment
  27. * is to look for the presence of a CCI in the system.
  28. * Override the default vexpress_smp_ops if so.
  29. */
  30. struct device_node *node;
  31. node = of_find_compatible_node(NULL, NULL, "arm,cci-400");
  32. if (node && of_device_is_available(node)) {
  33. mcpm_smp_set_ops();
  34. return true;
  35. }
  36. #endif
  37. return false;
  38. }
  39. static const struct of_device_id vexpress_smp_dt_scu_match[] __initconst = {
  40. { .compatible = "arm,cortex-a5-scu", },
  41. { .compatible = "arm,cortex-a9-scu", },
  42. {}
  43. };
  44. static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
  45. {
  46. struct device_node *scu = of_find_matching_node(NULL,
  47. vexpress_smp_dt_scu_match);
  48. if (scu)
  49. scu_enable(of_iomap(scu, 0));
  50. /*
  51. * Write the address of secondary startup into the
  52. * system-wide flags register. The boot monitor waits
  53. * until it receives a soft interrupt, and then the
  54. * secondary CPU branches to this address.
  55. */
  56. vexpress_flags_set(virt_to_phys(versatile_secondary_startup));
  57. }
  58. const struct smp_operations vexpress_smp_dt_ops __initconst = {
  59. .smp_prepare_cpus = vexpress_smp_dt_prepare_cpus,
  60. .smp_secondary_init = versatile_secondary_init,
  61. .smp_boot_secondary = versatile_boot_secondary,
  62. #ifdef CONFIG_HOTPLUG_CPU
  63. .cpu_die = vexpress_cpu_die,
  64. #endif
  65. };