aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/landisk/irq.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-27 18:16:47 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-27 18:16:47 -0400
commit3b9f6cb8a1ec791be79c6c7595fea922f12d1e64 (patch)
tree2393a448add846e6c2ed12f68106c3018b72c6a9 /arch/sh/boards/landisk/irq.c
parentc38778c3a9aeadcd1ee319cfc8ea5a9cbf8cdafa (diff)
parenta77c64c1a641950626181b4857abb701d8f38ccc (diff)
Merge branch 'master' into upstream
Diffstat (limited to 'arch/sh/boards/landisk/irq.c')
-rw-r--r--arch/sh/boards/landisk/irq.c99
1 files changed, 99 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..a006d6443225
--- /dev/null
+++ b/arch/sh/boards/landisk/irq.c
@@ -0,0 +1,99 @@
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
25static void enable_landisk_irq(unsigned int irq);
26static void disable_landisk_irq(unsigned int irq);
27
28/* shutdown is same as "disable" */
29#define shutdown_landisk_irq disable_landisk_irq
30
31static void ack_landisk_irq(unsigned int irq);
32static void end_landisk_irq(unsigned int irq);
33
34static unsigned int startup_landisk_irq(unsigned int irq)
35{
36 enable_landisk_irq(irq);
37 return 0; /* never anything pending */
38}
39
40static void disable_landisk_irq(unsigned int irq)
41{
42 unsigned char val;
43 unsigned char mask = 0xff ^ (0x01 << (irq - 5));
44
45 /* Set the priority in IPR to 0 */
46 val = ctrl_inb(PA_IMASK);
47 val &= mask;
48 ctrl_outb(val, PA_IMASK);
49}
50
51static void enable_landisk_irq(unsigned int irq)
52{
53 unsigned char val;
54 unsigned char value = (0x01 << (irq - 5));
55
56 /* Set priority in IPR back to original value */
57 val = ctrl_inb(PA_IMASK);
58 val |= value;
59 ctrl_outb(val, PA_IMASK);
60}
61
62static void ack_landisk_irq(unsigned int irq)
63{
64 disable_landisk_irq(irq);
65}
66
67static void end_landisk_irq(unsigned int irq)
68{
69 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
70 enable_landisk_irq(irq);
71}
72
73static struct hw_interrupt_type landisk_irq_type = {
74 .typename = "LANDISK IRQ",
75 .startup = startup_landisk_irq,
76 .shutdown = shutdown_landisk_irq,
77 .enable = enable_landisk_irq,
78 .disable = disable_landisk_irq,
79 .ack = ack_landisk_irq,
80 .end = end_landisk_irq
81};
82
83static void make_landisk_irq(unsigned int irq)
84{
85 disable_irq_nosync(irq);
86 irq_desc[irq].handler = &landisk_irq_type;
87 disable_landisk_irq(irq);
88}
89
90/*
91 * Initialize IRQ setting
92 */
93void __init init_landisk_IRQ(void)
94{
95 int i;
96
97 for (i = 5; i < 14; i++)
98 make_landisk_irq(i);
99}