aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-06 15:39:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-06 15:39:39 -0400
commit7644a448ccf200d95ad4426e84a486dec5cc1703 (patch)
tree2743ee79bd0b42b96c4c2d6f7194e2e2ccfc8572
parent16984ce15ea43e17d964ece55ce336a8a4f40750 (diff)
parentc20eb0f1d0918c019fb2674a104e6ab59d8e62ac (diff)
Merge tag 'metag-for-v3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag
Pull Metag architecture changes from James Hogan: - Infrastructure and DT files for TZ1090 SoC (pin control drivers already merged via pinctrl tree). - Panic on boot instead of just warning if cache aliasing possible. - Various SMP/hotplug fixes. - Various other randconfig/sparse fixes. * tag 'metag-for-v3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag: (24 commits) metag: move EXPORT_SYMBOL(csum_partial) to metag_ksyms.c metag: cpu hotplug: route_irq: preserve irq mask metag: kick: add missing irq_enter/exit to kick_handler() metag: smp: don't spin waiting for CPU to start metag: smp: enable irqs after set_cpu_online metag: use clear_tasks_mm_cpumask() metag: tz1090: select and instantiate pinctrl-tz1090-pdc metag: tz1090: select and instantiate pinctrl-tz1090 metag: don't check for cache aliasing on smp cpu boot metag: panic if cache aliasing possible metag: *.dts: include using preprocessor metag: add <dt-bindings/> symlink metag/.gitignore: Extend the *.dtb pattern to match the dtb.S files metag/traps: include setup.h for the per_cpu_trap_init declaration metag/traps: Mark die() as __noreturn to match the declaration. metag/processor.h: Add missing cpuinfo_op declaration. metag/setup: Restrict scope for the capabilities variable metag/mm/cache: Restrict scope for metag_lnkget_probe metag/asm/irq.h: Declare init_IRQ metag/kernel/irq.c: Declare root_domain as static ...
-rw-r--r--Documentation/devicetree/bindings/metag/meta.txt30
-rw-r--r--Documentation/devicetree/bindings/vendor-prefixes.txt1
-rw-r--r--arch/metag/Kconfig.soc12
-rw-r--r--arch/metag/Makefile2
-rw-r--r--arch/metag/boot/.gitignore2
-rw-r--r--arch/metag/boot/dts/Makefile2
l---------arch/metag/boot/dts/include/dt-bindings1
-rw-r--r--arch/metag/boot/dts/skeleton.dts2
-rw-r--r--arch/metag/boot/dts/tz1090.dtsi41
-rw-r--r--arch/metag/boot/dts/tz1090_generic.dts10
-rw-r--r--arch/metag/configs/tz1090_defconfig42
-rw-r--r--arch/metag/include/asm/bug.h4
-rw-r--r--arch/metag/include/asm/clock.h8
-rw-r--r--arch/metag/include/asm/irq.h1
-rw-r--r--arch/metag/include/asm/processor.h2
-rw-r--r--arch/metag/kernel/cachepart.c13
-rw-r--r--arch/metag/kernel/clock.c59
-rw-r--r--arch/metag/kernel/irq.c7
-rw-r--r--arch/metag/kernel/kick.c9
-rw-r--r--arch/metag/kernel/metag_ksyms.c5
-rw-r--r--arch/metag/kernel/setup.c16
-rw-r--r--arch/metag/kernel/smp.c35
-rw-r--r--arch/metag/kernel/time.c14
-rw-r--r--arch/metag/kernel/traps.c5
-rw-r--r--arch/metag/lib/checksum.c1
-rw-r--r--arch/metag/mm/cache.c2
-rw-r--r--drivers/clocksource/metag_generic.c2
27 files changed, 276 insertions, 52 deletions
diff --git a/Documentation/devicetree/bindings/metag/meta.txt b/Documentation/devicetree/bindings/metag/meta.txt
new file mode 100644
index 000000000000..f4457f57ab08
--- /dev/null
+++ b/Documentation/devicetree/bindings/metag/meta.txt
@@ -0,0 +1,30 @@
1* Meta Processor Binding
2
3This binding specifies what properties must be available in the device tree
4representation of a Meta Processor Core, which is the root node in the tree.
5
6Required properties:
7
8 - compatible: Specifies the compatibility list for the Meta processor.
9 The type shall be <string> and the value shall include "img,meta".
10
11Optional properties:
12
13 - clocks: Clock consumer specifiers as described in
14 Documentation/devicetree/bindings/clock/clock-bindings.txt
15
16 - clock-names: Clock consumer names as described in
17 Documentation/devicetree/bindings/clock/clock-bindings.txt.
18
19Clocks are identified by name. Valid clocks are:
20
21 - "core": The Meta core clock from which the Meta timers are derived.
22
23* Examples
24
25/ {
26 compatible = "toumaz,tz1090", "img,meta";
27
28 clocks = <&meta_core_clk>;
29 clock-names = "core";
30};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index db0457d61682..948f61561ffa 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -58,6 +58,7 @@ snps Synopsys, Inc.
58st STMicroelectronics 58st STMicroelectronics
59ste ST-Ericsson 59ste ST-Ericsson
60stericsson ST-Ericsson 60stericsson ST-Ericsson
61toumaz Toumaz
61ti Texas Instruments 62ti Texas Instruments
62toshiba Toshiba Corporation 63toshiba Toshiba Corporation
63v3 V3 Semiconductor 64v3 V3 Semiconductor
diff --git a/arch/metag/Kconfig.soc b/arch/metag/Kconfig.soc
index ec079cfb7c6a..2a3c860c7525 100644
--- a/arch/metag/Kconfig.soc
+++ b/arch/metag/Kconfig.soc
@@ -14,6 +14,18 @@ config META21_FPGA
14 help 14 help
15 This is a Meta 2.1 FPGA bitstream, just a bare CPU. 15 This is a Meta 2.1 FPGA bitstream, just a bare CPU.
16 16
17config SOC_TZ1090
18 bool "Toumaz Xenif TZ1090 SoC (Comet)"
19 select METAG_LNKGET_AROUND_CACHE
20 select METAG_META21
21 select METAG_SMP_WRITE_REORDERING
22 select PINCTRL
23 select PINCTRL_TZ1090
24 select PINCTRL_TZ1090_PDC
25 help
26 This is a Toumaz Technology Xenif TZ1090 (A.K.A. Comet) SoC containing
27 a 2-threaded HTP.
28
17endchoice 29endchoice
18 30
19menu "SoC configuration" 31menu "SoC configuration"
diff --git a/arch/metag/Makefile b/arch/metag/Makefile
index b566116b171b..9739857bdedc 100644
--- a/arch/metag/Makefile
+++ b/arch/metag/Makefile
@@ -20,7 +20,7 @@ checkflags-$(CONFIG_METAG_META12) += -DMETAC_1_2
20checkflags-$(CONFIG_METAG_META21) += -DMETAC_2_1 20checkflags-$(CONFIG_METAG_META21) += -DMETAC_2_1
21CHECKFLAGS += -D__metag__ $(checkflags-y) 21CHECKFLAGS += -D__metag__ $(checkflags-y)
22 22
23KBUILD_DEFCONFIG := meta2_defconfig 23KBUILD_DEFCONFIG := tz1090_defconfig
24 24
25sflags-$(CONFIG_METAG_META12) += -mmetac=1.2 25sflags-$(CONFIG_METAG_META12) += -mmetac=1.2
26ifeq ($(CONFIG_METAG_META12),y) 26ifeq ($(CONFIG_METAG_META12),y)
diff --git a/arch/metag/boot/.gitignore b/arch/metag/boot/.gitignore
index a021da201156..2d6c0c160884 100644
--- a/arch/metag/boot/.gitignore
+++ b/arch/metag/boot/.gitignore
@@ -1,4 +1,4 @@
1vmlinux* 1vmlinux*
2uImage* 2uImage*
3ramdisk.* 3ramdisk.*
4*.dtb 4*.dtb*
diff --git a/arch/metag/boot/dts/Makefile b/arch/metag/boot/dts/Makefile
index dbd95217733a..72c121879426 100644
--- a/arch/metag/boot/dts/Makefile
+++ b/arch/metag/boot/dts/Makefile
@@ -1,7 +1,9 @@
1dtb-y += skeleton.dtb 1dtb-y += skeleton.dtb
2dtb-y += tz1090_generic.dtb
2 3
3# Built-in dtb 4# Built-in dtb
4builtindtb-y := skeleton 5builtindtb-y := skeleton
6builtindtb-$(CONFIG_SOC_TZ1090) := tz1090_generic
5 7
6ifneq ($(CONFIG_METAG_BUILTIN_DTB_NAME),"") 8ifneq ($(CONFIG_METAG_BUILTIN_DTB_NAME),"")
7 builtindtb-y := $(patsubst "%",%,$(CONFIG_METAG_BUILTIN_DTB_NAME)) 9 builtindtb-y := $(patsubst "%",%,$(CONFIG_METAG_BUILTIN_DTB_NAME))
diff --git a/arch/metag/boot/dts/include/dt-bindings b/arch/metag/boot/dts/include/dt-bindings
new file mode 120000
index 000000000000..08c00e4972fa
--- /dev/null
+++ b/arch/metag/boot/dts/include/dt-bindings
@@ -0,0 +1 @@
../../../../../include/dt-bindings \ No newline at end of file
diff --git a/arch/metag/boot/dts/skeleton.dts b/arch/metag/boot/dts/skeleton.dts
index 7244d1f0d555..7a49aeb365d0 100644
--- a/arch/metag/boot/dts/skeleton.dts
+++ b/arch/metag/boot/dts/skeleton.dts
@@ -7,4 +7,4 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "skeleton.dtsi" 10#include "skeleton.dtsi"
diff --git a/arch/metag/boot/dts/tz1090.dtsi b/arch/metag/boot/dts/tz1090.dtsi
new file mode 100644
index 000000000000..853744652b93
--- /dev/null
+++ b/arch/metag/boot/dts/tz1090.dtsi
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2012 Imagination Technologies Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include "skeleton.dtsi"
10
11/ {
12 compatible = "toumaz,tz1090", "img,meta";
13
14 interrupt-parent = <&intc>;
15
16 intc: interrupt-controller {
17 compatible = "img,meta-intc";
18 interrupt-controller;
19 #interrupt-cells = <2>;
20 num-banks = <2>;
21 };
22
23 soc {
24 compatible = "simple-bus";
25 #address-cells = <1>;
26 #size-cells = <1>;
27 ranges;
28
29 pinctrl: pinctrl@02005800 {
30 #gpio-range-cells = <3>;
31 compatible = "img,tz1090-pinctrl";
32 reg = <0x02005800 0xe4>;
33 };
34
35 pdc_pinctrl: pinctrl@02006500 {
36 #gpio-range-cells = <3>;
37 compatible = "img,tz1090-pdc-pinctrl";
38 reg = <0x02006500 0x100>;
39 };
40 };
41};
diff --git a/arch/metag/boot/dts/tz1090_generic.dts b/arch/metag/boot/dts/tz1090_generic.dts
new file mode 100644
index 000000000000..f96090955964
--- /dev/null
+++ b/arch/metag/boot/dts/tz1090_generic.dts
@@ -0,0 +1,10 @@
1/*
2 * Copyright (C) 2012 Imagination Technologies Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/dts-v1/;
9
10#include "tz1090.dtsi"
diff --git a/arch/metag/configs/tz1090_defconfig b/arch/metag/configs/tz1090_defconfig
new file mode 100644
index 000000000000..9f9316a6df27
--- /dev/null
+++ b/arch/metag/configs/tz1090_defconfig
@@ -0,0 +1,42 @@
1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y
4CONFIG_SYSFS_DEPRECATED=y
5CONFIG_SYSFS_DEPRECATED_V2=y
6CONFIG_KALLSYMS_ALL=y
7# CONFIG_ELF_CORE is not set
8CONFIG_SLAB=y
9# CONFIG_BLK_DEV_BSG is not set
10CONFIG_PARTITION_ADVANCED=y
11# CONFIG_MSDOS_PARTITION is not set
12# CONFIG_IOSCHED_DEADLINE is not set
13# CONFIG_IOSCHED_CFQ is not set
14CONFIG_FLATMEM_MANUAL=y
15CONFIG_SOC_TZ1090=y
16CONFIG_METAG_HALT_ON_PANIC=y
17# CONFIG_METAG_FPU is not set
18CONFIG_METAG_DA=y
19CONFIG_HZ_100=y
20CONFIG_DEVTMPFS=y
21# CONFIG_STANDALONE is not set
22# CONFIG_PREVENT_FIRMWARE_BUILD is not set
23# CONFIG_FW_LOADER is not set
24CONFIG_BLK_DEV_RAM=y
25CONFIG_BLK_DEV_RAM_COUNT=1
26CONFIG_BLK_DEV_RAM_SIZE=16384
27# CONFIG_INPUT is not set
28# CONFIG_SERIO is not set
29# CONFIG_VT is not set
30# CONFIG_LEGACY_PTYS is not set
31CONFIG_DA_TTY=y
32CONFIG_DA_CONSOLE=y
33# CONFIG_DEVKMEM is not set
34# CONFIG_HW_RANDOM is not set
35CONFIG_GPIOLIB=y
36# CONFIG_HWMON is not set
37# CONFIG_USB_SUPPORT is not set
38# CONFIG_DNOTIFY is not set
39CONFIG_TMPFS=y
40# CONFIG_MISC_FILESYSTEMS is not set
41# CONFIG_SCHED_DEBUG is not set
42CONFIG_DEBUG_INFO=y
diff --git a/arch/metag/include/asm/bug.h b/arch/metag/include/asm/bug.h
index d04b48cefecc..9f8967f10f8c 100644
--- a/arch/metag/include/asm/bug.h
+++ b/arch/metag/include/asm/bug.h
@@ -6,7 +6,7 @@
6struct pt_regs; 6struct pt_regs;
7 7
8extern const char *trap_name(int trapno); 8extern const char *trap_name(int trapno);
9extern void die(const char *str, struct pt_regs *regs, long err, 9extern void __noreturn die(const char *str, struct pt_regs *regs, long err,
10 unsigned long addr) __attribute__ ((noreturn)); 10 unsigned long addr);
11 11
12#endif 12#endif
diff --git a/arch/metag/include/asm/clock.h b/arch/metag/include/asm/clock.h
index 3e2915a280c7..ded4ab2e1fd0 100644
--- a/arch/metag/include/asm/clock.h
+++ b/arch/metag/include/asm/clock.h
@@ -19,6 +19,8 @@
19 * core frequency will be determined like this: 19 * core frequency will be determined like this:
20 * Meta 1: based on loops_per_jiffy. 20 * Meta 1: based on loops_per_jiffy.
21 * Meta 2: (EXPAND_TIMER_DIV + 1) MHz. 21 * Meta 2: (EXPAND_TIMER_DIV + 1) MHz.
22 * If a "core" clock is provided by the device tree, it
23 * will override this function.
22 */ 24 */
23struct meta_clock_desc { 25struct meta_clock_desc {
24 unsigned long (*get_core_freq)(void); 26 unsigned long (*get_core_freq)(void);
@@ -27,6 +29,12 @@ struct meta_clock_desc {
27extern struct meta_clock_desc _meta_clock; 29extern struct meta_clock_desc _meta_clock;
28 30
29/* 31/*
32 * Perform platform clock initialisation, reading clocks from device tree etc.
33 * Only accessible during boot.
34 */
35void init_metag_clocks(void);
36
37/*
30 * Set up the default clock, ensuring all callbacks are valid - only accessible 38 * Set up the default clock, ensuring all callbacks are valid - only accessible
31 * during boot. 39 * during boot.
32 */ 40 */
diff --git a/arch/metag/include/asm/irq.h b/arch/metag/include/asm/irq.h
index be0c8f3c5a5d..ad6bd0edbc3b 100644
--- a/arch/metag/include/asm/irq.h
+++ b/arch/metag/include/asm/irq.h
@@ -17,6 +17,7 @@ struct pt_regs;
17 17
18int tbisig_map(unsigned int hw); 18int tbisig_map(unsigned int hw);
19extern void do_IRQ(int irq, struct pt_regs *regs); 19extern void do_IRQ(int irq, struct pt_regs *regs);
20extern void init_IRQ(void);
20 21
21#ifdef CONFIG_METAG_SUSPEND_MEM 22#ifdef CONFIG_METAG_SUSPEND_MEM
22int traps_save_context(void); 23int traps_save_context(void);
diff --git a/arch/metag/include/asm/processor.h b/arch/metag/include/asm/processor.h
index 9b029a7911c3..f16477d1f571 100644
--- a/arch/metag/include/asm/processor.h
+++ b/arch/metag/include/asm/processor.h
@@ -199,4 +199,6 @@ extern void (*soc_halt)(void);
199extern void show_trace(struct task_struct *tsk, unsigned long *sp, 199extern void show_trace(struct task_struct *tsk, unsigned long *sp,
200 struct pt_regs *regs); 200 struct pt_regs *regs);
201 201
202extern const struct seq_operations cpuinfo_op;
203
202#endif 204#endif
diff --git a/arch/metag/kernel/cachepart.c b/arch/metag/kernel/cachepart.c
index 954548b1bea8..0a2385fa2a1d 100644
--- a/arch/metag/kernel/cachepart.c
+++ b/arch/metag/kernel/cachepart.c
@@ -100,22 +100,23 @@ void check_for_cache_aliasing(int thread_id)
100 thread_cache_size = 100 thread_cache_size =
101 get_thread_cache_size(cache_type, thread_id); 101 get_thread_cache_size(cache_type, thread_id);
102 if (thread_cache_size < 0) 102 if (thread_cache_size < 0)
103 pr_emerg("Can't read %s cache size", \ 103 pr_emerg("Can't read %s cache size\n",
104 cache_type ? "DCACHE" : "ICACHE"); 104 cache_type ? "DCACHE" : "ICACHE");
105 else if (thread_cache_size == 0) 105 else if (thread_cache_size == 0)
106 /* Cache is off. No need to check for aliasing */ 106 /* Cache is off. No need to check for aliasing */
107 continue; 107 continue;
108 if (thread_cache_size / CACHE_ASSOCIATIVITY > PAGE_SIZE) { 108 if (thread_cache_size / CACHE_ASSOCIATIVITY > PAGE_SIZE) {
109 pr_emerg("Cache aliasing detected in %s on Thread %d", 109 pr_emerg("Potential cache aliasing detected in %s on Thread %d\n",
110 cache_type ? "DCACHE" : "ICACHE", thread_id); 110 cache_type ? "DCACHE" : "ICACHE", thread_id);
111 pr_warn("Total %s size: %u bytes", 111 pr_warn("Total %s size: %u bytes\n",
112 cache_type ? "DCACHE" : "ICACHE ", 112 cache_type ? "DCACHE" : "ICACHE",
113 cache_type ? get_dcache_size() 113 cache_type ? get_dcache_size()
114 : get_icache_size()); 114 : get_icache_size());
115 pr_warn("Thread %s size: %d bytes", 115 pr_warn("Thread %s size: %d bytes\n",
116 cache_type ? "CACHE" : "ICACHE", 116 cache_type ? "CACHE" : "ICACHE",
117 thread_cache_size); 117 thread_cache_size);
118 pr_warn("Page Size: %lu bytes", PAGE_SIZE); 118 pr_warn("Page Size: %lu bytes\n", PAGE_SIZE);
119 panic("Potential cache aliasing detected");
119 } 120 }
120 } 121 }
121} 122}
diff --git a/arch/metag/kernel/clock.c b/arch/metag/kernel/clock.c
index defc84056f18..6339c9c6d0ab 100644
--- a/arch/metag/kernel/clock.c
+++ b/arch/metag/kernel/clock.c
@@ -8,8 +8,10 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <linux/clk.h>
11#include <linux/delay.h> 12#include <linux/delay.h>
12#include <linux/io.h> 13#include <linux/io.h>
14#include <linux/of.h>
13 15
14#include <asm/param.h> 16#include <asm/param.h>
15#include <asm/clock.h> 17#include <asm/clock.h>
@@ -34,8 +36,63 @@ static unsigned long get_core_freq_default(void)
34#endif 36#endif
35} 37}
36 38
39static struct clk *clk_core;
40
41/* Clk based get_core_freq callback. */
42static unsigned long get_core_freq_clk(void)
43{
44 return clk_get_rate(clk_core);
45}
46
47/**
48 * init_metag_core_clock() - Set up core clock from devicetree.
49 *
50 * Checks to see if a "core" clock is provided in the device tree, and overrides
51 * the get_core_freq callback to use it.
52 */
53static void __init init_metag_core_clock(void)
54{
55 /*
56 * See if a core clock is provided by the devicetree (and
57 * registered by the init callback above).
58 */
59 struct device_node *node;
60 node = of_find_compatible_node(NULL, NULL, "img,meta");
61 if (!node) {
62 pr_warn("%s: no compatible img,meta DT node found\n",
63 __func__);
64 return;
65 }
66
67 clk_core = of_clk_get_by_name(node, "core");
68 if (IS_ERR(clk_core)) {
69 pr_warn("%s: no core clock found in DT\n",
70 __func__);
71 return;
72 }
73
74 /*
75 * Override the core frequency callback to use
76 * this clk.
77 */
78 _meta_clock.get_core_freq = get_core_freq_clk;
79}
80
81/**
82 * init_metag_clocks() - Set up clocks from devicetree.
83 *
84 * Set up important clocks from device tree. In particular any needed for clock
85 * sources.
86 */
87void __init init_metag_clocks(void)
88{
89 init_metag_core_clock();
90
91 pr_info("Core clock frequency: %lu Hz\n", get_coreclock());
92}
93
37/** 94/**
38 * setup_meta_clocks() - Set up the Meta clock. 95 * setup_meta_clocks() - Early set up of the Meta clock.
39 * @desc: Clock descriptor usually provided by machine description 96 * @desc: Clock descriptor usually provided by machine description
40 * 97 *
41 * Ensures all callbacks are valid. 98 * Ensures all callbacks are valid.
diff --git a/arch/metag/kernel/irq.c b/arch/metag/kernel/irq.c
index 87707efeb0a3..2a2c9d55187e 100644
--- a/arch/metag/kernel/irq.c
+++ b/arch/metag/kernel/irq.c
@@ -25,7 +25,7 @@ static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
25static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly; 25static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
26#endif 26#endif
27 27
28struct irq_domain *root_domain; 28static struct irq_domain *root_domain;
29 29
30static unsigned int startup_meta_irq(struct irq_data *data) 30static unsigned int startup_meta_irq(struct irq_data *data)
31{ 31{
@@ -279,11 +279,12 @@ static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu)
279{ 279{
280 struct irq_desc *desc = irq_to_desc(irq); 280 struct irq_desc *desc = irq_to_desc(irq);
281 struct irq_chip *chip = irq_data_get_irq_chip(data); 281 struct irq_chip *chip = irq_data_get_irq_chip(data);
282 unsigned long flags;
282 283
283 raw_spin_lock_irq(&desc->lock); 284 raw_spin_lock_irqsave(&desc->lock, flags);
284 if (chip->irq_set_affinity) 285 if (chip->irq_set_affinity)
285 chip->irq_set_affinity(data, cpumask_of(cpu), false); 286 chip->irq_set_affinity(data, cpumask_of(cpu), false);
286 raw_spin_unlock_irq(&desc->lock); 287 raw_spin_unlock_irqrestore(&desc->lock, flags);
287} 288}
288 289
289/* 290/*
diff --git a/arch/metag/kernel/kick.c b/arch/metag/kernel/kick.c
index 50fcbec98cd2..beb377621322 100644
--- a/arch/metag/kernel/kick.c
+++ b/arch/metag/kernel/kick.c
@@ -26,6 +26,8 @@
26 * pass it as an argument. 26 * pass it as an argument.
27 */ 27 */
28#include <linux/export.h> 28#include <linux/export.h>
29#include <linux/hardirq.h>
30#include <linux/irq.h>
29#include <linux/kernel.h> 31#include <linux/kernel.h>
30#include <linux/mm.h> 32#include <linux/mm.h>
31#include <linux/types.h> 33#include <linux/types.h>
@@ -66,6 +68,7 @@ EXPORT_SYMBOL(kick_unregister_func);
66TBIRES 68TBIRES
67kick_handler(TBIRES State, int SigNum, int Triggers, int Inst, PTBI pTBI) 69kick_handler(TBIRES State, int SigNum, int Triggers, int Inst, PTBI pTBI)
68{ 70{
71 struct pt_regs *old_regs;
69 struct kick_irq_handler *kh; 72 struct kick_irq_handler *kh;
70 struct list_head *lh; 73 struct list_head *lh;
71 int handled = 0; 74 int handled = 0;
@@ -79,6 +82,9 @@ kick_handler(TBIRES State, int SigNum, int Triggers, int Inst, PTBI pTBI)
79 82
80 trace_hardirqs_off(); 83 trace_hardirqs_off();
81 84
85 old_regs = set_irq_regs((struct pt_regs *)State.Sig.pCtx);
86 irq_enter();
87
82 /* 88 /*
83 * There is no need to disable interrupts here because we 89 * There is no need to disable interrupts here because we
84 * can't nest KICK interrupts in a KICK interrupt handler. 90 * can't nest KICK interrupts in a KICK interrupt handler.
@@ -97,5 +103,8 @@ kick_handler(TBIRES State, int SigNum, int Triggers, int Inst, PTBI pTBI)
97 103
98 WARN_ON(!handled); 104 WARN_ON(!handled);
99 105
106 irq_exit();
107 set_irq_regs(old_regs);
108
100 return tail_end(ret); 109 return tail_end(ret);
101} 110}
diff --git a/arch/metag/kernel/metag_ksyms.c b/arch/metag/kernel/metag_ksyms.c
index ec872ef14eb1..215c94ad63ac 100644
--- a/arch/metag/kernel/metag_ksyms.c
+++ b/arch/metag/kernel/metag_ksyms.c
@@ -1,5 +1,7 @@
1#include <linux/export.h> 1#include <linux/export.h>
2#include <linux/types.h>
2 3
4#include <asm/checksum.h>
3#include <asm/div64.h> 5#include <asm/div64.h>
4#include <asm/ftrace.h> 6#include <asm/ftrace.h>
5#include <asm/page.h> 7#include <asm/page.h>
@@ -15,6 +17,9 @@ EXPORT_SYMBOL(max_pfn);
15EXPORT_SYMBOL(min_low_pfn); 17EXPORT_SYMBOL(min_low_pfn);
16#endif 18#endif
17 19
20/* Network checksum functions */
21EXPORT_SYMBOL(csum_partial);
22
18/* TBI symbols */ 23/* TBI symbols */
19EXPORT_SYMBOL(__TBI); 24EXPORT_SYMBOL(__TBI);
20EXPORT_SYMBOL(__TBIFindSeg); 25EXPORT_SYMBOL(__TBIFindSeg);
diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index 4f5726f1a55b..c396cd0b425f 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -20,6 +20,7 @@
20#include <linux/memblock.h> 20#include <linux/memblock.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/of_fdt.h> 22#include <linux/of_fdt.h>
23#include <linux/of_platform.h>
23#include <linux/pfn.h> 24#include <linux/pfn.h>
24#include <linux/root_dev.h> 25#include <linux/root_dev.h>
25#include <linux/sched.h> 26#include <linux/sched.h>
@@ -424,6 +425,9 @@ static int __init customize_machine(void)
424 /* customizes platform devices, or adds new ones */ 425 /* customizes platform devices, or adds new ones */
425 if (machine_desc->init_machine) 426 if (machine_desc->init_machine)
426 machine_desc->init_machine(); 427 machine_desc->init_machine();
428 else
429 of_platform_populate(NULL, of_default_bus_match_table, NULL,
430 NULL);
427 return 0; 431 return 0;
428} 432}
429arch_initcall(customize_machine); 433arch_initcall(customize_machine);
@@ -587,20 +591,20 @@ PTBI pTBI_get(unsigned int cpu)
587EXPORT_SYMBOL(pTBI_get); 591EXPORT_SYMBOL(pTBI_get);
588 592
589#if defined(CONFIG_METAG_DSP) && defined(CONFIG_METAG_FPU) 593#if defined(CONFIG_METAG_DSP) && defined(CONFIG_METAG_FPU)
590char capabilites[] = "dsp fpu"; 594static char capabilities[] = "dsp fpu";
591#elif defined(CONFIG_METAG_DSP) 595#elif defined(CONFIG_METAG_DSP)
592char capabilites[] = "dsp"; 596static char capabilities[] = "dsp";
593#elif defined(CONFIG_METAG_FPU) 597#elif defined(CONFIG_METAG_FPU)
594char capabilites[] = "fpu"; 598static char capabilities[] = "fpu";
595#else 599#else
596char capabilites[] = ""; 600static char capabilities[] = "";
597#endif 601#endif
598 602
599static struct ctl_table caps_kern_table[] = { 603static struct ctl_table caps_kern_table[] = {
600 { 604 {
601 .procname = "capabilities", 605 .procname = "capabilities",
602 .data = capabilites, 606 .data = capabilities,
603 .maxlen = sizeof(capabilites), 607 .maxlen = sizeof(capabilities),
604 .mode = 0444, 608 .mode = 0444,
605 .proc_handler = proc_dostring, 609 .proc_handler = proc_dostring,
606 }, 610 },
diff --git a/arch/metag/kernel/smp.c b/arch/metag/kernel/smp.c
index f443ec9a7cbe..e413875cf6d2 100644
--- a/arch/metag/kernel/smp.c
+++ b/arch/metag/kernel/smp.c
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#include <linux/atomic.h> 10#include <linux/atomic.h>
11#include <linux/completion.h>
11#include <linux/delay.h> 12#include <linux/delay.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/spinlock.h> 14#include <linux/spinlock.h>
@@ -62,6 +63,8 @@ static DEFINE_PER_CPU(struct ipi_data, ipi_data) = {
62 63
63static DEFINE_SPINLOCK(boot_lock); 64static DEFINE_SPINLOCK(boot_lock);
64 65
66static DECLARE_COMPLETION(cpu_running);
67
65/* 68/*
66 * "thread" is assumed to be a valid Meta hardware thread ID. 69 * "thread" is assumed to be a valid Meta hardware thread ID.
67 */ 70 */
@@ -235,20 +238,12 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
235 */ 238 */
236 ret = boot_secondary(thread, idle); 239 ret = boot_secondary(thread, idle);
237 if (ret == 0) { 240 if (ret == 0) {
238 unsigned long timeout;
239
240 /* 241 /*
241 * CPU was successfully started, wait for it 242 * CPU was successfully started, wait for it
242 * to come online or time out. 243 * to come online or time out.
243 */ 244 */
244 timeout = jiffies + HZ; 245 wait_for_completion_timeout(&cpu_running,
245 while (time_before(jiffies, timeout)) { 246 msecs_to_jiffies(1000));
246 if (cpu_online(cpu))
247 break;
248
249 udelay(10);
250 barrier();
251 }
252 247
253 if (!cpu_online(cpu)) 248 if (!cpu_online(cpu))
254 ret = -EIO; 249 ret = -EIO;
@@ -276,7 +271,6 @@ static DECLARE_COMPLETION(cpu_killed);
276int __cpuexit __cpu_disable(void) 271int __cpuexit __cpu_disable(void)
277{ 272{
278 unsigned int cpu = smp_processor_id(); 273 unsigned int cpu = smp_processor_id();
279 struct task_struct *p;
280 274
281 /* 275 /*
282 * Take this CPU offline. Once we clear this, we can't return, 276 * Take this CPU offline. Once we clear this, we can't return,
@@ -296,12 +290,7 @@ int __cpuexit __cpu_disable(void)
296 flush_cache_all(); 290 flush_cache_all();
297 local_flush_tlb_all(); 291 local_flush_tlb_all();
298 292
299 read_lock(&tasklist_lock); 293 clear_tasks_mm_cpumask(cpu);
300 for_each_process(p) {
301 if (p->mm)
302 cpumask_clear_cpu(cpu, mm_cpumask(p->mm));
303 }
304 read_unlock(&tasklist_lock);
305 294
306 return 0; 295 return 0;
307} 296}
@@ -385,12 +374,7 @@ asmlinkage void secondary_start_kernel(void)
385 374
386 setup_priv(); 375 setup_priv();
387 376
388 /*
389 * Enable local interrupts.
390 */
391 tbi_startup_interrupt(TBID_SIGNUM_TRT);
392 notify_cpu_starting(cpu); 377 notify_cpu_starting(cpu);
393 local_irq_enable();
394 378
395 pr_info("CPU%u (thread %u): Booted secondary processor\n", 379 pr_info("CPU%u (thread %u): Booted secondary processor\n",
396 cpu, cpu_2_hwthread_id[cpu]); 380 cpu, cpu_2_hwthread_id[cpu]);
@@ -402,12 +386,13 @@ asmlinkage void secondary_start_kernel(void)
402 * OK, now it's safe to let the boot CPU continue 386 * OK, now it's safe to let the boot CPU continue
403 */ 387 */
404 set_cpu_online(cpu, true); 388 set_cpu_online(cpu, true);
389 complete(&cpu_running);
405 390
406 /* 391 /*
407 * Check for cache aliasing. 392 * Enable local interrupts.
408 * Preemption is disabled
409 */ 393 */
410 check_for_cache_aliasing(cpu); 394 tbi_startup_interrupt(TBID_SIGNUM_TRT);
395 local_irq_enable();
411 396
412 /* 397 /*
413 * OK, it's off to the idle thread for us 398 * OK, it's off to the idle thread for us
diff --git a/arch/metag/kernel/time.c b/arch/metag/kernel/time.c
index 17dc10733b2f..f1c8c53dace7 100644
--- a/arch/metag/kernel/time.c
+++ b/arch/metag/kernel/time.c
@@ -5,11 +5,21 @@
5 * 5 *
6 */ 6 */
7 7
8#include <linux/init.h>
9
10#include <clocksource/metag_generic.h> 8#include <clocksource/metag_generic.h>
9#include <linux/clk-provider.h>
10#include <linux/init.h>
11#include <asm/clock.h>
11 12
12void __init time_init(void) 13void __init time_init(void)
13{ 14{
15#ifdef CONFIG_COMMON_CLK
16 /* Init clocks from device tree */
17 of_clk_init(NULL);
18#endif
19
20 /* Init meta clocks, particularly the core clock */
21 init_metag_clocks();
22
23 /* Set up the timer clock sources */
14 metag_generic_timer_init(); 24 metag_generic_timer_init();
15} 25}
diff --git a/arch/metag/kernel/traps.c b/arch/metag/kernel/traps.c
index 2ceeaae5b199..c00ade0228ef 100644
--- a/arch/metag/kernel/traps.c
+++ b/arch/metag/kernel/traps.c
@@ -33,6 +33,7 @@
33#include <asm/siginfo.h> 33#include <asm/siginfo.h>
34#include <asm/traps.h> 34#include <asm/traps.h>
35#include <asm/hwthread.h> 35#include <asm/hwthread.h>
36#include <asm/setup.h>
36#include <asm/switch.h> 37#include <asm/switch.h>
37#include <asm/user_gateway.h> 38#include <asm/user_gateway.h>
38#include <asm/syscall.h> 39#include <asm/syscall.h>
@@ -87,8 +88,8 @@ const char *trap_name(int trapno)
87 88
88static DEFINE_SPINLOCK(die_lock); 89static DEFINE_SPINLOCK(die_lock);
89 90
90void die(const char *str, struct pt_regs *regs, long err, 91void __noreturn die(const char *str, struct pt_regs *regs,
91 unsigned long addr) 92 long err, unsigned long addr)
92{ 93{
93 static int die_counter; 94 static int die_counter;
94 95
diff --git a/arch/metag/lib/checksum.c b/arch/metag/lib/checksum.c
index 44d2e1913560..5d6a98a05e9d 100644
--- a/arch/metag/lib/checksum.c
+++ b/arch/metag/lib/checksum.c
@@ -124,7 +124,6 @@ __wsum csum_partial(const void *buff, int len, __wsum wsum)
124 result += 1; 124 result += 1;
125 return (__force __wsum)result; 125 return (__force __wsum)result;
126} 126}
127EXPORT_SYMBOL(csum_partial);
128 127
129/* 128/*
130 * this routine is used for miscellaneous IP-like checksums, mainly 129 * this routine is used for miscellaneous IP-like checksums, mainly
diff --git a/arch/metag/mm/cache.c b/arch/metag/mm/cache.c
index b5d3b2e7c160..a62285284ab8 100644
--- a/arch/metag/mm/cache.c
+++ b/arch/metag/mm/cache.c
@@ -45,7 +45,7 @@ static volatile u32 lnkget_testdata[16] __initdata __aligned(64);
45 45
46#define LNKGET_CONSTANT 0xdeadbeef 46#define LNKGET_CONSTANT 0xdeadbeef
47 47
48void __init metag_lnkget_probe(void) 48static void __init metag_lnkget_probe(void)
49{ 49{
50 int temp; 50 int temp;
51 long flags; 51 long flags;
diff --git a/drivers/clocksource/metag_generic.c b/drivers/clocksource/metag_generic.c
index ade7513a11d1..6722f0e2fe40 100644
--- a/drivers/clocksource/metag_generic.c
+++ b/drivers/clocksource/metag_generic.c
@@ -184,6 +184,8 @@ int __init metag_generic_timer_init(void)
184#ifdef CONFIG_METAG_META21 184#ifdef CONFIG_METAG_META21
185 hwtimer_freq = get_coreclock() / (metag_in32(EXPAND_TIMER_DIV) + 1); 185 hwtimer_freq = get_coreclock() / (metag_in32(EXPAND_TIMER_DIV) + 1);
186#endif 186#endif
187 pr_info("Timer frequency: %u Hz\n", hwtimer_freq);
188
187 clocksource_register_hz(&clocksource_metag, hwtimer_freq); 189 clocksource_register_hz(&clocksource_metag, hwtimer_freq);
188 190
189 setup_irq(tbisig_map(TBID_SIGNUM_TRT), &metag_timer_irq); 191 setup_irq(tbisig_map(TBID_SIGNUM_TRT), &metag_timer_irq);