platsmp.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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/localtimer.h>
  20. #include <asm/mach-types.h>
  21. #include <mach/common.h>
  22. static unsigned int __init shmobile_smp_get_core_count(void)
  23. {
  24. if (machine_is_ag5evm())
  25. return sh73a0_get_core_count();
  26. return 1;
  27. }
  28. static void __init shmobile_smp_prepare_cpus(void)
  29. {
  30. if (machine_is_ag5evm())
  31. sh73a0_smp_prepare_cpus();
  32. }
  33. void __cpuinit platform_secondary_init(unsigned int cpu)
  34. {
  35. trace_hardirqs_off();
  36. if (machine_is_ag5evm())
  37. sh73a0_secondary_init(cpu);
  38. }
  39. int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
  40. {
  41. if (machine_is_ag5evm())
  42. return sh73a0_boot_secondary(cpu);
  43. return -ENOSYS;
  44. }
  45. void __init smp_init_cpus(void)
  46. {
  47. unsigned int ncores = shmobile_smp_get_core_count();
  48. unsigned int i;
  49. for (i = 0; i < ncores; i++)
  50. set_cpu_possible(i, true);
  51. }
  52. void __init platform_smp_prepare_cpus(unsigned int max_cpus)
  53. {
  54. int i;
  55. for (i = 0; i < max_cpus; i++)
  56. set_cpu_present(i, true);
  57. shmobile_smp_prepare_cpus();
  58. }