ramips: switch to 2.6.39.2
[openwrt.git] / target / linux / leon / patches / 001-find_irq_and_timer_via_of.patch
1 From af1da1d5a8701f39cdbae4a0ab8e04b450eef298 Mon Sep 17 00:00:00 2001
2 From: Daniel Hellstrom <daniel@gaisler.com>
3 Date: Wed, 8 Sep 2010 18:05:38 +0200
4 Subject: [PATCH] SPARC/LEON: find IRQ and Timer via OF-Tree, instead of hardcoded.
5
6 Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
7 ---
8 arch/sparc/kernel/leon_kernel.c | 23 ++++++++++++++++++++++-
9 1 files changed, 22 insertions(+), 1 deletions(-)
10
11 --- a/arch/sparc/kernel/leon_kernel.c
12 +++ b/arch/sparc/kernel/leon_kernel.c
13 @@ -105,13 +105,34 @@ static void leon_disable_irq(unsigned in
14 void __init leon_init_timers(irq_handler_t counter_fn)
15 {
16 int irq;
17 + struct device_node *rootnp, *np;
18 + struct property *pp;
19 + int len;
20
21 leondebug_irq_disable = 0;
22 leon_debug_irqout = 0;
23 master_l10_counter = (unsigned int *)&dummy_master_l10_counter;
24 dummy_master_l10_counter = 0;
25
26 - if (leon3_gptimer_regs && leon3_irqctrl_regs) {
27 + /* Find IRQMP IRQ Controller Registers base address otherwise bail out. */
28 + rootnp = of_find_node_by_path("/ambapp0");
29 + if (rootnp && (np=of_find_node_by_name(rootnp, "GAISLER_IRQMP"))) {
30 + pp = of_find_property(np, "reg", &len);
31 + if (pp)
32 + leon3_irqctrl_regs = *(struct leon3_irqctrl_regs_map **)pp->value;
33 + }
34 +
35 + /* Find GPTIMER Timer Registers base address otherwise bail out. */
36 + if (rootnp && (np=of_find_node_by_name(rootnp, "GAISLER_GPTIMER"))) {
37 + pp = of_find_property(np, "reg", &len);
38 + if (pp)
39 + leon3_gptimer_regs = *(struct leon3_gptimer_regs_map **)pp->value;
40 + pp = of_find_property(np, "interrupts", &len);
41 + if (pp)
42 + leon3_gptimer_irq = *(unsigned int *)pp->value;
43 + }
44 +
45 + if (leon3_gptimer_regs && leon3_irqctrl_regs && leon3_gptimer_irq) {
46 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].val, 0);
47 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].rld,
48 (((1000000 / 100) - 1)));
This page took 0.042514 seconds and 5 git commands to generate.