diff options
Diffstat (limited to 'arch/frv/kernel/irq-mb93493.c')
-rw-r--r-- | arch/frv/kernel/irq-mb93493.c | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/arch/frv/kernel/irq-mb93493.c b/arch/frv/kernel/irq-mb93493.c new file mode 100644 index 000000000000..c003ae5e2b30 --- /dev/null +++ b/arch/frv/kernel/irq-mb93493.c | |||
@@ -0,0 +1,108 @@ | |||
1 | /* irq-mb93493.c: MB93493 companion chip interrupt handler | ||
2 | * | ||
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <linux/ptrace.h> | ||
14 | #include <linux/errno.h> | ||
15 | #include <linux/signal.h> | ||
16 | #include <linux/sched.h> | ||
17 | #include <linux/ioport.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/irq.h> | ||
21 | |||
22 | #include <asm/io.h> | ||
23 | #include <asm/system.h> | ||
24 | #include <asm/bitops.h> | ||
25 | #include <asm/delay.h> | ||
26 | #include <asm/irq.h> | ||
27 | #include <asm/irc-regs.h> | ||
28 | #include <asm/irq-routing.h> | ||
29 | #include <asm/mb93493-irqs.h> | ||
30 | |||
31 | static void frv_mb93493_doirq(struct irq_source *source); | ||
32 | |||
33 | /*****************************************************************************/ | ||
34 | /* | ||
35 | * MB93493 companion chip IRQ multiplexor | ||
36 | */ | ||
37 | static struct irq_source frv_mb93493[2] = { | ||
38 | [0] = { | ||
39 | .muxname = "mb93493.0", | ||
40 | .muxdata = __region_CS3 + 0x3d0, | ||
41 | .doirq = frv_mb93493_doirq, | ||
42 | .irqmask = 0x0000, | ||
43 | }, | ||
44 | [1] = { | ||
45 | .muxname = "mb93493.1", | ||
46 | .muxdata = __region_CS3 + 0x3d4, | ||
47 | .doirq = frv_mb93493_doirq, | ||
48 | .irqmask = 0x0000, | ||
49 | }, | ||
50 | }; | ||
51 | |||
52 | static void frv_mb93493_control(struct irq_group *group, int index, int on) | ||
53 | { | ||
54 | struct irq_source *source; | ||
55 | uint32_t iqsr; | ||
56 | |||
57 | if ((frv_mb93493[0].irqmask & (1 << index))) | ||
58 | source = &frv_mb93493[0]; | ||
59 | else | ||
60 | source = &frv_mb93493[1]; | ||
61 | |||
62 | iqsr = readl(source->muxdata); | ||
63 | if (on) | ||
64 | iqsr |= 1 << (index + 16); | ||
65 | else | ||
66 | iqsr &= ~(1 << (index + 16)); | ||
67 | |||
68 | writel(iqsr, source->muxdata); | ||
69 | } | ||
70 | |||
71 | static struct irq_group frv_mb93493_irqs = { | ||
72 | .first_irq = IRQ_BASE_MB93493, | ||
73 | .control = frv_mb93493_control, | ||
74 | }; | ||
75 | |||
76 | static void frv_mb93493_doirq(struct irq_source *source) | ||
77 | { | ||
78 | uint32_t mask = readl(source->muxdata); | ||
79 | mask = mask & (mask >> 16) & 0xffff; | ||
80 | |||
81 | if (mask) | ||
82 | distribute_irqs(&frv_mb93493_irqs, mask); | ||
83 | } | ||
84 | |||
85 | static void __init mb93493_irq_route(int irq, int source) | ||
86 | { | ||
87 | frv_mb93493[source].irqmask |= 1 << (irq - IRQ_BASE_MB93493); | ||
88 | frv_mb93493_irqs.sources[irq - IRQ_BASE_MB93493] = &frv_mb93493[source]; | ||
89 | } | ||
90 | |||
91 | void __init route_mb93493_irqs(void) | ||
92 | { | ||
93 | frv_irq_route_external(&frv_mb93493[0], IRQ_CPU_MB93493_0); | ||
94 | frv_irq_route_external(&frv_mb93493[1], IRQ_CPU_MB93493_1); | ||
95 | |||
96 | frv_irq_set_group(&frv_mb93493_irqs); | ||
97 | |||
98 | mb93493_irq_route(IRQ_MB93493_VDC, IRQ_MB93493_VDC_ROUTE); | ||
99 | mb93493_irq_route(IRQ_MB93493_VCC, IRQ_MB93493_VCC_ROUTE); | ||
100 | mb93493_irq_route(IRQ_MB93493_AUDIO_IN, IRQ_MB93493_AUDIO_IN_ROUTE); | ||
101 | mb93493_irq_route(IRQ_MB93493_I2C_0, IRQ_MB93493_I2C_0_ROUTE); | ||
102 | mb93493_irq_route(IRQ_MB93493_I2C_1, IRQ_MB93493_I2C_1_ROUTE); | ||
103 | mb93493_irq_route(IRQ_MB93493_USB, IRQ_MB93493_USB_ROUTE); | ||
104 | mb93493_irq_route(IRQ_MB93493_LOCAL_BUS, IRQ_MB93493_LOCAL_BUS_ROUTE); | ||
105 | mb93493_irq_route(IRQ_MB93493_PCMCIA, IRQ_MB93493_PCMCIA_ROUTE); | ||
106 | mb93493_irq_route(IRQ_MB93493_GPIO, IRQ_MB93493_GPIO_ROUTE); | ||
107 | mb93493_irq_route(IRQ_MB93493_AUDIO_OUT, IRQ_MB93493_AUDIO_OUT_ROUTE); | ||
108 | } | ||