diff options
author | Manuel Lauss <manuel.lauss@googlemail.com> | 2009-10-07 14:15:15 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-02-27 06:52:53 -0500 |
commit | 788144656b8a862e724a1296e64ab6375eb541ed (patch) | |
tree | 96208eed56da25acdf9d923b9d9986e82dcd8944 /arch/mips/include/asm/mach-au1x00/gpio-au1000.h | |
parent | 93e9cd8485b31e5a33f1040bff4d15e65c0b2d19 (diff) |
MIPS: Alchemy: Stop IRQ name sharing
Eliminate the sharing of IRQ names among the differenct Alchemy
variants. IRQ numbers need no longer be hidden behind a
CONFIG_SOC_AU1XXX symbol: step 1 in my quest to make the Alchemy
code less reliant on a hardcoded subtype.
This patch also renames the GPIO irq number constants. It's really
an interrupt line, NOT a GPIO number!
Code which relied on certain irq numbers to have the same name
across all supported cpu subtypes is changed to determine current
cpu subtype at runtime; in some places this isn't possible so
a "compat" symbol is used.
Run-tested on DB1200.
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include/asm/mach-au1x00/gpio-au1000.h')
-rw-r--r-- | arch/mips/include/asm/mach-au1x00/gpio-au1000.h | 74 |
1 files changed, 32 insertions, 42 deletions
diff --git a/arch/mips/include/asm/mach-au1x00/gpio-au1000.h b/arch/mips/include/asm/mach-au1x00/gpio-au1000.h index 91595fa89034..9cf32d9dbb21 100644 --- a/arch/mips/include/asm/mach-au1x00/gpio-au1000.h +++ b/arch/mips/include/asm/mach-au1x00/gpio-au1000.h | |||
@@ -35,15 +35,13 @@ static inline int au1000_gpio2_to_irq(int gpio) | |||
35 | return -ENXIO; | 35 | return -ENXIO; |
36 | } | 36 | } |
37 | 37 | ||
38 | #ifdef CONFIG_SOC_AU1000 | ||
39 | static inline int au1000_irq_to_gpio(int irq) | 38 | static inline int au1000_irq_to_gpio(int irq) |
40 | { | 39 | { |
41 | if ((irq >= AU1000_GPIO_0) && (irq <= AU1000_GPIO_31)) | 40 | if ((irq >= AU1000_GPIO0_INT) && (irq <= AU1000_GPIO31_INT)) |
42 | return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0; | 41 | return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO0_INT) + 0; |
43 | 42 | ||
44 | return -ENXIO; | 43 | return -ENXIO; |
45 | } | 44 | } |
46 | #endif | ||
47 | 45 | ||
48 | static inline int au1500_gpio1_to_irq(int gpio) | 46 | static inline int au1500_gpio1_to_irq(int gpio) |
49 | { | 47 | { |
@@ -71,27 +69,25 @@ static inline int au1500_gpio2_to_irq(int gpio) | |||
71 | return -ENXIO; | 69 | return -ENXIO; |
72 | } | 70 | } |
73 | 71 | ||
74 | #ifdef CONFIG_SOC_AU1500 | ||
75 | static inline int au1500_irq_to_gpio(int irq) | 72 | static inline int au1500_irq_to_gpio(int irq) |
76 | { | 73 | { |
77 | switch (irq) { | 74 | switch (irq) { |
78 | case AU1000_GPIO_0 ... AU1000_GPIO_15: | 75 | case AU1500_GPIO0_INT ... AU1500_GPIO15_INT: |
79 | case AU1500_GPIO_20: | 76 | case AU1500_GPIO20_INT: |
80 | case AU1500_GPIO_23 ... AU1500_GPIO_28: | 77 | case AU1500_GPIO23_INT ... AU1500_GPIO28_INT: |
81 | return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0; | 78 | return ALCHEMY_GPIO1_BASE + (irq - AU1500_GPIO0_INT) + 0; |
82 | case AU1500_GPIO_200 ... AU1500_GPIO_203: | 79 | case AU1500_GPIO200_INT ... AU1500_GPIO203_INT: |
83 | return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO_200) + 0; | 80 | return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO200_INT) + 0; |
84 | case AU1500_GPIO_204 ... AU1500_GPIO_205: | 81 | case AU1500_GPIO204_INT ... AU1500_GPIO205_INT: |
85 | return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO_204) + 4; | 82 | return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO204_INT) + 4; |
86 | case AU1500_GPIO_206 ... AU1500_GPIO_207: | 83 | case AU1500_GPIO206_INT ... AU1500_GPIO207_INT: |
87 | return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO_206) + 6; | 84 | return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO206_INT) + 6; |
88 | case AU1500_GPIO_208_215: | 85 | case AU1500_GPIO208_215_INT: |
89 | return ALCHEMY_GPIO2_BASE + 8; | 86 | return ALCHEMY_GPIO2_BASE + 8; |
90 | } | 87 | } |
91 | 88 | ||
92 | return -ENXIO; | 89 | return -ENXIO; |
93 | } | 90 | } |
94 | #endif | ||
95 | 91 | ||
96 | static inline int au1100_gpio1_to_irq(int gpio) | 92 | static inline int au1100_gpio1_to_irq(int gpio) |
97 | { | 93 | { |
@@ -108,19 +104,17 @@ static inline int au1100_gpio2_to_irq(int gpio) | |||
108 | return -ENXIO; | 104 | return -ENXIO; |
109 | } | 105 | } |
110 | 106 | ||
111 | #ifdef CONFIG_SOC_AU1100 | ||
112 | static inline int au1100_irq_to_gpio(int irq) | 107 | static inline int au1100_irq_to_gpio(int irq) |
113 | { | 108 | { |
114 | switch (irq) { | 109 | switch (irq) { |
115 | case AU1000_GPIO_0 ... AU1000_GPIO_31: | 110 | case AU1100_GPIO0_INT ... AU1100_GPIO31_INT: |
116 | return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0; | 111 | return ALCHEMY_GPIO1_BASE + (irq - AU1100_GPIO0_INT) + 0; |
117 | case AU1100_GPIO_208_215: | 112 | case AU1100_GPIO208_215_INT: |
118 | return ALCHEMY_GPIO2_BASE + 8; | 113 | return ALCHEMY_GPIO2_BASE + 8; |
119 | } | 114 | } |
120 | 115 | ||
121 | return -ENXIO; | 116 | return -ENXIO; |
122 | } | 117 | } |
123 | #endif | ||
124 | 118 | ||
125 | static inline int au1550_gpio1_to_irq(int gpio) | 119 | static inline int au1550_gpio1_to_irq(int gpio) |
126 | { | 120 | { |
@@ -149,24 +143,22 @@ static inline int au1550_gpio2_to_irq(int gpio) | |||
149 | return -ENXIO; | 143 | return -ENXIO; |
150 | } | 144 | } |
151 | 145 | ||
152 | #ifdef CONFIG_SOC_AU1550 | ||
153 | static inline int au1550_irq_to_gpio(int irq) | 146 | static inline int au1550_irq_to_gpio(int irq) |
154 | { | 147 | { |
155 | switch (irq) { | 148 | switch (irq) { |
156 | case AU1000_GPIO_0 ... AU1000_GPIO_15: | 149 | case AU1550_GPIO0_INT ... AU1550_GPIO15_INT: |
157 | return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0; | 150 | return ALCHEMY_GPIO1_BASE + (irq - AU1550_GPIO0_INT) + 0; |
158 | case AU1550_GPIO_200: | 151 | case AU1550_GPIO200_INT: |
159 | case AU1500_GPIO_201_205: | 152 | case AU1550_GPIO201_205_INT: |
160 | return ALCHEMY_GPIO2_BASE + (irq - AU1550_GPIO_200) + 0; | 153 | return ALCHEMY_GPIO2_BASE + (irq - AU1550_GPIO200_INT) + 0; |
161 | case AU1500_GPIO_16 ... AU1500_GPIO_28: | 154 | case AU1550_GPIO16_INT ... AU1550_GPIO28_INT: |
162 | return ALCHEMY_GPIO1_BASE + (irq - AU1500_GPIO_16) + 16; | 155 | return ALCHEMY_GPIO1_BASE + (irq - AU1550_GPIO16_INT) + 16; |
163 | case AU1500_GPIO_206 ... AU1500_GPIO_208_218: | 156 | case AU1550_GPIO206_INT ... AU1550_GPIO208_215_INT: |
164 | return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO_206) + 6; | 157 | return ALCHEMY_GPIO2_BASE + (irq - AU1550_GPIO206_INT) + 6; |
165 | } | 158 | } |
166 | 159 | ||
167 | return -ENXIO; | 160 | return -ENXIO; |
168 | } | 161 | } |
169 | #endif | ||
170 | 162 | ||
171 | static inline int au1200_gpio1_to_irq(int gpio) | 163 | static inline int au1200_gpio1_to_irq(int gpio) |
172 | { | 164 | { |
@@ -187,23 +179,21 @@ static inline int au1200_gpio2_to_irq(int gpio) | |||
187 | return -ENXIO; | 179 | return -ENXIO; |
188 | } | 180 | } |
189 | 181 | ||
190 | #ifdef CONFIG_SOC_AU1200 | ||
191 | static inline int au1200_irq_to_gpio(int irq) | 182 | static inline int au1200_irq_to_gpio(int irq) |
192 | { | 183 | { |
193 | switch (irq) { | 184 | switch (irq) { |
194 | case AU1000_GPIO_0 ... AU1000_GPIO_31: | 185 | case AU1200_GPIO0_INT ... AU1200_GPIO31_INT: |
195 | return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0; | 186 | return ALCHEMY_GPIO1_BASE + (irq - AU1200_GPIO0_INT) + 0; |
196 | case AU1200_GPIO_200 ... AU1200_GPIO_202: | 187 | case AU1200_GPIO200_INT ... AU1200_GPIO202_INT: |
197 | return ALCHEMY_GPIO2_BASE + (irq - AU1200_GPIO_200) + 0; | 188 | return ALCHEMY_GPIO2_BASE + (irq - AU1200_GPIO200_INT) + 0; |
198 | case AU1200_GPIO_203: | 189 | case AU1200_GPIO203_INT: |
199 | return ALCHEMY_GPIO2_BASE + 3; | 190 | return ALCHEMY_GPIO2_BASE + 3; |
200 | case AU1200_GPIO_204 ... AU1200_GPIO_208_215: | 191 | case AU1200_GPIO204_INT ... AU1200_GPIO208_215_INT: |
201 | return ALCHEMY_GPIO2_BASE + (irq - AU1200_GPIO_204) + 4; | 192 | return ALCHEMY_GPIO2_BASE + (irq - AU1200_GPIO204_INT) + 4; |
202 | } | 193 | } |
203 | 194 | ||
204 | return -ENXIO; | 195 | return -ENXIO; |
205 | } | 196 | } |
206 | #endif | ||
207 | 197 | ||
208 | /* | 198 | /* |
209 | * GPIO1 block macros for common linux gpio functions. | 199 | * GPIO1 block macros for common linux gpio functions. |