aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-02-07 14:32:23 -0500
committerJohn Crispin <blogic@openwrt.org>2013-02-16 19:25:41 -0500
commit7e69c10a8ee1f201c040997c6742c27e915730ad (patch)
tree6857d1c2fd9d40491bf393708dcd753b6703f663 /arch/mips
parent326e8d17d73fdf213f6334917ef46b2ba7b1354a (diff)
ath79: add ATH79_CPU_IRQ() macro
Remove the individual ATH79_CPU_IRQ_* constants and use the new macro instead of those. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Patchwork: http://patchwork.linux-mips.org/patch/4929/ Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/ath79/dev-usb.c12
-rw-r--r--arch/mips/ath79/dev-wmac.c8
-rw-r--r--arch/mips/ath79/irq.c32
-rw-r--r--arch/mips/ath79/pci.c6
-rw-r--r--arch/mips/include/asm/mach-ath79/irq.h9
5 files changed, 31 insertions, 36 deletions
diff --git a/arch/mips/ath79/dev-usb.c b/arch/mips/ath79/dev-usb.c
index bd2bc108e1b5..2e041977c854 100644
--- a/arch/mips/ath79/dev-usb.c
+++ b/arch/mips/ath79/dev-usb.c
@@ -111,7 +111,7 @@ static void __init ath79_usb_setup(void)
111 platform_device_register(&ath79_ohci_device); 111 platform_device_register(&ath79_ohci_device);
112 112
113 ath79_usb_init_resource(ath79_ehci_resources, AR71XX_EHCI_BASE, 113 ath79_usb_init_resource(ath79_ehci_resources, AR71XX_EHCI_BASE,
114 AR71XX_EHCI_SIZE, ATH79_CPU_IRQ_USB); 114 AR71XX_EHCI_SIZE, ATH79_CPU_IRQ(3));
115 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v1; 115 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v1;
116 platform_device_register(&ath79_ehci_device); 116 platform_device_register(&ath79_ehci_device);
117} 117}
@@ -136,7 +136,7 @@ static void __init ar7240_usb_setup(void)
136 iounmap(usb_ctrl_base); 136 iounmap(usb_ctrl_base);
137 137
138 ath79_usb_init_resource(ath79_ohci_resources, AR7240_OHCI_BASE, 138 ath79_usb_init_resource(ath79_ohci_resources, AR7240_OHCI_BASE,
139 AR7240_OHCI_SIZE, ATH79_CPU_IRQ_USB); 139 AR7240_OHCI_SIZE, ATH79_CPU_IRQ(3));
140 platform_device_register(&ath79_ohci_device); 140 platform_device_register(&ath79_ohci_device);
141} 141}
142 142
@@ -152,7 +152,7 @@ static void __init ar724x_usb_setup(void)
152 mdelay(10); 152 mdelay(10);
153 153
154 ath79_usb_init_resource(ath79_ehci_resources, AR724X_EHCI_BASE, 154 ath79_usb_init_resource(ath79_ehci_resources, AR724X_EHCI_BASE,
155 AR724X_EHCI_SIZE, ATH79_CPU_IRQ_USB); 155 AR724X_EHCI_SIZE, ATH79_CPU_IRQ(3));
156 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2; 156 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2;
157 platform_device_register(&ath79_ehci_device); 157 platform_device_register(&ath79_ehci_device);
158} 158}
@@ -169,7 +169,7 @@ static void __init ar913x_usb_setup(void)
169 mdelay(10); 169 mdelay(10);
170 170
171 ath79_usb_init_resource(ath79_ehci_resources, AR913X_EHCI_BASE, 171 ath79_usb_init_resource(ath79_ehci_resources, AR913X_EHCI_BASE,
172 AR913X_EHCI_SIZE, ATH79_CPU_IRQ_USB); 172 AR913X_EHCI_SIZE, ATH79_CPU_IRQ(3));
173 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2; 173 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2;
174 platform_device_register(&ath79_ehci_device); 174 platform_device_register(&ath79_ehci_device);
175} 175}
@@ -186,7 +186,7 @@ static void __init ar933x_usb_setup(void)
186 mdelay(10); 186 mdelay(10);
187 187
188 ath79_usb_init_resource(ath79_ehci_resources, AR933X_EHCI_BASE, 188 ath79_usb_init_resource(ath79_ehci_resources, AR933X_EHCI_BASE,
189 AR933X_EHCI_SIZE, ATH79_CPU_IRQ_USB); 189 AR933X_EHCI_SIZE, ATH79_CPU_IRQ(3));
190 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2; 190 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2;
191 platform_device_register(&ath79_ehci_device); 191 platform_device_register(&ath79_ehci_device);
192} 192}
@@ -212,7 +212,7 @@ static void __init ar934x_usb_setup(void)
212 udelay(1000); 212 udelay(1000);
213 213
214 ath79_usb_init_resource(ath79_ehci_resources, AR934X_EHCI_BASE, 214 ath79_usb_init_resource(ath79_ehci_resources, AR934X_EHCI_BASE,
215 AR934X_EHCI_SIZE, ATH79_CPU_IRQ_USB); 215 AR934X_EHCI_SIZE, ATH79_CPU_IRQ(3));
216 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2; 216 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2;
217 platform_device_register(&ath79_ehci_device); 217 platform_device_register(&ath79_ehci_device);
218} 218}
diff --git a/arch/mips/ath79/dev-wmac.c b/arch/mips/ath79/dev-wmac.c
index d6d893c16ad4..4f6c4e389172 100644
--- a/arch/mips/ath79/dev-wmac.c
+++ b/arch/mips/ath79/dev-wmac.c
@@ -55,8 +55,8 @@ static void __init ar913x_wmac_setup(void)
55 55
56 ath79_wmac_resources[0].start = AR913X_WMAC_BASE; 56 ath79_wmac_resources[0].start = AR913X_WMAC_BASE;
57 ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1; 57 ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1;
58 ath79_wmac_resources[1].start = ATH79_CPU_IRQ_IP2; 58 ath79_wmac_resources[1].start = ATH79_CPU_IRQ(2);
59 ath79_wmac_resources[1].end = ATH79_CPU_IRQ_IP2; 59 ath79_wmac_resources[1].end = ATH79_CPU_IRQ(2);
60} 60}
61 61
62 62
@@ -83,8 +83,8 @@ static void __init ar933x_wmac_setup(void)
83 83
84 ath79_wmac_resources[0].start = AR933X_WMAC_BASE; 84 ath79_wmac_resources[0].start = AR933X_WMAC_BASE;
85 ath79_wmac_resources[0].end = AR933X_WMAC_BASE + AR933X_WMAC_SIZE - 1; 85 ath79_wmac_resources[0].end = AR933X_WMAC_BASE + AR933X_WMAC_SIZE - 1;
86 ath79_wmac_resources[1].start = ATH79_CPU_IRQ_IP2; 86 ath79_wmac_resources[1].start = ATH79_CPU_IRQ(2);
87 ath79_wmac_resources[1].end = ATH79_CPU_IRQ_IP2; 87 ath79_wmac_resources[1].end = ATH79_CPU_IRQ(2);
88 88
89 t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); 89 t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
90 if (t & AR933X_BOOTSTRAP_REF_CLK_40) 90 if (t & AR933X_BOOTSTRAP_REF_CLK_40)
diff --git a/arch/mips/ath79/irq.c b/arch/mips/ath79/irq.c
index 219cfa1f5961..29348956d15d 100644
--- a/arch/mips/ath79/irq.c
+++ b/arch/mips/ath79/irq.c
@@ -114,7 +114,7 @@ static void __init ath79_misc_irq_init(void)
114 handle_level_irq); 114 handle_level_irq);
115 } 115 }
116 116
117 irq_set_chained_handler(ATH79_CPU_IRQ_MISC, ath79_misc_irq_handler); 117 irq_set_chained_handler(ATH79_CPU_IRQ(6), ath79_misc_irq_handler);
118} 118}
119 119
120static void ar934x_ip2_irq_dispatch(unsigned int irq, struct irq_desc *desc) 120static void ar934x_ip2_irq_dispatch(unsigned int irq, struct irq_desc *desc)
@@ -147,7 +147,7 @@ static void ar934x_ip2_irq_init(void)
147 irq_set_chip_and_handler(i, &dummy_irq_chip, 147 irq_set_chip_and_handler(i, &dummy_irq_chip,
148 handle_level_irq); 148 handle_level_irq);
149 149
150 irq_set_chained_handler(ATH79_CPU_IRQ_IP2, ar934x_ip2_irq_dispatch); 150 irq_set_chained_handler(ATH79_CPU_IRQ(2), ar934x_ip2_irq_dispatch);
151} 151}
152 152
153asmlinkage void plat_irq_dispatch(void) 153asmlinkage void plat_irq_dispatch(void)
@@ -157,22 +157,22 @@ asmlinkage void plat_irq_dispatch(void)
157 pending = read_c0_status() & read_c0_cause() & ST0_IM; 157 pending = read_c0_status() & read_c0_cause() & ST0_IM;
158 158
159 if (pending & STATUSF_IP7) 159 if (pending & STATUSF_IP7)
160 do_IRQ(ATH79_CPU_IRQ_TIMER); 160 do_IRQ(ATH79_CPU_IRQ(7));
161 161
162 else if (pending & STATUSF_IP2) 162 else if (pending & STATUSF_IP2)
163 ath79_ip2_handler(); 163 ath79_ip2_handler();
164 164
165 else if (pending & STATUSF_IP4) 165 else if (pending & STATUSF_IP4)
166 do_IRQ(ATH79_CPU_IRQ_GE0); 166 do_IRQ(ATH79_CPU_IRQ(4));
167 167
168 else if (pending & STATUSF_IP5) 168 else if (pending & STATUSF_IP5)
169 do_IRQ(ATH79_CPU_IRQ_GE1); 169 do_IRQ(ATH79_CPU_IRQ(5));
170 170
171 else if (pending & STATUSF_IP3) 171 else if (pending & STATUSF_IP3)
172 ath79_ip3_handler(); 172 ath79_ip3_handler();
173 173
174 else if (pending & STATUSF_IP6) 174 else if (pending & STATUSF_IP6)
175 do_IRQ(ATH79_CPU_IRQ_MISC); 175 do_IRQ(ATH79_CPU_IRQ(6));
176 176
177 else 177 else
178 spurious_interrupt(); 178 spurious_interrupt();
@@ -188,60 +188,60 @@ asmlinkage void plat_irq_dispatch(void)
188static void ar71xx_ip2_handler(void) 188static void ar71xx_ip2_handler(void)
189{ 189{
190 ath79_ddr_wb_flush(AR71XX_DDR_REG_FLUSH_PCI); 190 ath79_ddr_wb_flush(AR71XX_DDR_REG_FLUSH_PCI);
191 do_IRQ(ATH79_CPU_IRQ_IP2); 191 do_IRQ(ATH79_CPU_IRQ(2));
192} 192}
193 193
194static void ar724x_ip2_handler(void) 194static void ar724x_ip2_handler(void)
195{ 195{
196 ath79_ddr_wb_flush(AR724X_DDR_REG_FLUSH_PCIE); 196 ath79_ddr_wb_flush(AR724X_DDR_REG_FLUSH_PCIE);
197 do_IRQ(ATH79_CPU_IRQ_IP2); 197 do_IRQ(ATH79_CPU_IRQ(2));
198} 198}
199 199
200static void ar913x_ip2_handler(void) 200static void ar913x_ip2_handler(void)
201{ 201{
202 ath79_ddr_wb_flush(AR913X_DDR_REG_FLUSH_WMAC); 202 ath79_ddr_wb_flush(AR913X_DDR_REG_FLUSH_WMAC);
203 do_IRQ(ATH79_CPU_IRQ_IP2); 203 do_IRQ(ATH79_CPU_IRQ(2));
204} 204}
205 205
206static void ar933x_ip2_handler(void) 206static void ar933x_ip2_handler(void)
207{ 207{
208 ath79_ddr_wb_flush(AR933X_DDR_REG_FLUSH_WMAC); 208 ath79_ddr_wb_flush(AR933X_DDR_REG_FLUSH_WMAC);
209 do_IRQ(ATH79_CPU_IRQ_IP2); 209 do_IRQ(ATH79_CPU_IRQ(2));
210} 210}
211 211
212static void ar934x_ip2_handler(void) 212static void ar934x_ip2_handler(void)
213{ 213{
214 do_IRQ(ATH79_CPU_IRQ_IP2); 214 do_IRQ(ATH79_CPU_IRQ(2));
215} 215}
216 216
217static void ar71xx_ip3_handler(void) 217static void ar71xx_ip3_handler(void)
218{ 218{
219 ath79_ddr_wb_flush(AR71XX_DDR_REG_FLUSH_USB); 219 ath79_ddr_wb_flush(AR71XX_DDR_REG_FLUSH_USB);
220 do_IRQ(ATH79_CPU_IRQ_USB); 220 do_IRQ(ATH79_CPU_IRQ(3));
221} 221}
222 222
223static void ar724x_ip3_handler(void) 223static void ar724x_ip3_handler(void)
224{ 224{
225 ath79_ddr_wb_flush(AR724X_DDR_REG_FLUSH_USB); 225 ath79_ddr_wb_flush(AR724X_DDR_REG_FLUSH_USB);
226 do_IRQ(ATH79_CPU_IRQ_USB); 226 do_IRQ(ATH79_CPU_IRQ(3));
227} 227}
228 228
229static void ar913x_ip3_handler(void) 229static void ar913x_ip3_handler(void)
230{ 230{
231 ath79_ddr_wb_flush(AR913X_DDR_REG_FLUSH_USB); 231 ath79_ddr_wb_flush(AR913X_DDR_REG_FLUSH_USB);
232 do_IRQ(ATH79_CPU_IRQ_USB); 232 do_IRQ(ATH79_CPU_IRQ(3));
233} 233}
234 234
235static void ar933x_ip3_handler(void) 235static void ar933x_ip3_handler(void)
236{ 236{
237 ath79_ddr_wb_flush(AR933X_DDR_REG_FLUSH_USB); 237 ath79_ddr_wb_flush(AR933X_DDR_REG_FLUSH_USB);
238 do_IRQ(ATH79_CPU_IRQ_USB); 238 do_IRQ(ATH79_CPU_IRQ(3));
239} 239}
240 240
241static void ar934x_ip3_handler(void) 241static void ar934x_ip3_handler(void)
242{ 242{
243 ath79_ddr_wb_flush(AR934X_DDR_REG_FLUSH_USB); 243 ath79_ddr_wb_flush(AR934X_DDR_REG_FLUSH_USB);
244 do_IRQ(ATH79_CPU_IRQ_USB); 244 do_IRQ(ATH79_CPU_IRQ(3));
245} 245}
246 246
247void __init arch_init_irq(void) 247void __init arch_init_irq(void)
diff --git a/arch/mips/ath79/pci.c b/arch/mips/ath79/pci.c
index ea8aa10893d8..4350c252bce5 100644
--- a/arch/mips/ath79/pci.c
+++ b/arch/mips/ath79/pci.c
@@ -127,8 +127,8 @@ ath79_register_pci_ar71xx(void)
127 res[0].end = AR71XX_PCI_CFG_BASE + AR71XX_PCI_CFG_SIZE - 1; 127 res[0].end = AR71XX_PCI_CFG_BASE + AR71XX_PCI_CFG_SIZE - 1;
128 128
129 res[1].flags = IORESOURCE_IRQ; 129 res[1].flags = IORESOURCE_IRQ;
130 res[1].start = ATH79_CPU_IRQ_IP2; 130 res[1].start = ATH79_CPU_IRQ(2);
131 res[1].end = ATH79_CPU_IRQ_IP2; 131 res[1].end = ATH79_CPU_IRQ(2);
132 132
133 res[2].name = "io_base"; 133 res[2].name = "io_base";
134 res[2].flags = IORESOURCE_IO; 134 res[2].flags = IORESOURCE_IO;
@@ -208,7 +208,7 @@ int __init ath79_register_pci(void)
208 AR724X_PCI_MEM_BASE, 208 AR724X_PCI_MEM_BASE,
209 AR724X_PCI_MEM_SIZE, 209 AR724X_PCI_MEM_SIZE,
210 0, 210 0,
211 ATH79_CPU_IRQ_IP2); 211 ATH79_CPU_IRQ(2));
212 } else if (soc_is_ar9342() || 212 } else if (soc_is_ar9342() ||
213 soc_is_ar9344()) { 213 soc_is_ar9344()) {
214 u32 bootstrap; 214 u32 bootstrap;
diff --git a/arch/mips/include/asm/mach-ath79/irq.h b/arch/mips/include/asm/mach-ath79/irq.h
index 158ad7f41313..3dda4c24571d 100644
--- a/arch/mips/include/asm/mach-ath79/irq.h
+++ b/arch/mips/include/asm/mach-ath79/irq.h
@@ -12,6 +12,8 @@
12#define MIPS_CPU_IRQ_BASE 0 12#define MIPS_CPU_IRQ_BASE 0
13#define NR_IRQS 48 13#define NR_IRQS 48
14 14
15#define ATH79_CPU_IRQ(_x) (MIPS_CPU_IRQ_BASE + (_x))
16
15#define ATH79_MISC_IRQ_BASE 8 17#define ATH79_MISC_IRQ_BASE 8
16#define ATH79_MISC_IRQ_COUNT 32 18#define ATH79_MISC_IRQ_COUNT 32
17#define ATH79_MISC_IRQ(_x) (ATH79_MISC_IRQ_BASE + (_x)) 19#define ATH79_MISC_IRQ(_x) (ATH79_MISC_IRQ_BASE + (_x))
@@ -24,13 +26,6 @@
24#define ATH79_IP2_IRQ_COUNT 2 26#define ATH79_IP2_IRQ_COUNT 2
25#define ATH79_IP2_IRQ(_x) (ATH79_IP2_IRQ_BASE + (_x)) 27#define ATH79_IP2_IRQ(_x) (ATH79_IP2_IRQ_BASE + (_x))
26 28
27#define ATH79_CPU_IRQ_IP2 (MIPS_CPU_IRQ_BASE + 2)
28#define ATH79_CPU_IRQ_USB (MIPS_CPU_IRQ_BASE + 3)
29#define ATH79_CPU_IRQ_GE0 (MIPS_CPU_IRQ_BASE + 4)
30#define ATH79_CPU_IRQ_GE1 (MIPS_CPU_IRQ_BASE + 5)
31#define ATH79_CPU_IRQ_MISC (MIPS_CPU_IRQ_BASE + 6)
32#define ATH79_CPU_IRQ_TIMER (MIPS_CPU_IRQ_BASE + 7)
33
34#define ATH79_MISC_IRQ_TIMER (ATH79_MISC_IRQ_BASE + 0) 29#define ATH79_MISC_IRQ_TIMER (ATH79_MISC_IRQ_BASE + 0)
35#define ATH79_MISC_IRQ_ERROR (ATH79_MISC_IRQ_BASE + 1) 30#define ATH79_MISC_IRQ_ERROR (ATH79_MISC_IRQ_BASE + 1)
36#define ATH79_MISC_IRQ_GPIO (ATH79_MISC_IRQ_BASE + 2) 31#define ATH79_MISC_IRQ_GPIO (ATH79_MISC_IRQ_BASE + 2)