diff options
Diffstat (limited to 'arch/sh/boards/landisk/irq.c')
-rw-r--r-- | arch/sh/boards/landisk/irq.c | 83 |
1 files changed, 21 insertions, 62 deletions
diff --git a/arch/sh/boards/landisk/irq.c b/arch/sh/boards/landisk/irq.c index 3eba6d086d7f..258649491d44 100644 --- a/arch/sh/boards/landisk/irq.c +++ b/arch/sh/boards/landisk/irq.c | |||
@@ -1,18 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * arch/sh/boards/landisk/irq.c | 2 | * arch/sh/boards/landisk/irq.c |
3 | * | 3 | * |
4 | * I-O DATA Device, Inc. LANDISK Support | ||
5 | * | ||
6 | * Copyright (C) 2005-2007 kogiidena | ||
7 | * | ||
4 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel | 8 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel |
5 | * Based largely on io_se.c. | 9 | * Based largely on io_se.c. |
6 | * | 10 | * |
7 | * I/O routine for I-O Data Device, Inc. LANDISK. | 11 | * This file is subject to the terms and conditions of the GNU General Public |
8 | * | 12 | * License. See the file "COPYING" in the main directory of this archive |
9 | * Initial version only to support LAN access; some | 13 | * for more details. |
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 | */ | 14 | */ |
17 | #include <linux/init.h> | 15 | #include <linux/init.h> |
18 | #include <linux/irq.h> | 16 | #include <linux/irq.h> |
@@ -20,71 +18,27 @@ | |||
20 | #include <linux/io.h> | 18 | #include <linux/io.h> |
21 | #include <asm/landisk/iodata_landisk.h> | 19 | #include <asm/landisk/iodata_landisk.h> |
22 | 20 | ||
23 | static void enable_landisk_irq(unsigned int irq); | ||
24 | static void disable_landisk_irq(unsigned int irq); | ||
25 | |||
26 | /* shutdown is same as "disable" */ | ||
27 | #define shutdown_landisk_irq disable_landisk_irq | ||
28 | |||
29 | static void ack_landisk_irq(unsigned int irq); | ||
30 | static void end_landisk_irq(unsigned int irq); | ||
31 | |||
32 | static unsigned int startup_landisk_irq(unsigned int irq) | ||
33 | { | ||
34 | enable_landisk_irq(irq); | ||
35 | return 0; /* never anything pending */ | ||
36 | } | ||
37 | |||
38 | static void disable_landisk_irq(unsigned int irq) | 21 | static void disable_landisk_irq(unsigned int irq) |
39 | { | 22 | { |
40 | unsigned char val; | ||
41 | unsigned char mask = 0xff ^ (0x01 << (irq - 5)); | 23 | unsigned char mask = 0xff ^ (0x01 << (irq - 5)); |
42 | 24 | ||
43 | /* Set the priority in IPR to 0 */ | 25 | ctrl_outb(ctrl_inb(PA_IMASK) & mask, PA_IMASK); |
44 | val = ctrl_inb(PA_IMASK); | ||
45 | val &= mask; | ||
46 | ctrl_outb(val, PA_IMASK); | ||
47 | } | 26 | } |
48 | 27 | ||
49 | static void enable_landisk_irq(unsigned int irq) | 28 | static void enable_landisk_irq(unsigned int irq) |
50 | { | 29 | { |
51 | unsigned char val; | ||
52 | unsigned char value = (0x01 << (irq - 5)); | 30 | unsigned char value = (0x01 << (irq - 5)); |
53 | 31 | ||
54 | /* Set priority in IPR back to original value */ | 32 | ctrl_outb(ctrl_inb(PA_IMASK) | value, PA_IMASK); |
55 | val = ctrl_inb(PA_IMASK); | ||
56 | val |= value; | ||
57 | ctrl_outb(val, PA_IMASK); | ||
58 | } | ||
59 | |||
60 | static void ack_landisk_irq(unsigned int irq) | ||
61 | { | ||
62 | disable_landisk_irq(irq); | ||
63 | } | ||
64 | |||
65 | static void end_landisk_irq(unsigned int irq) | ||
66 | { | ||
67 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | ||
68 | enable_landisk_irq(irq); | ||
69 | } | 33 | } |
70 | 34 | ||
71 | static struct hw_interrupt_type landisk_irq_type = { | 35 | static struct irq_chip landisk_irq_chip __read_mostly = { |
72 | .typename = "LANDISK IRQ", | 36 | .name = "LANDISK", |
73 | .startup = startup_landisk_irq, | 37 | .mask = disable_landisk_irq, |
74 | .shutdown = shutdown_landisk_irq, | 38 | .unmask = enable_landisk_irq, |
75 | .enable = enable_landisk_irq, | 39 | .mask_ack = disable_landisk_irq, |
76 | .disable = disable_landisk_irq, | ||
77 | .ack = ack_landisk_irq, | ||
78 | .end = end_landisk_irq | ||
79 | }; | 40 | }; |
80 | 41 | ||
81 | static void make_landisk_irq(unsigned int irq) | ||
82 | { | ||
83 | disable_irq_nosync(irq); | ||
84 | irq_desc[irq].chip = &landisk_irq_type; | ||
85 | disable_landisk_irq(irq); | ||
86 | } | ||
87 | |||
88 | /* | 42 | /* |
89 | * Initialize IRQ setting | 43 | * Initialize IRQ setting |
90 | */ | 44 | */ |
@@ -92,6 +46,11 @@ void __init init_landisk_IRQ(void) | |||
92 | { | 46 | { |
93 | int i; | 47 | int i; |
94 | 48 | ||
95 | for (i = 5; i < 14; i++) | 49 | for (i = 5; i < 14; i++) { |
96 | make_landisk_irq(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); | ||
97 | } | 56 | } |