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

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

Version: ~ [ linux-5.11 ] ~ [ linux-5.10.17 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.99 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.176 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.221 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.257 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.257 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * Copyright (C) 2015 Linus Walleij
  4  */
  5 #include <linux/smp.h>
  6 #include <linux/io.h>
  7 #include <linux/of.h>
  8 #include <linux/of_address.h>
  9 #include <linux/regmap.h>
 10 #include <linux/mfd/syscon.h>
 11 
 12 #include <asm/cacheflush.h>
 13 #include <asm/smp_plat.h>
 14 #include <asm/smp_scu.h>
 15 
 16 #include <plat/platsmp.h>
 17 
 18 #define REALVIEW_SYS_FLAGSSET_OFFSET    0x30
 19 
 20 static const struct of_device_id realview_scu_match[] = {
 21         { .compatible = "arm,arm11mp-scu", },
 22         { .compatible = "arm,cortex-a9-scu", },
 23         { .compatible = "arm,cortex-a5-scu", },
 24         { }
 25 };
 26 
 27 static const struct of_device_id realview_syscon_match[] = {
 28         { .compatible = "arm,core-module-integrator", },
 29         { .compatible = "arm,realview-eb-syscon", },
 30         { .compatible = "arm,realview-pb11mp-syscon", },
 31         { .compatible = "arm,realview-pbx-syscon", },
 32         { },
 33 };
 34 
 35 static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
 36 {
 37         struct device_node *np;
 38         void __iomem *scu_base;
 39         struct regmap *map;
 40         unsigned int ncores;
 41         int i;
 42 
 43         np = of_find_matching_node(NULL, realview_scu_match);
 44         if (!np) {
 45                 pr_err("PLATSMP: No SCU base address\n");
 46                 return;
 47         }
 48         scu_base = of_iomap(np, 0);
 49         of_node_put(np);
 50         if (!scu_base) {
 51                 pr_err("PLATSMP: No SCU remap\n");
 52                 return;
 53         }
 54 
 55         scu_enable(scu_base);
 56         ncores = scu_get_core_count(scu_base);
 57         pr_info("SCU: %d cores detected\n", ncores);
 58         for (i = 0; i < ncores; i++)
 59                 set_cpu_possible(i, true);
 60         iounmap(scu_base);
 61 
 62         /* The syscon contains the magic SMP start address registers */
 63         np = of_find_matching_node(NULL, realview_syscon_match);
 64         if (!np) {
 65                 pr_err("PLATSMP: No syscon match\n");
 66                 return;
 67         }
 68         map = syscon_node_to_regmap(np);
 69         if (IS_ERR(map)) {
 70                 pr_err("PLATSMP: No syscon regmap\n");
 71                 return;
 72         }
 73         /* Put the boot address in this magic register */
 74         regmap_write(map, REALVIEW_SYS_FLAGSSET_OFFSET,
 75                      __pa_symbol(versatile_secondary_startup));
 76 }
 77 
 78 #ifdef CONFIG_HOTPLUG_CPU
 79 static void realview_cpu_die(unsigned int cpu)
 80 {
 81         return versatile_immitation_cpu_die(cpu, 0x20);
 82 }
 83 #endif
 84 
 85 static const struct smp_operations realview_dt_smp_ops __initconst = {
 86         .smp_prepare_cpus       = realview_smp_prepare_cpus,
 87         .smp_secondary_init     = versatile_secondary_init,
 88         .smp_boot_secondary     = versatile_boot_secondary,
 89 #ifdef CONFIG_HOTPLUG_CPU
 90         .cpu_die                = realview_cpu_die,
 91 #endif
 92 };
 93 CPU_METHOD_OF_DECLARE(realview_smp, "arm,realview-smp", &realview_dt_smp_ops);
 94 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp