platsmp.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * SMP support for R-Mobile / SH-Mobile
  3. *
  4. * Copyright (C) 2010 Magnus Damm
  5. * Copyright (C) 2011 Paul Mundt
  6. *
  7. * Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/init.h>
  14. #include <linux/errno.h>
  15. #include <linux/delay.h>
  16. #include <linux/device.h>
  17. #include <linux/smp.h>
  18. #include <linux/io.h>
  19. #include <asm/hardware/gic.h>
  20. #include <asm/localtimer.h>
  21. #include <asm/mach-types.h>
  22. #include <mach/common.h>
  23. static unsigned int __init shmobile_smp_get_core_count(void)
  24. {
  25. if (machine_is_ag5evm())
  26. return sh73a0_get_core_count();
  27. return 1;
  28. }
  29. static void __init shmobile_smp_prepare_cpus(void)
  30. {
  31. if (machine_is_ag5evm())
  32. sh73a0_smp_prepare_cpus();
  33. }
  34. void __cpuinit platform_secondary_init(unsigned int cpu)
  35. {
  36. trace_hardirqs_off();
  37. if (machine_is_ag5evm())
  38. sh73a0_secondary_init(cpu);
  39. }
  40. int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
  41. {
  42. if (machine_is_ag5evm())
  43. return sh73a0_boot_secondary(cpu);
  44. return -ENOSYS;
  45. }
  46. void __init smp_init_cpus(void)
  47. {
  48. unsigned int ncores = shmobile_smp_get_core_count();
  49. unsigned int i;
  50. for (i = 0; i < ncores; i++)
  51. set_cpu_possible(i, true);
  52. set_smp_cross_call(gic_raise_softirq);
  53. }
  54. void __init platform_smp_prepare_cpus(unsigned int max_cpus)
  55. {
  56. int i;
  57. for (i = 0; i < max_cpus; i++)
  58. set_cpu_present(i, true);
  59. shmobile_smp_prepare_cpus();
  60. }