From a8cbcd92bd4bf893085eddf7f58e63ea98503d94 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 16 May 2009 11:51:14 +0100 Subject: [ARM] smp: separate SCU support code from realview Signed-off-by: Russell King --- arch/arm/kernel/smp_scu.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 arch/arm/kernel/smp_scu.c (limited to 'arch/arm/kernel/smp_scu.c') diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c new file mode 100644 index 000000000000..7f24ee9d7330 --- /dev/null +++ b/arch/arm/kernel/smp_scu.c @@ -0,0 +1,41 @@ +/* + * linux/arch/arm/kernel/smp_scu.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 + +#define SCU_CTRL 0x00 +#define SCU_CONFIG 0x04 +#define SCU_CPU_STATUS 0x08 +#define SCU_INVALIDATE 0x0c +#define SCU_FPGA_REVISION 0x10 + +/* + * Get the number of CPU cores from the SCU configuration + */ +unsigned int __init scu_get_core_count(void __iomem *scu_base) +{ + unsigned int ncores = __raw_readl(scu_base + SCU_CONFIG); + return (ncores & 0x03) + 1; +} + +/* + * Enable the SCU + */ +void __init scu_enable(void __iomem *scu_base) +{ + u32 scu_ctrl; + + scu_ctrl = __raw_readl(scu_base + SCU_CTRL); + scu_ctrl |= 1; + __raw_writel(scu_ctrl, scu_base + SCU_CTRL); +} -- cgit v1.2.3 From af73110d23fb54f940197d93a410e9fa0cee66e2 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Mon, 18 May 2009 16:26:27 +0100 Subject: [ARM] 5516/1: Flush the D-cache after initialising the SCU On MP systems, the data loaded by CPU0 before the SCU was initialised may not be visible to the other CPUs. Signed-off-by: Catalin Marinas Signed-off-by: Russell King This also includes the following compile fix: This patch includes 'asm/cacheflush.h' which is needed to use 'flush_cache_all()' function. Signed-off-by: Santosh Shilimkar Signed-off-by: Russell King --- arch/arm/kernel/smp_scu.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'arch/arm/kernel/smp_scu.c') diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c index 7f24ee9d7330..d3831f616ee9 100644 --- a/arch/arm/kernel/smp_scu.c +++ b/arch/arm/kernel/smp_scu.c @@ -12,6 +12,7 @@ #include #include +#include #define SCU_CTRL 0x00 #define SCU_CONFIG 0x04 @@ -38,4 +39,10 @@ void __init scu_enable(void __iomem *scu_base) scu_ctrl = __raw_readl(scu_base + SCU_CTRL); scu_ctrl |= 1; __raw_writel(scu_ctrl, scu_base + SCU_CTRL); + + /* + * Ensure that the data accessed by CPU0 before the SCU was + * initialised is visible to the other CPUs. + */ + flush_cache_all(); } -- cgit v1.2.3