smp-r8a7791.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * SMP support for r8a7791
  3. *
  4. * Copyright (C) 2013 Renesas Solutions Corp.
  5. * Copyright (C) 2013 Magnus Damm
  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 as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/init.h>
  18. #include <linux/smp.h>
  19. #include <linux/io.h>
  20. #include <asm/smp_plat.h>
  21. #include <mach/common.h>
  22. #include <mach/r8a7791.h>
  23. #define RST 0xe6160000
  24. #define CA15BAR 0x0020
  25. #define CA15RESCNT 0x0040
  26. #define RAM 0xe6300000
  27. static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
  28. {
  29. void __iomem *p;
  30. u32 bar;
  31. /* let APMU code install data related to shmobile_boot_vector */
  32. shmobile_smp_apmu_prepare_cpus(max_cpus);
  33. /* RAM for jump stub, because BAR requires 256KB aligned address */
  34. p = ioremap_nocache(RAM, shmobile_boot_size);
  35. memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
  36. iounmap(p);
  37. /* setup reset vectors */
  38. p = ioremap_nocache(RST, 0x63);
  39. bar = (RAM >> 8) & 0xfffffc00;
  40. writel_relaxed(bar, p + CA15BAR);
  41. writel_relaxed(bar | 0x10, p + CA15BAR);
  42. /* enable clocks to all CPUs */
  43. writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
  44. p + CA15RESCNT);
  45. iounmap(p);
  46. }
  47. struct smp_operations r8a7791_smp_ops __initdata = {
  48. .smp_prepare_cpus = r8a7791_smp_prepare_cpus,
  49. .smp_boot_secondary = shmobile_smp_apmu_boot_secondary,
  50. #ifdef CONFIG_HOTPLUG_CPU
  51. .cpu_disable = shmobile_smp_cpu_disable,
  52. .cpu_die = shmobile_smp_apmu_cpu_die,
  53. .cpu_kill = shmobile_smp_apmu_cpu_kill,
  54. #endif
  55. };