2 * linux/arch/sh/boards/se/7722/irq.c
4 * Copyright (C) 2007 Nobuhiro Iwamatsu
6 * Hitachi UL SolutionEngine 7722 Support.
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
12 #include <linux/init.h>
13 #include <linux/irq.h>
14 #include <linux/interrupt.h>
17 #include <mach-se/mach/se7722.h>
19 unsigned int se7722_fpga_irq[SE7722_FPGA_IRQ_NR] = { 0, };
21 static void disable_se7722_irq(unsigned int irq)
23 unsigned int bit = (unsigned int)get_irq_chip_data(irq);
24 ctrl_outw(ctrl_inw(IRQ01_MASK) | 1 << bit, IRQ01_MASK);
27 static void enable_se7722_irq(unsigned int irq)
29 unsigned int bit = (unsigned int)get_irq_chip_data(irq);
30 ctrl_outw(ctrl_inw(IRQ01_MASK) & ~(1 << bit), IRQ01_MASK);
33 static struct irq_chip se7722_irq_chip __read_mostly = {
34 .name = "SE7722-FPGA",
35 .mask = disable_se7722_irq,
36 .unmask = enable_se7722_irq,
37 .mask_ack = disable_se7722_irq,
40 static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
42 unsigned short intv = ctrl_inw(IRQ01_STS);
43 unsigned int ext_irq = 0;
45 intv &= (1 << SE7722_FPGA_IRQ_NR) - 1;
47 for (; intv; intv >>= 1, ext_irq++) {
51 generic_handle_irq(se7722_fpga_irq[ext_irq]);
56 * Initialize IRQ setting
58 void __init init_se7722_IRQ(void)
62 ctrl_outw(0, IRQ01_MASK); /* disable all irqs */
63 ctrl_outw(0x2000, 0xb03fffec); /* mrshpc irq enable */
65 for (i = 0; i < SE7722_FPGA_IRQ_NR; i++) {
66 se7722_fpga_irq[i] = create_irq();
67 if (se7722_fpga_irq[i] < 0)
70 set_irq_chip_and_handler_name(se7722_fpga_irq[i],
72 handle_level_irq, "level");
74 set_irq_chip_data(se7722_fpga_irq[i], (void *)i);
77 set_irq_chained_handler(IRQ0_IRQ, se7722_irq_demux);
78 set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW);
80 set_irq_chained_handler(IRQ1_IRQ, se7722_irq_demux);
81 set_irq_type(IRQ1_IRQ, IRQ_TYPE_LEVEL_LOW);