~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-axxia/platsmp.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * linux/arch/arm/mach-axxia/platsmp.c
  4  *
  5  * Copyright (C) 2012 LSI Corporation
  6  */
  7 
  8 #include <linux/init.h>
  9 #include <linux/io.h>
 10 #include <linux/smp.h>
 11 #include <linux/of.h>
 12 #include <linux/of_address.h>
 13 #include <asm/cacheflush.h>
 14 
 15 /* Syscon register offsets for releasing cores from reset */
 16 #define SC_CRIT_WRITE_KEY       0x1000
 17 #define SC_RST_CPU_HOLD         0x1010
 18 
 19 /*
 20  * Write the kernel entry point for secondary CPUs to the specified address
 21  */
 22 static void write_release_addr(u32 release_phys)
 23 {
 24         u32 *virt = (u32 *) phys_to_virt(release_phys);
 25         writel_relaxed(__pa_symbol(secondary_startup), virt);
 26         /* Make sure this store is visible to other CPUs */
 27         smp_wmb();
 28         __cpuc_flush_dcache_area(virt, sizeof(u32));
 29 }
 30 
 31 static int axxia_boot_secondary(unsigned int cpu, struct task_struct *idle)
 32 {
 33         struct device_node *syscon_np;
 34         void __iomem *syscon;
 35         u32 tmp;
 36 
 37         syscon_np = of_find_compatible_node(NULL, NULL, "lsi,axxia-syscon");
 38         if (!syscon_np)
 39                 return -ENOENT;
 40 
 41         syscon = of_iomap(syscon_np, 0);
 42         of_node_put(syscon_np);
 43         if (!syscon)
 44                 return -ENOMEM;
 45 
 46         tmp = readl(syscon + SC_RST_CPU_HOLD);
 47         writel(0xab, syscon + SC_CRIT_WRITE_KEY);
 48         tmp &= ~(1 << cpu);
 49         writel(tmp, syscon + SC_RST_CPU_HOLD);
 50 
 51         return 0;
 52 }
 53 
 54 static void __init axxia_smp_prepare_cpus(unsigned int max_cpus)
 55 {
 56         int cpu_count = 0;
 57         int cpu;
 58 
 59         /*
 60          * Initialise the present map, which describes the set of CPUs actually
 61          * populated at the present time.
 62          */
 63         for_each_possible_cpu(cpu) {
 64                 struct device_node *np;
 65                 u32 release_phys;
 66 
 67                 np = of_get_cpu_node(cpu, NULL);
 68                 if (!np)
 69                         continue;
 70                 if (of_property_read_u32(np, "cpu-release-addr", &release_phys))
 71                         continue;
 72 
 73                 if (cpu_count < max_cpus) {
 74                         set_cpu_present(cpu, true);
 75                         cpu_count++;
 76                 }
 77 
 78                 if (release_phys != 0)
 79                         write_release_addr(release_phys);
 80         }
 81 }
 82 
 83 static const struct smp_operations axxia_smp_ops __initconst = {
 84         .smp_prepare_cpus       = axxia_smp_prepare_cpus,
 85         .smp_boot_secondary     = axxia_boot_secondary,
 86 };
 87 CPU_METHOD_OF_DECLARE(axxia_smp, "lsi,syscon-release", &axxia_smp_ops);
 88 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php