platsmp.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Keystone SOC SMP platform code
  3. *
  4. * Copyright 2013 Texas Instruments, Inc.
  5. * Cyril Chemparathy <cyril@ti.com>
  6. * Santosh Shilimkar <santosh.shillimkar@ti.com>
  7. *
  8. * Based on platsmp.c, Copyright (C) 2002 ARM Ltd.
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms and conditions of the GNU General Public License,
  12. * version 2, as published by the Free Software Foundation.
  13. */
  14. #include <linux/init.h>
  15. #include <linux/smp.h>
  16. #include <linux/io.h>
  17. #include <asm/smp_plat.h>
  18. #include <asm/prom.h>
  19. #include <asm/tlbflush.h>
  20. #include <asm/pgtable.h>
  21. #include "keystone.h"
  22. static int keystone_smp_boot_secondary(unsigned int cpu,
  23. struct task_struct *idle)
  24. {
  25. unsigned long start = virt_to_idmap(&secondary_startup);
  26. int error;
  27. pr_debug("keystone-smp: booting cpu %d, vector %08lx\n",
  28. cpu, start);
  29. error = keystone_cpu_smc(KEYSTONE_MON_CPU_UP_IDX, cpu, start);
  30. if (error)
  31. pr_err("CPU %d bringup failed with %d\n", cpu, error);
  32. return error;
  33. }
  34. #ifdef CONFIG_ARM_LPAE
  35. static void __cpuinit keystone_smp_secondary_initmem(unsigned int cpu)
  36. {
  37. pgd_t *pgd0 = pgd_offset_k(0);
  38. cpu_set_ttbr(1, __pa(pgd0) + TTBR1_OFFSET);
  39. local_flush_tlb_all();
  40. }
  41. #else
  42. static inline void __cpuinit keystone_smp_secondary_initmem(unsigned int cpu)
  43. {}
  44. #endif
  45. struct smp_operations keystone_smp_ops __initdata = {
  46. .smp_boot_secondary = keystone_smp_boot_secondary,
  47. .smp_secondary_init = keystone_smp_secondary_initmem,
  48. };