diff options
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/boards/renesas/r7780rp/irq.c | 105 |
1 files changed, 22 insertions, 83 deletions
diff --git a/arch/sh/boards/renesas/r7780rp/irq.c b/arch/sh/boards/renesas/r7780rp/irq.c index 2d960e9a3143..5519d3da6bc5 100644 --- a/arch/sh/boards/renesas/r7780rp/irq.c +++ b/arch/sh/boards/renesas/r7780rp/irq.c | |||
@@ -1,18 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/sh/boards/renesas/r7780rp/irq.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Kazumoto Kojima | ||
5 | * | ||
6 | * Renesas Solutions Highlander R7780RP-1 Support. | 2 | * Renesas Solutions Highlander R7780RP-1 Support. |
7 | * | 3 | * |
8 | * Modified for R7780RP-1 by | 4 | * Copyright (C) 2002 Atom Create Engineering Co., Ltd. |
9 | * Atom Create Engineering Co., Ltd. 2002. | 5 | * Copyright (C) 2006 Paul Mundt |
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | 10 | */ |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/irq.h> | 12 | #include <linux/irq.h> |
13 | #include <asm/io.h> | 13 | #include <asm/io.h> |
14 | #include <asm/irq.h> | ||
15 | #include <asm/r7780rp/r7780rp.h> | ||
16 | 14 | ||
17 | #ifdef CONFIG_SH_R7780MP | 15 | #ifdef CONFIG_SH_R7780MP |
18 | static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0}; | 16 | static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0}; |
@@ -20,71 +18,26 @@ static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0}; | |||
20 | static int mask_pos[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 5, 6, 4, 0, 1, 2, 0}; | 18 | static int mask_pos[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 5, 6, 4, 0, 1, 2, 0}; |
21 | #endif | 19 | #endif |
22 | 20 | ||
23 | static void enable_r7780rp_irq(unsigned int irq); | ||
24 | static void disable_r7780rp_irq(unsigned int irq); | ||
25 | |||
26 | /* shutdown is same as "disable" */ | ||
27 | #define shutdown_r7780rp_irq disable_r7780rp_irq | ||
28 | |||
29 | static void ack_r7780rp_irq(unsigned int irq); | ||
30 | static void end_r7780rp_irq(unsigned int irq); | ||
31 | |||
32 | static unsigned int startup_r7780rp_irq(unsigned int irq) | ||
33 | { | ||
34 | enable_r7780rp_irq(irq); | ||
35 | return 0; /* never anything pending */ | ||
36 | } | ||
37 | |||
38 | static void disable_r7780rp_irq(unsigned int irq) | ||
39 | { | ||
40 | unsigned short val; | ||
41 | unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]); | ||
42 | |||
43 | /* Set the priority in IPR to 0 */ | ||
44 | val = ctrl_inw(IRLCNTR1); | ||
45 | val &= mask; | ||
46 | ctrl_outw(val, IRLCNTR1); | ||
47 | } | ||
48 | |||
49 | static void enable_r7780rp_irq(unsigned int irq) | 21 | static void enable_r7780rp_irq(unsigned int irq) |
50 | { | 22 | { |
51 | unsigned short val; | ||
52 | unsigned short value = (0x0001 << mask_pos[irq]); | ||
53 | |||
54 | /* Set priority in IPR back to original value */ | 23 | /* Set priority in IPR back to original value */ |
55 | val = ctrl_inw(IRLCNTR1); | 24 | ctrl_outw(ctrl_inw(IRLCNTR1) | (1 << mask_pos[irq]), IRLCNTR1); |
56 | val |= value; | ||
57 | ctrl_outw(val, IRLCNTR1); | ||
58 | } | ||
59 | |||
60 | static void ack_r7780rp_irq(unsigned int irq) | ||
61 | { | ||
62 | disable_r7780rp_irq(irq); | ||
63 | } | 25 | } |
64 | 26 | ||
65 | static void end_r7780rp_irq(unsigned int irq) | 27 | static void disable_r7780rp_irq(unsigned int irq) |
66 | { | 28 | { |
67 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) | 29 | /* Set the priority in IPR to 0 */ |
68 | enable_r7780rp_irq(irq); | 30 | ctrl_outw(ctrl_inw(IRLCNTR1) & (0xffff ^ (1 << mask_pos[irq])), |
31 | IRLCNTR1); | ||
69 | } | 32 | } |
70 | 33 | ||
71 | static struct hw_interrupt_type r7780rp_irq_type = { | 34 | static struct irq_chip r7780rp_irq_chip __read_mostly = { |
72 | .typename = "R7780RP-IRQ", | 35 | .name = "r7780rp", |
73 | .startup = startup_r7780rp_irq, | 36 | .mask = disable_r7780rp_irq, |
74 | .shutdown = shutdown_r7780rp_irq, | 37 | .unmask = enable_r7780rp_irq, |
75 | .enable = enable_r7780rp_irq, | 38 | .mask_ack = disable_r7780rp_irq, |
76 | .disable = disable_r7780rp_irq, | ||
77 | .ack = ack_r7780rp_irq, | ||
78 | .end = end_r7780rp_irq, | ||
79 | }; | 39 | }; |
80 | 40 | ||
81 | static void make_r7780rp_irq(unsigned int irq) | ||
82 | { | ||
83 | disable_irq_nosync(irq); | ||
84 | irq_desc[irq].chip = &r7780rp_irq_type; | ||
85 | disable_r7780rp_irq(irq); | ||
86 | } | ||
87 | |||
88 | /* | 41 | /* |
89 | * Initialize IRQ setting | 42 | * Initialize IRQ setting |
90 | */ | 43 | */ |
@@ -92,24 +45,10 @@ void __init init_r7780rp_IRQ(void) | |||
92 | { | 45 | { |
93 | int i; | 46 | int i; |
94 | 47 | ||
95 | /* IRL0=PCI Slot #A | 48 | for (i = 0; i < 15; i++) { |
96 | * IRL1=PCI Slot #B | 49 | disable_irq_nosync(i); |
97 | * IRL2=PCI Slot #C | 50 | set_irq_chip_and_handler(i, &r7780rp_irq_chip, |
98 | * IRL3=PCI Slot #D | 51 | handle_level_irq); |
99 | * IRL4=CF Card | 52 | disable_r7780rp_irq(i); |
100 | * IRL5=CF Card Insert | 53 | } |
101 | * IRL6=M66596 | ||
102 | * IRL7=SD Card | ||
103 | * IRL8=Touch Panel | ||
104 | * IRL9=SCI | ||
105 | * IRL10=Serial | ||
106 | * IRL11=Extention #A | ||
107 | * IRL11=Extention #B | ||
108 | * IRL12=Debug LAN | ||
109 | * IRL13=Push Switch | ||
110 | * IRL14=ZiggBee IO | ||
111 | */ | ||
112 | |||
113 | for (i=0; i<15; i++) | ||
114 | make_r7780rp_irq(i); | ||
115 | } | 54 | } |