platsmp-a9.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Symmetric Multi Processing (SMP) support for Marvell EBU Cortex-A9
  3. * based SOCs (Armada 375/38x).
  4. *
  5. * Copyright (C) 2014 Marvell
  6. *
  7. * Gregory CLEMENT <gregory.clement@free-electrons.com>
  8. * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  9. *
  10. * This file is licensed under the terms of the GNU General Public
  11. * License version 2. This program is licensed "as is" without any
  12. * warranty of any kind, whether express or implied.
  13. */
  14. #include <linux/init.h>
  15. #include <linux/io.h>
  16. #include <linux/of.h>
  17. #include <linux/smp.h>
  18. #include <linux/mbus.h>
  19. #include <asm/smp_scu.h>
  20. #include <asm/smp_plat.h>
  21. #include "common.h"
  22. #include "pmsu.h"
  23. extern void mvebu_cortex_a9_secondary_startup(void);
  24. static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
  25. struct task_struct *idle)
  26. {
  27. int ret, hw_cpu;
  28. pr_info("Booting CPU %d\n", cpu);
  29. /*
  30. * Write the address of secondary startup into the system-wide
  31. * flags register. The boot monitor waits until it receives a
  32. * soft interrupt, and then the secondary CPU branches to this
  33. * address.
  34. */
  35. hw_cpu = cpu_logical_map(cpu);
  36. if (of_machine_is_compatible("marvell,armada375"))
  37. mvebu_system_controller_set_cpu_boot_addr(mvebu_cortex_a9_secondary_startup);
  38. else
  39. mvebu_pmsu_set_cpu_boot_addr(hw_cpu, mvebu_cortex_a9_secondary_startup);
  40. smp_wmb();
  41. ret = mvebu_cpu_reset_deassert(hw_cpu);
  42. if (ret) {
  43. pr_err("Could not start the secondary CPU: %d\n", ret);
  44. return ret;
  45. }
  46. arch_send_wakeup_ipi_mask(cpumask_of(cpu));
  47. return 0;
  48. }
  49. static struct smp_operations mvebu_cortex_a9_smp_ops __initdata = {
  50. .smp_boot_secondary = mvebu_cortex_a9_boot_secondary,
  51. };
  52. CPU_METHOD_OF_DECLARE(mvebu_armada_375_smp, "marvell,armada-375-smp",
  53. &mvebu_cortex_a9_smp_ops);
  54. CPU_METHOD_OF_DECLARE(mvebu_armada_380_smp, "marvell,armada-380-smp",
  55. &mvebu_cortex_a9_smp_ops);