platsmp.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright 2011 Freescale Semiconductor, Inc.
  3. * Copyright 2011 Linaro Ltd.
  4. *
  5. * The code contained herein is licensed under the GNU General Public
  6. * License. You may obtain a copy of the GNU General Public License
  7. * Version 2 or later at the following locations:
  8. *
  9. * http://www.opensource.org/licenses/gpl-license.html
  10. * http://www.gnu.org/copyleft/gpl.html
  11. */
  12. #include <linux/init.h>
  13. #include <linux/smp.h>
  14. #include <asm/page.h>
  15. #include <asm/smp_scu.h>
  16. #include <asm/hardware/gic.h>
  17. #include <asm/mach/map.h>
  18. #include <mach/common.h>
  19. #include <mach/hardware.h>
  20. static void __iomem *scu_base;
  21. static struct map_desc scu_io_desc __initdata = {
  22. /* .virtual and .pfn are run-time assigned */
  23. .length = SZ_4K,
  24. .type = MT_DEVICE,
  25. };
  26. void __init imx_scu_map_io(void)
  27. {
  28. unsigned long base;
  29. /* Get SCU base */
  30. asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base));
  31. scu_io_desc.virtual = IMX_IO_P2V(base);
  32. scu_io_desc.pfn = __phys_to_pfn(base);
  33. iotable_init(&scu_io_desc, 1);
  34. scu_base = IMX_IO_ADDRESS(base);
  35. }
  36. void __cpuinit platform_secondary_init(unsigned int cpu)
  37. {
  38. /*
  39. * if any interrupts are already enabled for the primary
  40. * core (e.g. timer irq), then they will not have been enabled
  41. * for us: do so
  42. */
  43. gic_secondary_init(0);
  44. }
  45. int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
  46. {
  47. imx_set_cpu_jump(cpu, v7_secondary_startup);
  48. imx_enable_cpu(cpu, true);
  49. return 0;
  50. }
  51. /*
  52. * Initialise the CPU possible map early - this describes the CPUs
  53. * which may be present or become present in the system.
  54. */
  55. void __init smp_init_cpus(void)
  56. {
  57. int i, ncores;
  58. ncores = scu_get_core_count(scu_base);
  59. for (i = 0; i < ncores; i++)
  60. set_cpu_possible(i, true);
  61. set_smp_cross_call(gic_raise_softirq);
  62. }
  63. void imx_smp_prepare(void)
  64. {
  65. scu_enable(scu_base);
  66. }
  67. void __init platform_smp_prepare_cpus(unsigned int max_cpus)
  68. {
  69. imx_smp_prepare();
  70. }