summaryrefslogtreecommitdiffstats
path: root/arch/microblaze/cpu/interrupts.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2016-02-15 12:10:32 +0100
committerMichal Simek <michal.simek@xilinx.com>2016-04-04 20:28:38 +0200
commit9aa65cab73e4873f3e94c6df3d0efd99f3bc9926 (patch)
treecd690f73796fa5356b86769cb695524732e538d0 /arch/microblaze/cpu/interrupts.c
parent66de226f9fd2604b42751b6c68e8e33bceb7da9c (diff)
downloadblackbird-obmc-uboot-9aa65cab73e4873f3e94c6df3d0efd99f3bc9926.tar.gz
blackbird-obmc-uboot-9aa65cab73e4873f3e94c6df3d0efd99f3bc9926.zip
microblaze: Read information about timer/interrupts from DT
Read information about timer and interrupts from DT. This is the first small step to move timer and intc to DM. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'arch/microblaze/cpu/interrupts.c')
-rw-r--r--arch/microblaze/cpu/interrupts.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index b6d6610f2f..e5d8894f54 100644
--- a/arch/microblaze/cpu/interrupts.c
+++ b/arch/microblaze/cpu/interrupts.c
@@ -10,10 +10,13 @@
#include <common.h>
#include <command.h>
+#include <fdtdec.h>
#include <malloc.h>
#include <asm/microblaze_intc.h>
#include <asm/asm.h>
+DECLARE_GLOBAL_DATA_PTR;
+
void enable_interrupts(void)
{
debug("Enable interrupts for the whole CPU\n");
@@ -113,10 +116,32 @@ int interrupt_init(void)
{
int i;
+#ifdef CONFIG_OF_CONTROL
+ const void *blob = gd->fdt_blob;
+ int node = 0;
+
+ debug("INTC: Initialization\n");
+
+ node = fdt_node_offset_by_compatible(blob, node,
+ "xlnx,xps-intc-1.00.a");
+ if (node != -1) {
+ fdt_addr_t base = fdtdec_get_addr(blob, node, "reg");
+ if (base == FDT_ADDR_T_NONE)
+ return -1;
+
+ debug("INTC: Base addr %lx\n", base);
+ intc = (microblaze_intc_t *)base;
+ irq_no = fdtdec_get_int(blob, node, "xlnx,num-intr-inputs", 0);
+ debug("INTC: IRQ NO %x\n", irq_no);
+ } else {
+ return node;
+ }
+#else
#if defined(CONFIG_SYS_INTC_0_ADDR) && defined(CONFIG_SYS_INTC_0_NUM)
intc = (microblaze_intc_t *)CONFIG_SYS_INTC_0_ADDR;
irq_no = CONFIG_SYS_INTC_0_NUM;
#endif
+#endif
if (irq_no) {
vecs = calloc(1, sizeof(struct irq_action) * irq_no);
if (vecs == NULL) {
OpenPOWER on IntegriCloud