2 * linux/arch/h8300/kernel/irq.c
4 * Copyright 2014-2015 Yoshinori Sato <ysato@users.sourceforge.jp>
7 #include <linux/init.h>
8 #include <linux/interrupt.h>
10 #include <linux/irqdomain.h>
11 #include <linux/of_irq.h>
12 #include <asm/traps.h>
14 #ifdef CONFIG_RAMKERNEL
15 typedef void (*h8300_vector
)(void);
17 static const h8300_vector __initconst trap_table
[] = {
27 static unsigned long __init
*get_vector_address(void)
29 unsigned long *rom_vector
= CPU_VECTOR
;
30 unsigned long base
, tmp
;
33 base
= rom_vector
[EXT_IRQ0
] & ADDR_MASK
;
35 /* check romvector format */
36 for (vec_no
= EXT_IRQ0
+ 1; vec_no
<= EXT_IRQ0
+EXT_IRQS
; vec_no
++) {
37 if ((base
+(vec_no
- EXT_IRQ0
)*4) !=
38 (rom_vector
[vec_no
] & ADDR_MASK
))
42 /* ramvector base address */
46 tmp
= ~(*(volatile unsigned long *)base
);
47 (*(volatile unsigned long *)base
) = tmp
;
48 if ((*(volatile unsigned long *)base
) != tmp
)
50 return (unsigned long *)base
;
53 static void __init
setup_vector(void)
56 unsigned long *ramvec
, *ramvec_p
;
57 const h8300_vector
*trap_entry
;
59 ramvec
= get_vector_address();
61 panic("interrupt vector serup failed.");
63 pr_debug("virtual vector at 0x%p\n", ramvec
);
65 /* create redirect table */
67 trap_entry
= trap_table
;
68 for (i
= 0; i
< NR_IRQS
; i
++) {
71 *ramvec_p
= VECTOR(*trap_entry
);
75 *ramvec_p
++ = REDIRECT(_interrupt_entry
);
77 _interrupt_redirect_table
= ramvec
;
80 void setup_vector(void)
86 void __init
init_IRQ(void)
92 asmlinkage
void do_IRQ(int irq
)
95 generic_handle_irq(irq
);