1 /* irq-mb93493.c: MB93493 companion chip interrupt handler
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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.
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>
23 #include <asm/system.h>
24 #include <asm/bitops.h>
25 #include <asm/delay.h>
27 #include <asm/irc-regs.h>
28 #include <asm/irq-routing.h>
29 #include <asm/mb93493-irqs.h>
31 static void frv_mb93493_doirq(struct irq_source
*source
);
33 /*****************************************************************************/
35 * MB93493 companion chip IRQ multiplexor
37 static struct irq_source frv_mb93493
[2] = {
39 .muxname
= "mb93493.0",
40 .muxdata
= __region_CS3
+ 0x3d0,
41 .doirq
= frv_mb93493_doirq
,
45 .muxname
= "mb93493.1",
46 .muxdata
= __region_CS3
+ 0x3d4,
47 .doirq
= frv_mb93493_doirq
,
52 static void frv_mb93493_control(struct irq_group
*group
, int index
, int on
)
54 struct irq_source
*source
;
57 if ((frv_mb93493
[0].irqmask
& (1 << index
)))
58 source
= &frv_mb93493
[0];
60 source
= &frv_mb93493
[1];
62 iqsr
= readl(source
->muxdata
);
64 iqsr
|= 1 << (index
+ 16);
66 iqsr
&= ~(1 << (index
+ 16));
68 writel(iqsr
, source
->muxdata
);
71 static struct irq_group frv_mb93493_irqs
= {
72 .first_irq
= IRQ_BASE_MB93493
,
73 .control
= frv_mb93493_control
,
76 static void frv_mb93493_doirq(struct irq_source
*source
)
78 uint32_t mask
= readl(source
->muxdata
);
79 mask
= mask
& (mask
>> 16) & 0xffff;
82 distribute_irqs(&frv_mb93493_irqs
, mask
);
85 static void __init
mb93493_irq_route(int irq
, int source
)
87 frv_mb93493
[source
].irqmask
|= 1 << (irq
- IRQ_BASE_MB93493
);
88 frv_mb93493_irqs
.sources
[irq
- IRQ_BASE_MB93493
] = &frv_mb93493
[source
];
91 void __init
route_mb93493_irqs(void)
93 frv_irq_route_external(&frv_mb93493
[0], IRQ_CPU_MB93493_0
);
94 frv_irq_route_external(&frv_mb93493
[1], IRQ_CPU_MB93493_1
);
96 frv_irq_set_group(&frv_mb93493_irqs
);
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
);