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

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-versatile/platsmp-realview.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  * 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 "platsmp.h"
 17 
 18 #define REALVIEW_SYS_FLAGSSET_OFFSET    0x30
 19 
 20 static const struct of_device_id realview_scu_match[] = {
 21         /*
 22          * The ARM11MP SCU compatible is only provided as fallback for
 23          * old RealView EB Cortex-A9 device trees that were using this
 24          * compatible by mistake.
 25          */
 26         { .compatible = "arm,arm11mp-scu", },
 27         { .compatible = "arm,cortex-a9-scu", },
 28         { .compatible = "arm,cortex-a5-scu", },
 29         { }
 30 };
 31 
 32 static const struct of_device_id realview_syscon_match[] = {
 33         { .compatible = "arm,core-module-integrator", },
 34         { .compatible = "arm,realview-eb-syscon", },
 35         { .compatible = "arm,realview-pbx-syscon", },
 36         { },
 37 };
 38 
 39 static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
 40 {
 41         struct device_node *np;
 42         void __iomem *scu_base;
 43         struct regmap *map;
 44         unsigned int ncores;
 45         int i;
 46 
 47         np = of_find_matching_node(NULL, realview_scu_match);
 48         if (!np) {
 49                 pr_err("PLATSMP: No SCU base address\n");
 50                 return;
 51         }
 52         scu_base = of_iomap(np, 0);
 53         of_node_put(np);
 54         if (!scu_base) {
 55                 pr_err("PLATSMP: No SCU remap\n");
 56                 return;
 57         }
 58 
 59         scu_enable(scu_base);
 60         ncores = scu_get_core_count(scu_base);
 61         pr_info("SCU: %d cores detected\n", ncores);
 62         for (i = 0; i < ncores; i++)
 63                 set_cpu_possible(i, true);
 64         iounmap(scu_base);
 65 
 66         /* The syscon contains the magic SMP start address registers */
 67         np = of_find_matching_node(NULL, realview_syscon_match);
 68         if (!np) {
 69                 pr_err("PLATSMP: No syscon match\n");
 70                 return;
 71         }
 72         map = syscon_node_to_regmap(np);
 73         of_node_put(np);
 74         if (IS_ERR(map)) {
 75                 pr_err("PLATSMP: No syscon regmap\n");
 76                 return;
 77         }
 78         /* Put the boot address in this magic register */
 79         regmap_write(map, REALVIEW_SYS_FLAGSSET_OFFSET,
 80                      __pa_symbol(versatile_secondary_startup));
 81 }
 82 
 83 #ifdef CONFIG_HOTPLUG_CPU
 84 static void realview_cpu_die(unsigned int cpu)
 85 {
 86         return versatile_immitation_cpu_die(cpu, 0x20);
 87 }
 88 #endif
 89 
 90 static const struct smp_operations realview_dt_smp_ops __initconst = {
 91         .smp_prepare_cpus       = realview_smp_prepare_cpus,
 92         .smp_secondary_init     = versatile_secondary_init,
 93         .smp_boot_secondary     = versatile_boot_secondary,
 94 #ifdef CONFIG_HOTPLUG_CPU
 95         .cpu_die                = realview_cpu_die,
 96 #endif
 97 };
 98 CPU_METHOD_OF_DECLARE(realview_smp, "arm,realview-smp", &realview_dt_smp_ops);
 99 

~ [ 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