From af1da1d5a8701f39cdbae4a0ab8e04b450eef298 Mon Sep 17 00:00:00 2001 From: Daniel Hellstrom Date: Wed, 8 Sep 2010 18:05:38 +0200 Subject: [PATCH] SPARC/LEON: find IRQ and Timer via OF-Tree, instead of hardcoded. Signed-off-by: Daniel Hellstrom --- arch/sparc/kernel/leon_kernel.c | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletions(-) --- a/arch/sparc/kernel/leon_kernel.c +++ b/arch/sparc/kernel/leon_kernel.c @@ -105,13 +105,34 @@ static void leon_disable_irq(unsigned in void __init leon_init_timers(irq_handler_t counter_fn) { int irq; + struct device_node *rootnp, *np; + struct property *pp; + int len; leondebug_irq_disable = 0; leon_debug_irqout = 0; master_l10_counter = (unsigned int *)&dummy_master_l10_counter; dummy_master_l10_counter = 0; - if (leon3_gptimer_regs && leon3_irqctrl_regs) { + /* Find IRQMP IRQ Controller Registers base address otherwise bail out. */ + rootnp = of_find_node_by_path("/ambapp0"); + if (rootnp && (np=of_find_node_by_name(rootnp, "GAISLER_IRQMP"))) { + pp = of_find_property(np, "reg", &len); + if (pp) + leon3_irqctrl_regs = *(struct leon3_irqctrl_regs_map **)pp->value; + } + + /* Find GPTIMER Timer Registers base address otherwise bail out. */ + if (rootnp && (np=of_find_node_by_name(rootnp, "GAISLER_GPTIMER"))) { + pp = of_find_property(np, "reg", &len); + if (pp) + leon3_gptimer_regs = *(struct leon3_gptimer_regs_map **)pp->value; + pp = of_find_property(np, "interrupts", &len); + if (pp) + leon3_gptimer_irq = *(unsigned int *)pp->value; + } + + if (leon3_gptimer_regs && leon3_irqctrl_regs && leon3_gptimer_irq) { LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].val, 0); LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].rld, (((1000000 / HZ) - 1)));