diff options
| author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2009-05-16 06:51:14 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-05-17 14:00:37 -0400 |
| commit | a8cbcd92bd4bf893085eddf7f58e63ea98503d94 (patch) | |
| tree | 7798cd1487362208793632f4ff0b4a6f579eb0ec | |
| parent | 49613d4d9ae759193915823e67de546fca58c951 (diff) | |
[ARM] smp: separate SCU support code from realview
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
| -rw-r--r-- | arch/arm/Kconfig | 7 | ||||
| -rw-r--r-- | arch/arm/include/asm/smp_scu.h | 10 | ||||
| -rw-r--r-- | arch/arm/kernel/Makefile | 1 | ||||
| -rw-r--r-- | arch/arm/kernel/smp_scu.c | 41 | ||||
| -rw-r--r-- | arch/arm/mach-realview/platsmp.c | 29 |
5 files changed, 56 insertions, 32 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ef4f860d504..f19a9519a72 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -861,6 +861,7 @@ config SMP | |||
| 861 | depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP) | 861 | depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP) |
| 862 | depends on GENERIC_CLOCKEVENTS | 862 | depends on GENERIC_CLOCKEVENTS |
| 863 | select USE_GENERIC_SMP_HELPERS | 863 | select USE_GENERIC_SMP_HELPERS |
| 864 | select HAVE_ARM_SCU if ARCH_REALVIEW | ||
| 864 | help | 865 | help |
| 865 | This enables support for systems with more than one CPU. If you have | 866 | This enables support for systems with more than one CPU. If you have |
| 866 | a system with only one CPU, like most personal computers, say N. If | 867 | a system with only one CPU, like most personal computers, say N. If |
| @@ -878,6 +879,12 @@ config SMP | |||
| 878 | 879 | ||
| 879 | If you don't know what to do here, say N. | 880 | If you don't know what to do here, say N. |
| 880 | 881 | ||
| 882 | config HAVE_ARM_SCU | ||
| 883 | bool | ||
| 884 | depends on SMP | ||
| 885 | help | ||
| 886 | This option enables support for the ARM system coherency unit | ||
| 887 | |||
| 881 | choice | 888 | choice |
| 882 | prompt "Memory split" | 889 | prompt "Memory split" |
| 883 | default VMSPLIT_3G | 890 | default VMSPLIT_3G |
diff --git a/arch/arm/include/asm/smp_scu.h b/arch/arm/include/asm/smp_scu.h index d55802d645a..2376835015d 100644 --- a/arch/arm/include/asm/smp_scu.h +++ b/arch/arm/include/asm/smp_scu.h | |||
| @@ -1,13 +1,7 @@ | |||
| 1 | #ifndef __ASMARM_ARCH_SCU_H | 1 | #ifndef __ASMARM_ARCH_SCU_H |
| 2 | #define __ASMARM_ARCH_SCU_H | 2 | #define __ASMARM_ARCH_SCU_H |
| 3 | 3 | ||
| 4 | /* | 4 | unsigned int scu_get_core_count(void __iomem *); |
| 5 | * SCU registers | 5 | void scu_enable(void __iomem *); |
| 6 | */ | ||
| 7 | #define SCU_CTRL 0x00 | ||
| 8 | #define SCU_CONFIG 0x04 | ||
| 9 | #define SCU_CPU_STATUS 0x08 | ||
| 10 | #define SCU_INVALIDATE 0x0c | ||
| 11 | #define SCU_FPGA_REVISION 0x10 | ||
| 12 | 6 | ||
| 13 | #endif | 7 | #endif |
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 11a5197a221..90ffbaf23b4 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
| @@ -22,6 +22,7 @@ obj-$(CONFIG_ARTHUR) += arthur.o | |||
| 22 | obj-$(CONFIG_ISA_DMA) += dma-isa.o | 22 | obj-$(CONFIG_ISA_DMA) += dma-isa.o |
| 23 | obj-$(CONFIG_PCI) += bios32.o isa.o | 23 | obj-$(CONFIG_PCI) += bios32.o isa.o |
| 24 | obj-$(CONFIG_SMP) += smp.o | 24 | obj-$(CONFIG_SMP) += smp.o |
| 25 | obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o | ||
| 25 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o | 26 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o |
| 26 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o | 27 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o |
| 27 | obj-$(CONFIG_KPROBES) += kprobes.o kprobes-decode.o | 28 | obj-$(CONFIG_KPROBES) += kprobes.o kprobes-decode.o |
diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c new file mode 100644 index 00000000000..7f24ee9d733 --- /dev/null +++ b/arch/arm/kernel/smp_scu.c | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/arm/kernel/smp_scu.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2002 ARM Ltd. | ||
| 5 | * All Rights Reserved | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #include <linux/init.h> | ||
| 12 | #include <linux/io.h> | ||
| 13 | |||
| 14 | #include <asm/smp_scu.h> | ||
| 15 | |||
| 16 | #define SCU_CTRL 0x00 | ||
| 17 | #define SCU_CONFIG 0x04 | ||
| 18 | #define SCU_CPU_STATUS 0x08 | ||
| 19 | #define SCU_INVALIDATE 0x0c | ||
| 20 | #define SCU_FPGA_REVISION 0x10 | ||
| 21 | |||
| 22 | /* | ||
| 23 | * Get the number of CPU cores from the SCU configuration | ||
| 24 | */ | ||
| 25 | unsigned int __init scu_get_core_count(void __iomem *scu_base) | ||
| 26 | { | ||
| 27 | unsigned int ncores = __raw_readl(scu_base + SCU_CONFIG); | ||
| 28 | return (ncores & 0x03) + 1; | ||
| 29 | } | ||
| 30 | |||
| 31 | /* | ||
| 32 | * Enable the SCU | ||
| 33 | */ | ||
| 34 | void __init scu_enable(void __iomem *scu_base) | ||
| 35 | { | ||
| 36 | u32 scu_ctrl; | ||
| 37 | |||
| 38 | scu_ctrl = __raw_readl(scu_base + SCU_CTRL); | ||
| 39 | scu_ctrl |= 1; | ||
| 40 | __raw_writel(scu_ctrl, scu_base + SCU_CTRL); | ||
| 41 | } | ||
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c index c567d3e2444..c862ce19587 100644 --- a/arch/arm/mach-realview/platsmp.c +++ b/arch/arm/mach-realview/platsmp.c | |||
| @@ -45,31 +45,12 @@ static void __iomem *scu_base_addr(void) | |||
| 45 | return (void __iomem *)0; | 45 | return (void __iomem *)0; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | static unsigned int __init get_core_count(void) | 48 | static inline unsigned int get_core_count(void) |
| 49 | { | 49 | { |
| 50 | unsigned int ncores; | ||
| 51 | void __iomem *scu_base = scu_base_addr(); | 50 | void __iomem *scu_base = scu_base_addr(); |
| 52 | 51 | if (scu_base) | |
| 53 | if (scu_base) { | 52 | return scu_get_core_count(scu_base); |
| 54 | ncores = __raw_readl(scu_base + SCU_CONFIG); | 53 | return 1; |
| 55 | ncores = (ncores & 0x03) + 1; | ||
| 56 | } else | ||
| 57 | ncores = 1; | ||
| 58 | |||
| 59 | return ncores; | ||
| 60 | } | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Setup the SCU | ||
| 64 | */ | ||
| 65 | static void scu_enable(void) | ||
| 66 | { | ||
| 67 | u32 scu_ctrl; | ||
| 68 | void __iomem *scu_base = scu_base_addr(); | ||
| 69 | |||
| 70 | scu_ctrl = __raw_readl(scu_base + SCU_CTRL); | ||
| 71 | scu_ctrl |= 1; | ||
| 72 | __raw_writel(scu_ctrl, scu_base + SCU_CTRL); | ||
| 73 | } | 54 | } |
| 74 | 55 | ||
| 75 | static DEFINE_SPINLOCK(boot_lock); | 56 | static DEFINE_SPINLOCK(boot_lock); |
| @@ -239,7 +220,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
| 239 | */ | 220 | */ |
| 240 | percpu_timer_setup(); | 221 | percpu_timer_setup(); |
| 241 | 222 | ||
| 242 | scu_enable(); | 223 | scu_enable(scu_base_addr()); |
| 243 | poke_milo(); | 224 | poke_milo(); |
| 244 | } | 225 | } |
| 245 | } | 226 | } |
