diff options
Diffstat (limited to 'arch/sh/boards/landisk/irq.c')
-rw-r--r-- | arch/sh/boards/landisk/irq.c | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/arch/sh/boards/landisk/irq.c b/arch/sh/boards/landisk/irq.c new file mode 100644 index 000000000000..1dcc3feb7a44 --- /dev/null +++ b/arch/sh/boards/landisk/irq.c | |||
@@ -0,0 +1,105 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/landisk/irq.c | ||
3 | * | ||
4 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel | ||
5 | * Based largely on io_se.c. | ||
6 | * | ||
7 | * I/O routine for I-O Data Device, Inc. LANDISK. | ||
8 | * | ||
9 | * Initial version only to support LAN access; some | ||
10 | * placeholder code from io_landisk.c left in with the | ||
11 | * expectation of later SuperIO and PCMCIA access. | ||
12 | */ | ||
13 | /* | ||
14 | * modified by kogiidena | ||
15 | * 2005.03.03 | ||
16 | */ | ||
17 | |||
18 | #include <linux/config.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/irq.h> | ||
21 | #include <asm/io.h> | ||
22 | #include <asm/irq.h> | ||
23 | #include <asm/landisk/iodata_landisk.h> | ||
24 | |||
25 | static void enable_landisk_irq(unsigned int irq); | ||
26 | static void disable_landisk_irq(unsigned int irq); | ||
27 | |||
28 | /* shutdown is same as "disable" */ | ||
29 | #define shutdown_landisk_irq disable_landisk_irq | ||
30 | |||
31 | static void ack_landisk_irq(unsigned int irq); | ||
32 | static void end_landisk_irq(unsigned int irq); | ||
33 | |||
34 | static unsigned int startup_landisk_irq(unsigned int irq) | ||
35 | { | ||
36 | enable_landisk_irq(irq); | ||
37 | return 0; /* never anything pending */ | ||
38 | } | ||
39 | |||
40 | static void disable_landisk_irq(unsigned int irq) | ||
41 | { | ||
42 | unsigned long flags; | ||
43 | unsigned char val; | ||
44 | unsigned char mask = 0xff ^ (0x01 << (irq - 5)); | ||
45 | |||
46 | /* Set the priority in IPR to 0 */ | ||
47 | local_irq_save(flags); | ||
48 | val = ctrl_inb(PA_IMASK); | ||
49 | val &= mask; | ||
50 | ctrl_outb(val, PA_IMASK); | ||
51 | local_irq_restore(flags); | ||
52 | } | ||
53 | |||
54 | static void enable_landisk_irq(unsigned int irq) | ||
55 | { | ||
56 | unsigned long flags; | ||
57 | unsigned char val; | ||
58 | unsigned char value = (0x01 << (irq - 5)); | ||
59 | |||
60 | /* Set priority in IPR back to original value */ | ||
61 | local_irq_save(flags); | ||
62 | val = ctrl_inb(PA_IMASK); | ||
63 | val |= value; | ||
64 | ctrl_outb(val, PA_IMASK); | ||
65 | local_irq_restore(flags); | ||
66 | } | ||
67 | |||
68 | static void ack_landisk_irq(unsigned int irq) | ||
69 | { | ||
70 | disable_landisk_irq(irq); | ||
71 | } | ||
72 | |||
73 | static void end_landisk_irq(unsigned int irq) | ||
74 | { | ||
75 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | ||
76 | enable_landisk_irq(irq); | ||
77 | } | ||
78 | |||
79 | static struct hw_interrupt_type landisk_irq_type = { | ||
80 | .typename = "LANDISK IRQ", | ||
81 | .startup = startup_landisk_irq, | ||
82 | .shutdown = shutdown_landisk_irq, | ||
83 | .enable = enable_landisk_irq, | ||
84 | .disable = disable_landisk_irq, | ||
85 | .ack = ack_landisk_irq, | ||
86 | .end = end_landisk_irq | ||
87 | }; | ||
88 | |||
89 | static void make_landisk_irq(unsigned int irq) | ||
90 | { | ||
91 | disable_irq_nosync(irq); | ||
92 | irq_desc[irq].handler = &landisk_irq_type; | ||
93 | disable_landisk_irq(irq); | ||
94 | } | ||
95 | |||
96 | /* | ||
97 | * Initialize IRQ setting | ||
98 | */ | ||
99 | void __init init_landisk_IRQ(void) | ||
100 | { | ||
101 | int i; | ||
102 | |||
103 | for (i = 5; i < 14; i++) | ||
104 | make_landisk_irq(i); | ||
105 | } | ||