diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2014-04-22 17:26:27 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2014-04-26 15:45:07 -0400 |
commit | ab5ab9dbe6bd480d17f23b3a33510ae33e6ab280 (patch) | |
tree | 875a6ac95218ff54015970f7222b5da81f8f06cc | |
parent | deac3d874ea1e1ef50604cec33ddfb01edb0c976 (diff) |
ARM: orion5x: switch to DT interrupts and timer
This commit switches the Orion5x platforms described through DT to use
a DT-defined interrupt controller and timer.
This involves:
* Describing in the DT the bridge interrupt controller, which is a
child interrupt controller to the main one, which is used for timer
and watchdog interrupts.
* Describing in the DT the timer.
* Adding in the DT the interrupt specifications for the watchdog.
* Selecting the ORION_IRQCHIP and ORION_TIMER drivers to be compiled.
* Change board-dt.c to no longer have an ->init_time() callback,
since the default callback will work fine: it calls
clocksource_of_init() and of_clk_init(), as needed.
* Implement a multi-IRQ handler for non-DT platforms in
mach-orion5x/irq.c.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Link: https://lkml.kernel.org/r/1398202002-28530-24-git-send-email-thomas.petazzoni@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r-- | arch/arm/boot/dts/orion5x.dtsi | 19 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/board-dt.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/irq.c | 28 |
4 files changed, 50 insertions, 14 deletions
diff --git a/arch/arm/boot/dts/orion5x.dtsi b/arch/arm/boot/dts/orion5x.dtsi index 88df8a811ad3..b4c2234fda1e 100644 --- a/arch/arm/boot/dts/orion5x.dtsi +++ b/arch/arm/boot/dts/orion5x.dtsi | |||
@@ -78,6 +78,15 @@ | |||
78 | status = "disabled"; | 78 | status = "disabled"; |
79 | }; | 79 | }; |
80 | 80 | ||
81 | bridge_intc: bridge-interrupt-ctrl@20110 { | ||
82 | compatible = "marvell,orion-bridge-intc"; | ||
83 | interrupt-controller; | ||
84 | #interrupt-cells = <1>; | ||
85 | reg = <0x20110 0x8>; | ||
86 | interrupts = <0>; | ||
87 | marvell,#interrupts = <4>; | ||
88 | }; | ||
89 | |||
81 | intc: interrupt-controller@20200 { | 90 | intc: interrupt-controller@20200 { |
82 | compatible = "marvell,orion-intc"; | 91 | compatible = "marvell,orion-intc"; |
83 | interrupt-controller; | 92 | interrupt-controller; |
@@ -85,9 +94,19 @@ | |||
85 | reg = <0x20200 0x08>; | 94 | reg = <0x20200 0x08>; |
86 | }; | 95 | }; |
87 | 96 | ||
97 | timer: timer@20300 { | ||
98 | compatible = "marvell,orion-timer"; | ||
99 | reg = <0x20300 0x20>; | ||
100 | interrupt-parent = <&bridge_intc>; | ||
101 | interrupts = <1>, <2>; | ||
102 | clocks = <&core_clk 0>; | ||
103 | }; | ||
104 | |||
88 | wdt: wdt@20300 { | 105 | wdt: wdt@20300 { |
89 | compatible = "marvell,orion-wdt"; | 106 | compatible = "marvell,orion-wdt"; |
90 | reg = <0x20300 0x28>; | 107 | reg = <0x20300 0x28>; |
108 | interrupt-parent = <&bridge_intc>; | ||
109 | interrupts = <3>; | ||
91 | status = "okay"; | 110 | status = "okay"; |
92 | }; | 111 | }; |
93 | 112 | ||
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig index 4f5113279352..bd65872f5e04 100644 --- a/arch/arm/mach-orion5x/Kconfig +++ b/arch/arm/mach-orion5x/Kconfig | |||
@@ -6,6 +6,8 @@ config ARCH_ORION5X_DT | |||
6 | bool "Marvell Orion5x Flattened Device Tree" | 6 | bool "Marvell Orion5x Flattened Device Tree" |
7 | select USE_OF | 7 | select USE_OF |
8 | select ORION_CLK | 8 | select ORION_CLK |
9 | select ORION_IRQCHIP | ||
10 | select ORION_TIMER | ||
9 | help | 11 | help |
10 | Say 'Y' here if you want your kernel to support the | 12 | Say 'Y' here if you want your kernel to support the |
11 | Marvell Orion5x using flattened device tree. | 13 | Marvell Orion5x using flattened device tree. |
diff --git a/arch/arm/mach-orion5x/board-dt.c b/arch/arm/mach-orion5x/board-dt.c index 34286ef16320..6dc4846519ec 100644 --- a/arch/arm/mach-orion5x/board-dt.c +++ b/arch/arm/mach-orion5x/board-dt.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/cpu.h> | 17 | #include <linux/cpu.h> |
18 | #include <linux/mbus.h> | 18 | #include <linux/mbus.h> |
19 | #include <linux/clk-provider.h> | 19 | #include <linux/clk-provider.h> |
20 | #include <linux/clocksource.h> | ||
20 | #include <asm/system_misc.h> | 21 | #include <asm/system_misc.h> |
21 | #include <asm/mach/arch.h> | 22 | #include <asm/mach/arch.h> |
22 | #include <asm/mach/map.h> | 23 | #include <asm/mach/map.h> |
@@ -36,17 +37,6 @@ static struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = { | |||
36 | {}, | 37 | {}, |
37 | }; | 38 | }; |
38 | 39 | ||
39 | static void orion5x_dt_init_early(void) | ||
40 | { | ||
41 | orion_time_set_base(TIMER_VIRT_BASE); | ||
42 | } | ||
43 | |||
44 | static void orion5x_dt_init_time(void) | ||
45 | { | ||
46 | orion5x_timer_init(); | ||
47 | of_clk_init(NULL); | ||
48 | } | ||
49 | |||
50 | static void __init orion5x_dt_init(void) | 40 | static void __init orion5x_dt_init(void) |
51 | { | 41 | { |
52 | char *dev_name; | 42 | char *dev_name; |
@@ -86,9 +76,6 @@ static const char *orion5x_dt_compat[] = { | |||
86 | DT_MACHINE_START(ORION5X_DT, "Marvell Orion5x (Flattened Device Tree)") | 76 | DT_MACHINE_START(ORION5X_DT, "Marvell Orion5x (Flattened Device Tree)") |
87 | /* Maintainer: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> */ | 77 | /* Maintainer: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> */ |
88 | .map_io = orion5x_map_io, | 78 | .map_io = orion5x_map_io, |
89 | .init_early = orion5x_dt_init_early, | ||
90 | .init_irq = orion_dt_init_irq, | ||
91 | .init_time = orion5x_dt_init_time, | ||
92 | .init_machine = orion5x_dt_init, | 79 | .init_machine = orion5x_dt_init, |
93 | .restart = orion5x_restart, | 80 | .restart = orion5x_restart, |
94 | .dt_compat = orion5x_dt_compat, | 81 | .dt_compat = orion5x_dt_compat, |
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c index 9654b0cc5892..cd4bac4d7e43 100644 --- a/arch/arm/mach-orion5x/irq.c +++ b/arch/arm/mach-orion5x/irq.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <mach/bridge-regs.h> | 16 | #include <mach/bridge-regs.h> |
17 | #include <plat/orion-gpio.h> | 17 | #include <plat/orion-gpio.h> |
18 | #include <plat/irq.h> | 18 | #include <plat/irq.h> |
19 | #include <asm/exception.h> | ||
19 | #include "common.h" | 20 | #include "common.h" |
20 | 21 | ||
21 | static int __initdata gpio0_irqs[4] = { | 22 | static int __initdata gpio0_irqs[4] = { |
@@ -25,10 +26,37 @@ static int __initdata gpio0_irqs[4] = { | |||
25 | IRQ_ORION5X_GPIO_24_31, | 26 | IRQ_ORION5X_GPIO_24_31, |
26 | }; | 27 | }; |
27 | 28 | ||
29 | #ifdef CONFIG_MULTI_IRQ_HANDLER | ||
30 | /* | ||
31 | * Compiling with both non-DT and DT support enabled, will | ||
32 | * break asm irq handler used by non-DT boards. Therefore, | ||
33 | * we provide a C-style irq handler even for non-DT boards, | ||
34 | * if MULTI_IRQ_HANDLER is set. | ||
35 | */ | ||
36 | |||
37 | asmlinkage void | ||
38 | __exception_irq_entry orion5x_legacy_handle_irq(struct pt_regs *regs) | ||
39 | { | ||
40 | u32 stat; | ||
41 | |||
42 | stat = readl_relaxed(MAIN_IRQ_CAUSE); | ||
43 | stat &= readl_relaxed(MAIN_IRQ_MASK); | ||
44 | if (stat) { | ||
45 | unsigned int hwirq = __fls(stat); | ||
46 | handle_IRQ(hwirq, regs); | ||
47 | return; | ||
48 | } | ||
49 | } | ||
50 | #endif | ||
51 | |||
28 | void __init orion5x_init_irq(void) | 52 | void __init orion5x_init_irq(void) |
29 | { | 53 | { |
30 | orion_irq_init(0, MAIN_IRQ_MASK); | 54 | orion_irq_init(0, MAIN_IRQ_MASK); |
31 | 55 | ||
56 | #ifdef CONFIG_MULTI_IRQ_HANDLER | ||
57 | set_handle_irq(orion5x_legacy_handle_irq); | ||
58 | #endif | ||
59 | |||
32 | /* | 60 | /* |
33 | * Initialize gpiolib for GPIOs 0-31. | 61 | * Initialize gpiolib for GPIOs 0-31. |
34 | */ | 62 | */ |