ARC: [plat-axs103] use clk driver #2: Add core pll node to DT to manage cpu clk
[linux/fpc-iii.git] / arch / h8300 / kernel / irq.c
blobda79f95216993fd7eca5d2cbde35672a62bfd961
1 /*
2 * linux/arch/h8300/kernel/irq.c
4 * Copyright 2014-2015 Yoshinori Sato <ysato@users.sourceforge.jp>
5 */
7 #include <linux/init.h>
8 #include <linux/interrupt.h>
9 #include <linux/irq.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[] = {
18 0, 0, 0, 0,
19 _trace_break,
20 0, 0,
21 _nmi,
22 _system_call,
23 0, 0,
24 _trace_break,
27 static unsigned long __init *get_vector_address(void)
29 unsigned long *rom_vector = CPU_VECTOR;
30 unsigned long base, tmp;
31 int vec_no;
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))
39 return NULL;
42 /* ramvector base address */
43 base -= EXT_IRQ0*4;
45 /* writerble? */
46 tmp = ~(*(volatile unsigned long *)base);
47 (*(volatile unsigned long *)base) = tmp;
48 if ((*(volatile unsigned long *)base) != tmp)
49 return NULL;
50 return (unsigned long *)base;
53 static void __init setup_vector(void)
55 int i;
56 unsigned long *ramvec, *ramvec_p;
57 const h8300_vector *trap_entry;
59 ramvec = get_vector_address();
60 if (ramvec == NULL)
61 panic("interrupt vector serup failed.");
62 else
63 pr_debug("virtual vector at 0x%p\n", ramvec);
65 /* create redirect table */
66 ramvec_p = ramvec;
67 trap_entry = trap_table;
68 for (i = 0; i < NR_IRQS; i++) {
69 if (i < 12) {
70 if (*trap_entry)
71 *ramvec_p = VECTOR(*trap_entry);
72 ramvec_p++;
73 trap_entry++;
74 } else
75 *ramvec_p++ = REDIRECT(_interrupt_entry);
77 _interrupt_redirect_table = ramvec;
79 #else
80 void setup_vector(void)
82 /* noting do */
84 #endif
86 void __init init_IRQ(void)
88 setup_vector();
89 irqchip_init();
92 asmlinkage void do_IRQ(int irq)
94 irq_enter();
95 generic_handle_irq(irq);
96 irq_exit();