xref: /openbmc/linux/arch/sh/boards/mach-landisk/irq.c (revision fd589a8f)
1 /*
2  * arch/sh/boards/landisk/irq.c
3  *
4  * I-O DATA Device, Inc. LANDISK Support
5  *
6  * Copyright (C) 2005-2007 kogiidena
7  *
8  * Copyright (C) 2001  Ian da Silva, Jeremy Siegel
9  * Based largely on io_se.c.
10  *
11  * This file is subject to the terms and conditions of the GNU General Public
12  * License.  See the file "COPYING" in the main directory of this archive
13  * for more details.
14  */
15 #include <linux/init.h>
16 #include <linux/irq.h>
17 #include <linux/interrupt.h>
18 #include <linux/io.h>
19 #include <mach-landisk/mach/iodata_landisk.h>
20 
21 static void disable_landisk_irq(unsigned int irq)
22 {
23 	unsigned char mask = 0xff ^ (0x01 << (irq - 5));
24 
25 	ctrl_outb(ctrl_inb(PA_IMASK) & mask, PA_IMASK);
26 }
27 
28 static void enable_landisk_irq(unsigned int irq)
29 {
30 	unsigned char value = (0x01 << (irq - 5));
31 
32 	ctrl_outb(ctrl_inb(PA_IMASK) | value, PA_IMASK);
33 }
34 
35 static struct irq_chip landisk_irq_chip __read_mostly = {
36 	.name		= "LANDISK",
37 	.mask		= disable_landisk_irq,
38 	.unmask		= enable_landisk_irq,
39 	.mask_ack	= disable_landisk_irq,
40 };
41 
42 /*
43  * Initialize IRQ setting
44  */
45 void __init init_landisk_IRQ(void)
46 {
47 	int i;
48 
49 	for (i = 5; i < 14; i++) {
50 		disable_irq_nosync(i);
51 		set_irq_chip_and_handler_name(i, &landisk_irq_chip,
52 					      handle_level_irq, "level");
53 		enable_landisk_irq(i);
54 	}
55 	ctrl_outb(0x00, PA_PWRINT_CLR);
56 }
57