From 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 Mon Sep 17 00:00:00 2001 From: Yunhong Jiang Date: Tue, 4 Aug 2015 12:17:53 -0700 Subject: Add the rt linux 4.1.3-rt3 as base Import the rt linux 4.1.3-rt3 as OPNFV kvm base. It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and the base is: commit 0917f823c59692d751951bf5ea699a2d1e2f26a2 Author: Sebastian Andrzej Siewior Date: Sat Jul 25 12:13:34 2015 +0200 Prepare v4.1.3-rt3 Signed-off-by: Sebastian Andrzej Siewior We lose all the git history this way and it's not good. We should apply another opnfv project repo in future. Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423 Signed-off-by: Yunhong Jiang --- kernel/arch/arm/mach-sti/Kconfig | 56 +++++++++++++++++ kernel/arch/arm/mach-sti/Makefile | 2 + kernel/arch/arm/mach-sti/board-dt.c | 34 +++++++++++ kernel/arch/arm/mach-sti/headsmp.S | 42 +++++++++++++ kernel/arch/arm/mach-sti/platsmp.c | 116 ++++++++++++++++++++++++++++++++++++ kernel/arch/arm/mach-sti/smp.h | 17 ++++++ 6 files changed, 267 insertions(+) create mode 100644 kernel/arch/arm/mach-sti/Kconfig create mode 100644 kernel/arch/arm/mach-sti/Makefile create mode 100644 kernel/arch/arm/mach-sti/board-dt.c create mode 100644 kernel/arch/arm/mach-sti/headsmp.S create mode 100644 kernel/arch/arm/mach-sti/platsmp.c create mode 100644 kernel/arch/arm/mach-sti/smp.h (limited to 'kernel/arch/arm/mach-sti') diff --git a/kernel/arch/arm/mach-sti/Kconfig b/kernel/arch/arm/mach-sti/Kconfig new file mode 100644 index 000000000..3b1ac463a --- /dev/null +++ b/kernel/arch/arm/mach-sti/Kconfig @@ -0,0 +1,56 @@ +menuconfig ARCH_STI + bool "STMicroelectronics Consumer Electronics SOCs" if ARCH_MULTI_V7 + select ARM_GIC + select ARM_GLOBAL_TIMER + select PINCTRL + select PINCTRL_ST + select MFD_SYSCON + select ARCH_HAS_RESET_CONTROLLER + select HAVE_ARM_SCU if SMP + select ARCH_REQUIRE_GPIOLIB + select ARM_ERRATA_754322 + select ARM_ERRATA_764369 if SMP + select ARM_ERRATA_775420 + select PL310_ERRATA_753970 if CACHE_L2X0 + select PL310_ERRATA_769419 if CACHE_L2X0 + select RESET_CONTROLLER + help + Include support for STiH41x SOCs like STiH415/416 using the device tree + for discovery + More information at Documentation/arm/STiH41x and + at Documentation/devicetree + + +if ARCH_STI + +config SOC_STIH415 + bool "STiH415 STMicroelectronics Consumer Electronics family" + default y + select STIH415_RESET + help + This enables support for STMicroelectronics Digital Consumer + Electronics family StiH415 parts, primarily targeted at set-top-box + and other digital audio/video applications using Flattned Device + Trees. + +config SOC_STIH416 + bool "STiH416 STMicroelectronics Consumer Electronics family" + default y + select STIH416_RESET + help + This enables support for STMicroelectronics Digital Consumer + Electronics family StiH416 parts, primarily targeted at set-top-box + and other digital audio/video applications using Flattened Device + Trees. + +config SOC_STIH407 + bool "STiH407 STMicroelectronics Consumer Electronics family" + default y + select STIH407_RESET + help + This enables support for STMicroelectronics Digital Consumer + Electronics family StiH407 parts, targetted at set-top-box + and other digital audio/video applications using Flattened Device + Trees. + +endif diff --git a/kernel/arch/arm/mach-sti/Makefile b/kernel/arch/arm/mach-sti/Makefile new file mode 100644 index 000000000..acb330916 --- /dev/null +++ b/kernel/arch/arm/mach-sti/Makefile @@ -0,0 +1,2 @@ +obj-$(CONFIG_SMP) += platsmp.o headsmp.o +obj-$(CONFIG_ARCH_STI) += board-dt.o diff --git a/kernel/arch/arm/mach-sti/board-dt.c b/kernel/arch/arm/mach-sti/board-dt.c new file mode 100644 index 000000000..b373acade --- /dev/null +++ b/kernel/arch/arm/mach-sti/board-dt.c @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2013 STMicroelectronics (R&D) Limited. + * Author(s): Srinivas Kandagatla + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include + +#include "smp.h" + +static const char *stih41x_dt_match[] __initdata = { + "st,stih415", + "st,stih416", + "st,stih407", + "st,stih410", + "st,stih418", + NULL +}; + +DT_MACHINE_START(STM, "STiH415/416 SoC with Flattened Device Tree") + .dt_compat = stih41x_dt_match, + .l2c_aux_val = L2C_AUX_CTRL_SHARED_OVERRIDE | + L310_AUX_CTRL_DATA_PREFETCH | + L310_AUX_CTRL_INSTR_PREFETCH | + L2C_AUX_CTRL_WAY_SIZE(4), + .l2c_aux_mask = 0xc0000fff, + .smp = smp_ops(sti_smp_ops), +MACHINE_END diff --git a/kernel/arch/arm/mach-sti/headsmp.S b/kernel/arch/arm/mach-sti/headsmp.S new file mode 100644 index 000000000..4c09bae86 --- /dev/null +++ b/kernel/arch/arm/mach-sti/headsmp.S @@ -0,0 +1,42 @@ +/* + * arch/arm/mach-sti/headsmp.S + * + * Copyright (C) 2013 STMicroelectronics (R&D) Limited. + * http://www.st.com + * + * Cloned from linux/arch/arm/mach-vexpress/headsmp.S + * + * Copyright (c) 2003 ARM Limited + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include + +/* + * ST specific entry point for secondary CPUs. This provides + * a "holding pen" into which all secondary cores are held until we're + * ready for them to initialise. + */ +ENTRY(sti_secondary_startup) + mrc p15, 0, r0, c0, c0, 5 + and r0, r0, #15 + adr r4, 1f + ldmia r4, {r5, r6} + sub r4, r4, r5 + add r6, r6, r4 +pen: ldr r7, [r6] + cmp r7, r0 + bne pen + + /* + * we've been released from the holding pen: secondary_stack + * should now contain the SVC stack for this core + */ + b secondary_startup + +1: .long . + .long pen_release diff --git a/kernel/arch/arm/mach-sti/platsmp.c b/kernel/arch/arm/mach-sti/platsmp.c new file mode 100644 index 000000000..56d402812 --- /dev/null +++ b/kernel/arch/arm/mach-sti/platsmp.c @@ -0,0 +1,116 @@ +/* + * arch/arm/mach-sti/platsmp.c + * + * Copyright (C) 2013 STMicroelectronics (R&D) Limited. + * http://www.st.com + * + * Cloned from linux/arch/arm/mach-vexpress/platsmp.c + * + * Copyright (C) 2002 ARM Ltd. + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "smp.h" + +static void write_pen_release(int val) +{ + pen_release = val; + smp_wmb(); + sync_cache_w(&pen_release); +} + +static DEFINE_RAW_SPINLOCK(boot_lock); + +static void sti_secondary_init(unsigned int cpu) +{ + trace_hardirqs_off(); + + /* + * let the primary processor know we're out of the + * pen, then head off into the C entry point + */ + write_pen_release(-1); + + /* + * Synchronise with the boot thread. + */ + raw_spin_lock(&boot_lock); + raw_spin_unlock(&boot_lock); +} + +static int sti_boot_secondary(unsigned int cpu, struct task_struct *idle) +{ + unsigned long timeout; + + /* + * set synchronisation state between this boot processor + * and the secondary one + */ + raw_spin_lock(&boot_lock); + + /* + * The secondary processor is waiting to be released from + * the holding pen - release it, then wait for it to flag + * that it has been released by resetting pen_release. + * + * Note that "pen_release" is the hardware CPU ID, whereas + * "cpu" is Linux's internal ID. + */ + write_pen_release(cpu_logical_map(cpu)); + + /* + * Send the secondary CPU a soft interrupt, thereby causing + * it to jump to the secondary entrypoint. + */ + arch_send_wakeup_ipi_mask(cpumask_of(cpu)); + + timeout = jiffies + (1 * HZ); + while (time_before(jiffies, timeout)) { + smp_rmb(); + if (pen_release == -1) + break; + + udelay(10); + } + + /* + * now the secondary core is starting up let it run its + * calibrations, then wait for it to finish + */ + raw_spin_unlock(&boot_lock); + + return pen_release != -1 ? -ENOSYS : 0; +} + +static void __init sti_smp_prepare_cpus(unsigned int max_cpus) +{ + void __iomem *scu_base = NULL; + struct device_node *np = of_find_compatible_node( + NULL, NULL, "arm,cortex-a9-scu"); + if (np) { + scu_base = of_iomap(np, 0); + scu_enable(scu_base); + of_node_put(np); + } +} + +struct smp_operations __initdata sti_smp_ops = { + .smp_prepare_cpus = sti_smp_prepare_cpus, + .smp_secondary_init = sti_secondary_init, + .smp_boot_secondary = sti_boot_secondary, +}; diff --git a/kernel/arch/arm/mach-sti/smp.h b/kernel/arch/arm/mach-sti/smp.h new file mode 100644 index 000000000..1871b72b1 --- /dev/null +++ b/kernel/arch/arm/mach-sti/smp.h @@ -0,0 +1,17 @@ +/* + * arch/arm/mach-sti/smp.h + * + * Copyright (C) 2013 STMicroelectronics (R&D) Limited. + * http://www.st.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __MACH_STI_SMP_H +#define __MACH_STI_SMP_H + +extern struct smp_operations sti_smp_ops; + +#endif -- cgit 1.2.3-korg