aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mips/au1000/common/au1xxx_irqmap.c2
-rw-r--r--arch/mips/au1000/common/dbdma.c2
-rw-r--r--arch/mips/au1000/common/irq.c662
-rw-r--r--arch/mips/au1000/common/prom.c61
-rw-r--r--arch/mips/au1000/common/setup.c5
-rw-r--r--arch/mips/au1000/db1x00/init.c10
-rw-r--r--arch/mips/au1000/db1x00/irqmap.c2
-rw-r--r--arch/mips/au1000/mtx-1/init.c6
-rw-r--r--arch/mips/au1000/mtx-1/irqmap.c2
-rw-r--r--arch/mips/au1000/pb1000/init.c10
-rw-r--r--arch/mips/au1000/pb1000/irqmap.c2
-rw-r--r--arch/mips/au1000/pb1100/init.c10
-rw-r--r--arch/mips/au1000/pb1100/irqmap.c2
-rw-r--r--arch/mips/au1000/pb1200/board_setup.c6
-rw-r--r--arch/mips/au1000/pb1200/init.c10
-rw-r--r--arch/mips/au1000/pb1200/irqmap.c4
-rw-r--r--arch/mips/au1000/pb1500/init.c10
-rw-r--r--arch/mips/au1000/pb1500/irqmap.c2
-rw-r--r--arch/mips/au1000/pb1550/init.c10
-rw-r--r--arch/mips/au1000/pb1550/irqmap.c2
-rw-r--r--arch/mips/au1000/xxs1500/init.c10
-rw-r--r--arch/mips/au1000/xxs1500/irqmap.c2
-rw-r--r--arch/mips/jmr3927/rbhma3100/setup.c2
-rw-r--r--arch/mips/kernel/ptrace.c4
-rw-r--r--arch/mips/kernel/smp.c6
-rw-r--r--arch/mips/kernel/time.c2
-rw-r--r--arch/mips/kernel/traps.c21
-rw-r--r--arch/mips/kernel/vmlinux.lds.S15
-rw-r--r--arch/mips/kernel/vpe.c27
-rw-r--r--arch/mips/lasat/interrupt.c8
-rw-r--r--arch/mips/mipssim/sim_cmdline.c5
-rw-r--r--arch/mips/mm/c-r4k.c10
-rw-r--r--arch/mips/mm/fault.c2
-rw-r--r--arch/mips/mm/init.c19
-rw-r--r--arch/mips/mm/tlbex.c96
-rw-r--r--arch/mips/pci/pci-lasat.c19
-rw-r--r--arch/mips/sgi-ip22/Makefile2
-rw-r--r--arch/mips/sgi-ip22/ip22-reset.c9
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c162
-rw-r--r--arch/mips/sgi-ip32/ip32-setup.c2
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c2
42 files changed, 607 insertions, 640 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index f943736541cb..235d4514e0a9 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -133,6 +133,7 @@ config LASAT
133 select DMA_NONCOHERENT 133 select DMA_NONCOHERENT
134 select SYS_HAS_EARLY_PRINTK 134 select SYS_HAS_EARLY_PRINTK
135 select HW_HAS_PCI 135 select HW_HAS_PCI
136 select IRQ_CPU
136 select PCI_GT64XXX_PCI0 137 select PCI_GT64XXX_PCI0
137 select MIPS_NILE4 138 select MIPS_NILE4
138 select R5000_CPU_SCACHE 139 select R5000_CPU_SCACHE
@@ -410,6 +411,7 @@ config SGI_IP32
410 select BOOT_ELF32 411 select BOOT_ELF32
411 select DMA_NONCOHERENT 412 select DMA_NONCOHERENT
412 select HW_HAS_PCI 413 select HW_HAS_PCI
414 select IRQ_CPU
413 select R5000_CPU_SCACHE 415 select R5000_CPU_SCACHE
414 select RM7000_CPU_SCACHE 416 select RM7000_CPU_SCACHE
415 select SYS_HAS_CPU_R5000 417 select SYS_HAS_CPU_R5000
diff --git a/arch/mips/au1000/common/au1xxx_irqmap.c b/arch/mips/au1000/common/au1xxx_irqmap.c
index 7acfe9bf5fc3..98a4e34b0248 100644
--- a/arch/mips/au1000/common/au1xxx_irqmap.c
+++ b/arch/mips/au1000/common/au1xxx_irqmap.c
@@ -54,7 +54,7 @@
54 * Careful if you change match 2 request! 54 * Careful if you change match 2 request!
55 * The interrupt handler is called directly from the low level dispatch code. 55 * The interrupt handler is called directly from the low level dispatch code.
56 */ 56 */
57au1xxx_irq_map_t __initdata au1xxx_ic0_map[] = { 57struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
58 58
59#if defined(CONFIG_SOC_AU1000) 59#if defined(CONFIG_SOC_AU1000)
60 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 60 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0},
diff --git a/arch/mips/au1000/common/dbdma.c b/arch/mips/au1000/common/dbdma.c
index 461cf0139737..9d6ad43fded6 100644
--- a/arch/mips/au1000/common/dbdma.c
+++ b/arch/mips/au1000/common/dbdma.c
@@ -859,7 +859,7 @@ dbdma_interrupt(int irq, void *dev_id)
859 859
860 intstat = dbdma_gptr->ddma_intstat; 860 intstat = dbdma_gptr->ddma_intstat;
861 au_sync(); 861 au_sync();
862 chan_index = au_ffs(intstat) - 1; 862 chan_index = ffs(intstat);
863 863
864 ctp = chan_tab_ptr[chan_index]; 864 ctp = chan_tab_ptr[chan_index];
865 cp = ctp->chan_ptr; 865 cp = ctp->chan_ptr;
diff --git a/arch/mips/au1000/common/irq.c b/arch/mips/au1000/common/irq.c
index a6640b998c6e..c00f308fd505 100644
--- a/arch/mips/au1000/common/irq.c
+++ b/arch/mips/au1000/common/irq.c
@@ -26,39 +26,18 @@
26 * with this program; if not, write to the Free Software Foundation, Inc., 26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA. 27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */ 28 */
29#include <linux/errno.h> 29#include <linux/bitops.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/irq.h> 31#include <linux/io.h>
32#include <linux/kernel_stat.h>
33#include <linux/module.h>
34#include <linux/signal.h>
35#include <linux/sched.h>
36#include <linux/types.h>
37#include <linux/interrupt.h> 32#include <linux/interrupt.h>
38#include <linux/ioport.h> 33#include <linux/irq.h>
39#include <linux/timex.h>
40#include <linux/slab.h>
41#include <linux/random.h>
42#include <linux/delay.h>
43#include <linux/bitops.h>
44 34
45#include <asm/bootinfo.h>
46#include <asm/io.h>
47#include <asm/mipsregs.h> 35#include <asm/mipsregs.h>
48#include <asm/system.h>
49#include <asm/mach-au1x00/au1000.h> 36#include <asm/mach-au1x00/au1000.h>
50#ifdef CONFIG_MIPS_PB1000 37#ifdef CONFIG_MIPS_PB1000
51#include <asm/mach-pb1x00/pb1000.h> 38#include <asm/mach-pb1x00/pb1000.h>
52#endif 39#endif
53 40
54#undef DEBUG_IRQ
55#ifdef DEBUG_IRQ
56/* note: prints function name for you */
57#define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args)
58#else
59#define DPRINTK(fmt, args...)
60#endif
61
62#define EXT_INTC0_REQ0 2 /* IP 2 */ 41#define EXT_INTC0_REQ0 2 /* IP 2 */
63#define EXT_INTC0_REQ1 3 /* IP 3 */ 42#define EXT_INTC0_REQ1 3 /* IP 3 */
64#define EXT_INTC1_REQ0 4 /* IP 4 */ 43#define EXT_INTC1_REQ0 4 /* IP 4 */
@@ -69,16 +48,98 @@ void (*board_init_irq)(void);
69 48
70static DEFINE_SPINLOCK(irq_lock); 49static DEFINE_SPINLOCK(irq_lock);
71 50
51#ifdef CONFIG_PM
52
53/*
54 * Save/restore the interrupt controller state.
55 * Called from the save/restore core registers as part of the
56 * au_sleep function in power.c.....maybe I should just pm_register()
57 * them instead?
58 */
59static unsigned int sleep_intctl_config0[2];
60static unsigned int sleep_intctl_config1[2];
61static unsigned int sleep_intctl_config2[2];
62static unsigned int sleep_intctl_src[2];
63static unsigned int sleep_intctl_assign[2];
64static unsigned int sleep_intctl_wake[2];
65static unsigned int sleep_intctl_mask[2];
66
67void save_au1xxx_intctl(void)
68{
69 sleep_intctl_config0[0] = au_readl(IC0_CFG0RD);
70 sleep_intctl_config1[0] = au_readl(IC0_CFG1RD);
71 sleep_intctl_config2[0] = au_readl(IC0_CFG2RD);
72 sleep_intctl_src[0] = au_readl(IC0_SRCRD);
73 sleep_intctl_assign[0] = au_readl(IC0_ASSIGNRD);
74 sleep_intctl_wake[0] = au_readl(IC0_WAKERD);
75 sleep_intctl_mask[0] = au_readl(IC0_MASKRD);
76
77 sleep_intctl_config0[1] = au_readl(IC1_CFG0RD);
78 sleep_intctl_config1[1] = au_readl(IC1_CFG1RD);
79 sleep_intctl_config2[1] = au_readl(IC1_CFG2RD);
80 sleep_intctl_src[1] = au_readl(IC1_SRCRD);
81 sleep_intctl_assign[1] = au_readl(IC1_ASSIGNRD);
82 sleep_intctl_wake[1] = au_readl(IC1_WAKERD);
83 sleep_intctl_mask[1] = au_readl(IC1_MASKRD);
84}
85
86/*
87 * For most restore operations, we clear the entire register and
88 * then set the bits we found during the save.
89 */
90void restore_au1xxx_intctl(void)
91{
92 au_writel(0xffffffff, IC0_MASKCLR); au_sync();
93
94 au_writel(0xffffffff, IC0_CFG0CLR); au_sync();
95 au_writel(sleep_intctl_config0[0], IC0_CFG0SET); au_sync();
96 au_writel(0xffffffff, IC0_CFG1CLR); au_sync();
97 au_writel(sleep_intctl_config1[0], IC0_CFG1SET); au_sync();
98 au_writel(0xffffffff, IC0_CFG2CLR); au_sync();
99 au_writel(sleep_intctl_config2[0], IC0_CFG2SET); au_sync();
100 au_writel(0xffffffff, IC0_SRCCLR); au_sync();
101 au_writel(sleep_intctl_src[0], IC0_SRCSET); au_sync();
102 au_writel(0xffffffff, IC0_ASSIGNCLR); au_sync();
103 au_writel(sleep_intctl_assign[0], IC0_ASSIGNSET); au_sync();
104 au_writel(0xffffffff, IC0_WAKECLR); au_sync();
105 au_writel(sleep_intctl_wake[0], IC0_WAKESET); au_sync();
106 au_writel(0xffffffff, IC0_RISINGCLR); au_sync();
107 au_writel(0xffffffff, IC0_FALLINGCLR); au_sync();
108 au_writel(0x00000000, IC0_TESTBIT); au_sync();
109
110 au_writel(0xffffffff, IC1_MASKCLR); au_sync();
111
112 au_writel(0xffffffff, IC1_CFG0CLR); au_sync();
113 au_writel(sleep_intctl_config0[1], IC1_CFG0SET); au_sync();
114 au_writel(0xffffffff, IC1_CFG1CLR); au_sync();
115 au_writel(sleep_intctl_config1[1], IC1_CFG1SET); au_sync();
116 au_writel(0xffffffff, IC1_CFG2CLR); au_sync();
117 au_writel(sleep_intctl_config2[1], IC1_CFG2SET); au_sync();
118 au_writel(0xffffffff, IC1_SRCCLR); au_sync();
119 au_writel(sleep_intctl_src[1], IC1_SRCSET); au_sync();
120 au_writel(0xffffffff, IC1_ASSIGNCLR); au_sync();
121 au_writel(sleep_intctl_assign[1], IC1_ASSIGNSET); au_sync();
122 au_writel(0xffffffff, IC1_WAKECLR); au_sync();
123 au_writel(sleep_intctl_wake[1], IC1_WAKESET); au_sync();
124 au_writel(0xffffffff, IC1_RISINGCLR); au_sync();
125 au_writel(0xffffffff, IC1_FALLINGCLR); au_sync();
126 au_writel(0x00000000, IC1_TESTBIT); au_sync();
127
128 au_writel(sleep_intctl_mask[1], IC1_MASKSET); au_sync();
129
130 au_writel(sleep_intctl_mask[0], IC0_MASKSET); au_sync();
131}
132#endif /* CONFIG_PM */
133
72 134
73inline void local_enable_irq(unsigned int irq_nr) 135inline void local_enable_irq(unsigned int irq_nr)
74{ 136{
75 if (irq_nr > AU1000_LAST_INTC0_INT) { 137 if (irq_nr > AU1000_LAST_INTC0_INT) {
76 au_writel(1<<(irq_nr-32), IC1_MASKSET); 138 au_writel(1 << (irq_nr - 32), IC1_MASKSET);
77 au_writel(1<<(irq_nr-32), IC1_WAKESET); 139 au_writel(1 << (irq_nr - 32), IC1_WAKESET);
78 } 140 } else {
79 else { 141 au_writel(1 << irq_nr, IC0_MASKSET);
80 au_writel(1<<irq_nr, IC0_MASKSET); 142 au_writel(1 << irq_nr, IC0_WAKESET);
81 au_writel(1<<irq_nr, IC0_WAKESET);
82 } 143 }
83 au_sync(); 144 au_sync();
84} 145}
@@ -87,12 +148,11 @@ inline void local_enable_irq(unsigned int irq_nr)
87inline void local_disable_irq(unsigned int irq_nr) 148inline void local_disable_irq(unsigned int irq_nr)
88{ 149{
89 if (irq_nr > AU1000_LAST_INTC0_INT) { 150 if (irq_nr > AU1000_LAST_INTC0_INT) {
90 au_writel(1<<(irq_nr-32), IC1_MASKCLR); 151 au_writel(1 << (irq_nr - 32), IC1_MASKCLR);
91 au_writel(1<<(irq_nr-32), IC1_WAKECLR); 152 au_writel(1 << (irq_nr - 32), IC1_WAKECLR);
92 } 153 } else {
93 else { 154 au_writel(1 << irq_nr, IC0_MASKCLR);
94 au_writel(1<<irq_nr, IC0_MASKCLR); 155 au_writel(1 << irq_nr, IC0_WAKECLR);
95 au_writel(1<<irq_nr, IC0_WAKECLR);
96 } 156 }
97 au_sync(); 157 au_sync();
98} 158}
@@ -101,12 +161,11 @@ inline void local_disable_irq(unsigned int irq_nr)
101static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr) 161static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr)
102{ 162{
103 if (irq_nr > AU1000_LAST_INTC0_INT) { 163 if (irq_nr > AU1000_LAST_INTC0_INT) {
104 au_writel(1<<(irq_nr-32), IC1_RISINGCLR); 164 au_writel(1 << (irq_nr - 32), IC1_RISINGCLR);
105 au_writel(1<<(irq_nr-32), IC1_MASKCLR); 165 au_writel(1 << (irq_nr - 32), IC1_MASKCLR);
106 } 166 } else {
107 else { 167 au_writel(1 << irq_nr, IC0_RISINGCLR);
108 au_writel(1<<irq_nr, IC0_RISINGCLR); 168 au_writel(1 << irq_nr, IC0_MASKCLR);
109 au_writel(1<<irq_nr, IC0_MASKCLR);
110 } 169 }
111 au_sync(); 170 au_sync();
112} 171}
@@ -115,12 +174,11 @@ static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr)
115static inline void mask_and_ack_fall_edge_irq(unsigned int irq_nr) 174static inline void mask_and_ack_fall_edge_irq(unsigned int irq_nr)
116{ 175{
117 if (irq_nr > AU1000_LAST_INTC0_INT) { 176 if (irq_nr > AU1000_LAST_INTC0_INT) {
118 au_writel(1<<(irq_nr-32), IC1_FALLINGCLR); 177 au_writel(1 << (irq_nr - 32), IC1_FALLINGCLR);
119 au_writel(1<<(irq_nr-32), IC1_MASKCLR); 178 au_writel(1 << (irq_nr - 32), IC1_MASKCLR);
120 } 179 } else {
121 else { 180 au_writel(1 << irq_nr, IC0_FALLINGCLR);
122 au_writel(1<<irq_nr, IC0_FALLINGCLR); 181 au_writel(1 << irq_nr, IC0_MASKCLR);
123 au_writel(1<<irq_nr, IC0_MASKCLR);
124 } 182 }
125 au_sync(); 183 au_sync();
126} 184}
@@ -132,14 +190,13 @@ static inline void mask_and_ack_either_edge_irq(unsigned int irq_nr)
132 * both edges at once, or if we do, that we don't care. 190 * both edges at once, or if we do, that we don't care.
133 */ 191 */
134 if (irq_nr > AU1000_LAST_INTC0_INT) { 192 if (irq_nr > AU1000_LAST_INTC0_INT) {
135 au_writel(1<<(irq_nr-32), IC1_FALLINGCLR); 193 au_writel(1 << (irq_nr - 32), IC1_FALLINGCLR);
136 au_writel(1<<(irq_nr-32), IC1_RISINGCLR); 194 au_writel(1 << (irq_nr - 32), IC1_RISINGCLR);
137 au_writel(1<<(irq_nr-32), IC1_MASKCLR); 195 au_writel(1 << (irq_nr - 32), IC1_MASKCLR);
138 } 196 } else {
139 else { 197 au_writel(1 << irq_nr, IC0_FALLINGCLR);
140 au_writel(1<<irq_nr, IC0_FALLINGCLR); 198 au_writel(1 << irq_nr, IC0_RISINGCLR);
141 au_writel(1<<irq_nr, IC0_RISINGCLR); 199 au_writel(1 << irq_nr, IC0_MASKCLR);
142 au_writel(1<<irq_nr, IC0_MASKCLR);
143 } 200 }
144 au_sync(); 201 au_sync();
145} 202}
@@ -162,9 +219,9 @@ static inline void mask_and_ack_level_irq(unsigned int irq_nr)
162 219
163static void end_irq(unsigned int irq_nr) 220static void end_irq(unsigned int irq_nr)
164{ 221{
165 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))) { 222 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
166 local_enable_irq(irq_nr); 223 local_enable_irq(irq_nr);
167 } 224
168#if defined(CONFIG_MIPS_PB1000) 225#if defined(CONFIG_MIPS_PB1000)
169 if (irq_nr == AU1000_GPIO_15) { 226 if (irq_nr == AU1000_GPIO_15) {
170 au_writel(0x4000, PB1000_MDR); /* enable int */ 227 au_writel(0x4000, PB1000_MDR); /* enable int */
@@ -181,15 +238,12 @@ unsigned long save_local_and_disable(int controller)
181 spin_lock_irqsave(&irq_lock, flags); 238 spin_lock_irqsave(&irq_lock, flags);
182 if (controller) { 239 if (controller) {
183 mask = au_readl(IC1_MASKSET); 240 mask = au_readl(IC1_MASKSET);
184 for (i=32; i<64; i++) { 241 for (i = 32; i < 64; i++)
185 local_disable_irq(i); 242 local_disable_irq(i);
186 } 243 } else {
187 }
188 else {
189 mask = au_readl(IC0_MASKSET); 244 mask = au_readl(IC0_MASKSET);
190 for (i=0; i<32; i++) { 245 for (i = 0; i < 32; i++)
191 local_disable_irq(i); 246 local_disable_irq(i);
192 }
193 } 247 }
194 spin_unlock_irqrestore(&irq_lock, flags); 248 spin_unlock_irqrestore(&irq_lock, flags);
195 249
@@ -202,10 +256,10 @@ void restore_local_and_enable(int controller, unsigned long mask)
202 unsigned long flags, new_mask; 256 unsigned long flags, new_mask;
203 257
204 spin_lock_irqsave(&irq_lock, flags); 258 spin_lock_irqsave(&irq_lock, flags);
205 for (i=0; i<32; i++) { 259 for (i = 0; i < 32; i++) {
206 if (mask & (1<<i)) { 260 if (mask & (1 << i)) {
207 if (controller) 261 if (controller)
208 local_enable_irq(i+32); 262 local_enable_irq(i + 32);
209 else 263 else
210 local_enable_irq(i); 264 local_enable_irq(i);
211 } 265 }
@@ -220,39 +274,39 @@ void restore_local_and_enable(int controller, unsigned long mask)
220 274
221 275
222static struct irq_chip rise_edge_irq_type = { 276static struct irq_chip rise_edge_irq_type = {
223 .name = "Au1000 Rise Edge", 277 .name = "Au1000 Rise Edge",
224 .ack = mask_and_ack_rise_edge_irq, 278 .ack = mask_and_ack_rise_edge_irq,
225 .mask = local_disable_irq, 279 .mask = local_disable_irq,
226 .mask_ack = mask_and_ack_rise_edge_irq, 280 .mask_ack = mask_and_ack_rise_edge_irq,
227 .unmask = local_enable_irq, 281 .unmask = local_enable_irq,
228 .end = end_irq, 282 .end = end_irq,
229}; 283};
230 284
231static struct irq_chip fall_edge_irq_type = { 285static struct irq_chip fall_edge_irq_type = {
232 .name = "Au1000 Fall Edge", 286 .name = "Au1000 Fall Edge",
233 .ack = mask_and_ack_fall_edge_irq, 287 .ack = mask_and_ack_fall_edge_irq,
234 .mask = local_disable_irq, 288 .mask = local_disable_irq,
235 .mask_ack = mask_and_ack_fall_edge_irq, 289 .mask_ack = mask_and_ack_fall_edge_irq,
236 .unmask = local_enable_irq, 290 .unmask = local_enable_irq,
237 .end = end_irq, 291 .end = end_irq,
238}; 292};
239 293
240static struct irq_chip either_edge_irq_type = { 294static struct irq_chip either_edge_irq_type = {
241 .name = "Au1000 Rise or Fall Edge", 295 .name = "Au1000 Rise or Fall Edge",
242 .ack = mask_and_ack_either_edge_irq, 296 .ack = mask_and_ack_either_edge_irq,
243 .mask = local_disable_irq, 297 .mask = local_disable_irq,
244 .mask_ack = mask_and_ack_either_edge_irq, 298 .mask_ack = mask_and_ack_either_edge_irq,
245 .unmask = local_enable_irq, 299 .unmask = local_enable_irq,
246 .end = end_irq, 300 .end = end_irq,
247}; 301};
248 302
249static struct irq_chip level_irq_type = { 303static struct irq_chip level_irq_type = {
250 .name = "Au1000 Level", 304 .name = "Au1000 Level",
251 .ack = mask_and_ack_level_irq, 305 .ack = mask_and_ack_level_irq,
252 .mask = local_disable_irq, 306 .mask = local_disable_irq,
253 .mask_ack = mask_and_ack_level_irq, 307 .mask_ack = mask_and_ack_level_irq,
254 .unmask = local_enable_irq, 308 .unmask = local_enable_irq,
255 .end = end_irq, 309 .end = end_irq,
256}; 310};
257 311
258#ifdef CONFIG_PM 312#ifdef CONFIG_PM
@@ -263,7 +317,8 @@ void startup_match20_interrupt(irq_handler_t handler)
263 static struct irqaction action; 317 static struct irqaction action;
264 memset(&action, 0, sizeof(struct irqaction)); 318 memset(&action, 0, sizeof(struct irqaction));
265 319
266 /* This is a big problem.... since we didn't use request_irq 320 /*
321 * This is a big problem.... since we didn't use request_irq
267 * when kernel/irq.c calls probe_irq_xxx this interrupt will 322 * when kernel/irq.c calls probe_irq_xxx this interrupt will
268 * be probed for usage. This will end up disabling the device :( 323 * be probed for usage. This will end up disabling the device :(
269 * Give it a bogus "action" pointer -- this will keep it from 324 * Give it a bogus "action" pointer -- this will keep it from
@@ -292,173 +347,112 @@ static void setup_local_irq(unsigned int irq_nr, int type, int int_req)
292 /* Config2[n], Config1[n], Config0[n] */ 347 /* Config2[n], Config1[n], Config0[n] */
293 if (irq_nr > AU1000_LAST_INTC0_INT) { 348 if (irq_nr > AU1000_LAST_INTC0_INT) {
294 switch (type) { 349 switch (type) {
295 case INTC_INT_RISE_EDGE: /* 0:0:1 */ 350 case INTC_INT_RISE_EDGE: /* 0:0:1 */
296 au_writel(1<<(irq_nr-32), IC1_CFG2CLR); 351 au_writel(1 << (irq_nr - 32), IC1_CFG2CLR);
297 au_writel(1<<(irq_nr-32), IC1_CFG1CLR); 352 au_writel(1 << (irq_nr - 32), IC1_CFG1CLR);
298 au_writel(1<<(irq_nr-32), IC1_CFG0SET); 353 au_writel(1 << (irq_nr - 32), IC1_CFG0SET);
299 set_irq_chip(irq_nr, &rise_edge_irq_type); 354 set_irq_chip(irq_nr, &rise_edge_irq_type);
300 break; 355 break;
301 case INTC_INT_FALL_EDGE: /* 0:1:0 */ 356 case INTC_INT_FALL_EDGE: /* 0:1:0 */
302 au_writel(1<<(irq_nr-32), IC1_CFG2CLR); 357 au_writel(1 << (irq_nr - 32), IC1_CFG2CLR);
303 au_writel(1<<(irq_nr-32), IC1_CFG1SET); 358 au_writel(1 << (irq_nr - 32), IC1_CFG1SET);
304 au_writel(1<<(irq_nr-32), IC1_CFG0CLR); 359 au_writel(1 << (irq_nr - 32), IC1_CFG0CLR);
305 set_irq_chip(irq_nr, &fall_edge_irq_type); 360 set_irq_chip(irq_nr, &fall_edge_irq_type);
306 break; 361 break;
307 case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */ 362 case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */
308 au_writel(1<<(irq_nr-32), IC1_CFG2CLR); 363 au_writel(1 << (irq_nr - 32), IC1_CFG2CLR);
309 au_writel(1<<(irq_nr-32), IC1_CFG1SET); 364 au_writel(1 << (irq_nr - 32), IC1_CFG1SET);
310 au_writel(1<<(irq_nr-32), IC1_CFG0SET); 365 au_writel(1 << (irq_nr - 32), IC1_CFG0SET);
311 set_irq_chip(irq_nr, &either_edge_irq_type); 366 set_irq_chip(irq_nr, &either_edge_irq_type);
312 break; 367 break;
313 case INTC_INT_HIGH_LEVEL: /* 1:0:1 */ 368 case INTC_INT_HIGH_LEVEL: /* 1:0:1 */
314 au_writel(1<<(irq_nr-32), IC1_CFG2SET); 369 au_writel(1 << (irq_nr - 32), IC1_CFG2SET);
315 au_writel(1<<(irq_nr-32), IC1_CFG1CLR); 370 au_writel(1 << (irq_nr - 32), IC1_CFG1CLR);
316 au_writel(1<<(irq_nr-32), IC1_CFG0SET); 371 au_writel(1 << (irq_nr - 32), IC1_CFG0SET);
317 set_irq_chip(irq_nr, &level_irq_type); 372 set_irq_chip(irq_nr, &level_irq_type);
318 break; 373 break;
319 case INTC_INT_LOW_LEVEL: /* 1:1:0 */ 374 case INTC_INT_LOW_LEVEL: /* 1:1:0 */
320 au_writel(1<<(irq_nr-32), IC1_CFG2SET); 375 au_writel(1 << (irq_nr - 32), IC1_CFG2SET);
321 au_writel(1<<(irq_nr-32), IC1_CFG1SET); 376 au_writel(1 << (irq_nr - 32), IC1_CFG1SET);
322 au_writel(1<<(irq_nr-32), IC1_CFG0CLR); 377 au_writel(1 << (irq_nr - 32), IC1_CFG0CLR);
323 set_irq_chip(irq_nr, &level_irq_type); 378 set_irq_chip(irq_nr, &level_irq_type);
324 break; 379 break;
325 case INTC_INT_DISABLED: /* 0:0:0 */ 380 case INTC_INT_DISABLED: /* 0:0:0 */
326 au_writel(1<<(irq_nr-32), IC1_CFG0CLR); 381 au_writel(1 << (irq_nr - 32), IC1_CFG0CLR);
327 au_writel(1<<(irq_nr-32), IC1_CFG1CLR); 382 au_writel(1 << (irq_nr - 32), IC1_CFG1CLR);
328 au_writel(1<<(irq_nr-32), IC1_CFG2CLR); 383 au_writel(1 << (irq_nr - 32), IC1_CFG2CLR);
329 break; 384 break;
330 default: /* disable the interrupt */ 385 default: /* disable the interrupt */
331 printk("unexpected int type %d (irq %d)\n", type, irq_nr); 386 printk(KERN_WARNING "unexpected int type %d (irq %d)\n",
332 au_writel(1<<(irq_nr-32), IC1_CFG0CLR); 387 type, irq_nr);
333 au_writel(1<<(irq_nr-32), IC1_CFG1CLR); 388 au_writel(1 << (irq_nr - 32), IC1_CFG0CLR);
334 au_writel(1<<(irq_nr-32), IC1_CFG2CLR); 389 au_writel(1 << (irq_nr - 32), IC1_CFG1CLR);
335 return; 390 au_writel(1 << (irq_nr - 32), IC1_CFG2CLR);
391 return;
336 } 392 }
337 if (int_req) /* assign to interrupt request 1 */ 393 if (int_req) /* assign to interrupt request 1 */
338 au_writel(1<<(irq_nr-32), IC1_ASSIGNCLR); 394 au_writel(1 << (irq_nr - 32), IC1_ASSIGNCLR);
339 else /* assign to interrupt request 0 */ 395 else /* assign to interrupt request 0 */
340 au_writel(1<<(irq_nr-32), IC1_ASSIGNSET); 396 au_writel(1 << (irq_nr - 32), IC1_ASSIGNSET);
341 au_writel(1<<(irq_nr-32), IC1_SRCSET); 397 au_writel(1 << (irq_nr - 32), IC1_SRCSET);
342 au_writel(1<<(irq_nr-32), IC1_MASKCLR); 398 au_writel(1 << (irq_nr - 32), IC1_MASKCLR);
343 au_writel(1<<(irq_nr-32), IC1_WAKECLR); 399 au_writel(1 << (irq_nr - 32), IC1_WAKECLR);
344 } 400 } else {
345 else {
346 switch (type) { 401 switch (type) {
347 case INTC_INT_RISE_EDGE: /* 0:0:1 */ 402 case INTC_INT_RISE_EDGE: /* 0:0:1 */
348 au_writel(1<<irq_nr, IC0_CFG2CLR); 403 au_writel(1 << irq_nr, IC0_CFG2CLR);
349 au_writel(1<<irq_nr, IC0_CFG1CLR); 404 au_writel(1 << irq_nr, IC0_CFG1CLR);
350 au_writel(1<<irq_nr, IC0_CFG0SET); 405 au_writel(1 << irq_nr, IC0_CFG0SET);
351 set_irq_chip(irq_nr, &rise_edge_irq_type); 406 set_irq_chip(irq_nr, &rise_edge_irq_type);
352 break; 407 break;
353 case INTC_INT_FALL_EDGE: /* 0:1:0 */ 408 case INTC_INT_FALL_EDGE: /* 0:1:0 */
354 au_writel(1<<irq_nr, IC0_CFG2CLR); 409 au_writel(1 << irq_nr, IC0_CFG2CLR);
355 au_writel(1<<irq_nr, IC0_CFG1SET); 410 au_writel(1 << irq_nr, IC0_CFG1SET);
356 au_writel(1<<irq_nr, IC0_CFG0CLR); 411 au_writel(1 << irq_nr, IC0_CFG0CLR);
357 set_irq_chip(irq_nr, &fall_edge_irq_type); 412 set_irq_chip(irq_nr, &fall_edge_irq_type);
358 break; 413 break;
359 case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */ 414 case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */
360 au_writel(1<<irq_nr, IC0_CFG2CLR); 415 au_writel(1 << irq_nr, IC0_CFG2CLR);
361 au_writel(1<<irq_nr, IC0_CFG1SET); 416 au_writel(1 << irq_nr, IC0_CFG1SET);
362 au_writel(1<<irq_nr, IC0_CFG0SET); 417 au_writel(1 << irq_nr, IC0_CFG0SET);
363 set_irq_chip(irq_nr, &either_edge_irq_type); 418 set_irq_chip(irq_nr, &either_edge_irq_type);
364 break; 419 break;
365 case INTC_INT_HIGH_LEVEL: /* 1:0:1 */ 420 case INTC_INT_HIGH_LEVEL: /* 1:0:1 */
366 au_writel(1<<irq_nr, IC0_CFG2SET); 421 au_writel(1 << irq_nr, IC0_CFG2SET);
367 au_writel(1<<irq_nr, IC0_CFG1CLR); 422 au_writel(1 << irq_nr, IC0_CFG1CLR);
368 au_writel(1<<irq_nr, IC0_CFG0SET); 423 au_writel(1 << irq_nr, IC0_CFG0SET);
369 set_irq_chip(irq_nr, &level_irq_type); 424 set_irq_chip(irq_nr, &level_irq_type);
370 break; 425 break;
371 case INTC_INT_LOW_LEVEL: /* 1:1:0 */ 426 case INTC_INT_LOW_LEVEL: /* 1:1:0 */
372 au_writel(1<<irq_nr, IC0_CFG2SET); 427 au_writel(1 << irq_nr, IC0_CFG2SET);
373 au_writel(1<<irq_nr, IC0_CFG1SET); 428 au_writel(1 << irq_nr, IC0_CFG1SET);
374 au_writel(1<<irq_nr, IC0_CFG0CLR); 429 au_writel(1 << irq_nr, IC0_CFG0CLR);
375 set_irq_chip(irq_nr, &level_irq_type); 430 set_irq_chip(irq_nr, &level_irq_type);
376 break; 431 break;
377 case INTC_INT_DISABLED: /* 0:0:0 */ 432 case INTC_INT_DISABLED: /* 0:0:0 */
378 au_writel(1<<irq_nr, IC0_CFG0CLR); 433 au_writel(1 << irq_nr, IC0_CFG0CLR);
379 au_writel(1<<irq_nr, IC0_CFG1CLR); 434 au_writel(1 << irq_nr, IC0_CFG1CLR);
380 au_writel(1<<irq_nr, IC0_CFG2CLR); 435 au_writel(1 << irq_nr, IC0_CFG2CLR);
381 break; 436 break;
382 default: /* disable the interrupt */ 437 default: /* disable the interrupt */
383 printk("unexpected int type %d (irq %d)\n", type, irq_nr); 438 printk(KERN_WARNING "unexpected int type %d (irq %d)\n",
384 au_writel(1<<irq_nr, IC0_CFG0CLR); 439 type, irq_nr);
385 au_writel(1<<irq_nr, IC0_CFG1CLR); 440 au_writel(1 << irq_nr, IC0_CFG0CLR);
386 au_writel(1<<irq_nr, IC0_CFG2CLR); 441 au_writel(1 << irq_nr, IC0_CFG1CLR);
387 return; 442 au_writel(1 << irq_nr, IC0_CFG2CLR);
443 return;
388 } 444 }
389 if (int_req) /* assign to interrupt request 1 */ 445 if (int_req) /* assign to interrupt request 1 */
390 au_writel(1<<irq_nr, IC0_ASSIGNCLR); 446 au_writel(1 << irq_nr, IC0_ASSIGNCLR);
391 else /* assign to interrupt request 0 */ 447 else /* assign to interrupt request 0 */
392 au_writel(1<<irq_nr, IC0_ASSIGNSET); 448 au_writel(1 << irq_nr, IC0_ASSIGNSET);
393 au_writel(1<<irq_nr, IC0_SRCSET); 449 au_writel(1 << irq_nr, IC0_SRCSET);
394 au_writel(1<<irq_nr, IC0_MASKCLR); 450 au_writel(1 << irq_nr, IC0_MASKCLR);
395 au_writel(1<<irq_nr, IC0_WAKECLR); 451 au_writel(1 << irq_nr, IC0_WAKECLR);
396 } 452 }
397 au_sync(); 453 au_sync();
398} 454}
399 455
400
401void __init arch_init_irq(void)
402{
403 int i;
404 unsigned long cp0_status;
405 au1xxx_irq_map_t *imp;
406 extern au1xxx_irq_map_t au1xxx_irq_map[];
407 extern au1xxx_irq_map_t au1xxx_ic0_map[];
408 extern int au1xxx_nr_irqs;
409 extern int au1xxx_ic0_nr_irqs;
410
411 cp0_status = read_c0_status();
412
413 /* Initialize interrupt controllers to a safe state.
414 */
415 au_writel(0xffffffff, IC0_CFG0CLR);
416 au_writel(0xffffffff, IC0_CFG1CLR);
417 au_writel(0xffffffff, IC0_CFG2CLR);
418 au_writel(0xffffffff, IC0_MASKCLR);
419 au_writel(0xffffffff, IC0_ASSIGNSET);
420 au_writel(0xffffffff, IC0_WAKECLR);
421 au_writel(0xffffffff, IC0_SRCSET);
422 au_writel(0xffffffff, IC0_FALLINGCLR);
423 au_writel(0xffffffff, IC0_RISINGCLR);
424 au_writel(0x00000000, IC0_TESTBIT);
425
426 au_writel(0xffffffff, IC1_CFG0CLR);
427 au_writel(0xffffffff, IC1_CFG1CLR);
428 au_writel(0xffffffff, IC1_CFG2CLR);
429 au_writel(0xffffffff, IC1_MASKCLR);
430 au_writel(0xffffffff, IC1_ASSIGNSET);
431 au_writel(0xffffffff, IC1_WAKECLR);
432 au_writel(0xffffffff, IC1_SRCSET);
433 au_writel(0xffffffff, IC1_FALLINGCLR);
434 au_writel(0xffffffff, IC1_RISINGCLR);
435 au_writel(0x00000000, IC1_TESTBIT);
436
437 /* Initialize IC0, which is fixed per processor.
438 */
439 imp = au1xxx_ic0_map;
440 for (i=0; i<au1xxx_ic0_nr_irqs; i++) {
441 setup_local_irq(imp->im_irq, imp->im_type, imp->im_request);
442 imp++;
443 }
444
445 /* Now set up the irq mapping for the board.
446 */
447 imp = au1xxx_irq_map;
448 for (i=0; i<au1xxx_nr_irqs; i++) {
449 setup_local_irq(imp->im_irq, imp->im_type, imp->im_request);
450 imp++;
451 }
452
453 set_c0_status(ALLINTS);
454
455 /* Board specific IRQ initialization.
456 */
457 if (board_init_irq)
458 (*board_init_irq)();
459}
460
461
462/* 456/*
463 * Interrupts are nested. Even if an interrupt handler is registered 457 * Interrupts are nested. Even if an interrupt handler is registered
464 * as "fast", we might get another interrupt before we return from 458 * as "fast", we might get another interrupt before we return from
@@ -468,26 +462,27 @@ void __init arch_init_irq(void)
468static void intc0_req0_irqdispatch(void) 462static void intc0_req0_irqdispatch(void)
469{ 463{
470 int irq = 0; 464 int irq = 0;
471 static unsigned long intc0_req0 = 0; 465 static unsigned long intc0_req0;
472 466
473 intc0_req0 |= au_readl(IC0_REQ0INT); 467 intc0_req0 |= au_readl(IC0_REQ0INT);
474 468
475 if (!intc0_req0) 469 if (!intc0_req0)
476 return; 470 return;
471
477#ifdef AU1000_USB_DEV_REQ_INT 472#ifdef AU1000_USB_DEV_REQ_INT
478 /* 473 /*
479 * Because of the tight timing of SETUP token to reply 474 * Because of the tight timing of SETUP token to reply
480 * transactions, the USB devices-side packet complete 475 * transactions, the USB devices-side packet complete
481 * interrupt needs the highest priority. 476 * interrupt needs the highest priority.
482 */ 477 */
483 if ((intc0_req0 & (1<<AU1000_USB_DEV_REQ_INT))) { 478 if ((intc0_req0 & (1 << AU1000_USB_DEV_REQ_INT))) {
484 intc0_req0 &= ~(1<<AU1000_USB_DEV_REQ_INT); 479 intc0_req0 &= ~(1 << AU1000_USB_DEV_REQ_INT);
485 do_IRQ(AU1000_USB_DEV_REQ_INT); 480 do_IRQ(AU1000_USB_DEV_REQ_INT);
486 return; 481 return;
487 } 482 }
488#endif 483#endif
489 irq = au_ffs(intc0_req0) - 1; 484 irq = ffs(intc0_req0);
490 intc0_req0 &= ~(1<<irq); 485 intc0_req0 &= ~(1 << irq);
491 do_IRQ(irq); 486 do_IRQ(irq);
492} 487}
493 488
@@ -495,15 +490,15 @@ static void intc0_req0_irqdispatch(void)
495static void intc0_req1_irqdispatch(void) 490static void intc0_req1_irqdispatch(void)
496{ 491{
497 int irq = 0; 492 int irq = 0;
498 static unsigned long intc0_req1 = 0; 493 static unsigned long intc0_req1;
499 494
500 intc0_req1 |= au_readl(IC0_REQ1INT); 495 intc0_req1 |= au_readl(IC0_REQ1INT);
501 496
502 if (!intc0_req1) 497 if (!intc0_req1)
503 return; 498 return;
504 499
505 irq = au_ffs(intc0_req1) - 1; 500 irq = ffs(intc0_req1);
506 intc0_req1 &= ~(1<<irq); 501 intc0_req1 &= ~(1 << irq);
507 do_IRQ(irq); 502 do_IRQ(irq);
508} 503}
509 504
@@ -515,15 +510,15 @@ static void intc0_req1_irqdispatch(void)
515static void intc1_req0_irqdispatch(void) 510static void intc1_req0_irqdispatch(void)
516{ 511{
517 int irq = 0; 512 int irq = 0;
518 static unsigned long intc1_req0 = 0; 513 static unsigned long intc1_req0;
519 514
520 intc1_req0 |= au_readl(IC1_REQ0INT); 515 intc1_req0 |= au_readl(IC1_REQ0INT);
521 516
522 if (!intc1_req0) 517 if (!intc1_req0)
523 return; 518 return;
524 519
525 irq = au_ffs(intc1_req0) - 1; 520 irq = ffs(intc1_req0);
526 intc1_req0 &= ~(1<<irq); 521 intc1_req0 &= ~(1 << irq);
527 irq += 32; 522 irq += 32;
528 do_IRQ(irq); 523 do_IRQ(irq);
529} 524}
@@ -532,102 +527,19 @@ static void intc1_req0_irqdispatch(void)
532static void intc1_req1_irqdispatch(void) 527static void intc1_req1_irqdispatch(void)
533{ 528{
534 int irq = 0; 529 int irq = 0;
535 static unsigned long intc1_req1 = 0; 530 static unsigned long intc1_req1;
536 531
537 intc1_req1 |= au_readl(IC1_REQ1INT); 532 intc1_req1 |= au_readl(IC1_REQ1INT);
538 533
539 if (!intc1_req1) 534 if (!intc1_req1)
540 return; 535 return;
541 536
542 irq = au_ffs(intc1_req1) - 1; 537 irq = ffs(intc1_req1);
543 intc1_req1 &= ~(1<<irq); 538 intc1_req1 &= ~(1 << irq);
544 irq += 32; 539 irq += 32;
545 do_IRQ(irq); 540 do_IRQ(irq);
546} 541}
547 542
548#ifdef CONFIG_PM
549
550/* Save/restore the interrupt controller state.
551 * Called from the save/restore core registers as part of the
552 * au_sleep function in power.c.....maybe I should just pm_register()
553 * them instead?
554 */
555static unsigned int sleep_intctl_config0[2];
556static unsigned int sleep_intctl_config1[2];
557static unsigned int sleep_intctl_config2[2];
558static unsigned int sleep_intctl_src[2];
559static unsigned int sleep_intctl_assign[2];
560static unsigned int sleep_intctl_wake[2];
561static unsigned int sleep_intctl_mask[2];
562
563void
564save_au1xxx_intctl(void)
565{
566 sleep_intctl_config0[0] = au_readl(IC0_CFG0RD);
567 sleep_intctl_config1[0] = au_readl(IC0_CFG1RD);
568 sleep_intctl_config2[0] = au_readl(IC0_CFG2RD);
569 sleep_intctl_src[0] = au_readl(IC0_SRCRD);
570 sleep_intctl_assign[0] = au_readl(IC0_ASSIGNRD);
571 sleep_intctl_wake[0] = au_readl(IC0_WAKERD);
572 sleep_intctl_mask[0] = au_readl(IC0_MASKRD);
573
574 sleep_intctl_config0[1] = au_readl(IC1_CFG0RD);
575 sleep_intctl_config1[1] = au_readl(IC1_CFG1RD);
576 sleep_intctl_config2[1] = au_readl(IC1_CFG2RD);
577 sleep_intctl_src[1] = au_readl(IC1_SRCRD);
578 sleep_intctl_assign[1] = au_readl(IC1_ASSIGNRD);
579 sleep_intctl_wake[1] = au_readl(IC1_WAKERD);
580 sleep_intctl_mask[1] = au_readl(IC1_MASKRD);
581}
582
583/* For most restore operations, we clear the entire register and
584 * then set the bits we found during the save.
585 */
586void
587restore_au1xxx_intctl(void)
588{
589 au_writel(0xffffffff, IC0_MASKCLR); au_sync();
590
591 au_writel(0xffffffff, IC0_CFG0CLR); au_sync();
592 au_writel(sleep_intctl_config0[0], IC0_CFG0SET); au_sync();
593 au_writel(0xffffffff, IC0_CFG1CLR); au_sync();
594 au_writel(sleep_intctl_config1[0], IC0_CFG1SET); au_sync();
595 au_writel(0xffffffff, IC0_CFG2CLR); au_sync();
596 au_writel(sleep_intctl_config2[0], IC0_CFG2SET); au_sync();
597 au_writel(0xffffffff, IC0_SRCCLR); au_sync();
598 au_writel(sleep_intctl_src[0], IC0_SRCSET); au_sync();
599 au_writel(0xffffffff, IC0_ASSIGNCLR); au_sync();
600 au_writel(sleep_intctl_assign[0], IC0_ASSIGNSET); au_sync();
601 au_writel(0xffffffff, IC0_WAKECLR); au_sync();
602 au_writel(sleep_intctl_wake[0], IC0_WAKESET); au_sync();
603 au_writel(0xffffffff, IC0_RISINGCLR); au_sync();
604 au_writel(0xffffffff, IC0_FALLINGCLR); au_sync();
605 au_writel(0x00000000, IC0_TESTBIT); au_sync();
606
607 au_writel(0xffffffff, IC1_MASKCLR); au_sync();
608
609 au_writel(0xffffffff, IC1_CFG0CLR); au_sync();
610 au_writel(sleep_intctl_config0[1], IC1_CFG0SET); au_sync();
611 au_writel(0xffffffff, IC1_CFG1CLR); au_sync();
612 au_writel(sleep_intctl_config1[1], IC1_CFG1SET); au_sync();
613 au_writel(0xffffffff, IC1_CFG2CLR); au_sync();
614 au_writel(sleep_intctl_config2[1], IC1_CFG2SET); au_sync();
615 au_writel(0xffffffff, IC1_SRCCLR); au_sync();
616 au_writel(sleep_intctl_src[1], IC1_SRCSET); au_sync();
617 au_writel(0xffffffff, IC1_ASSIGNCLR); au_sync();
618 au_writel(sleep_intctl_assign[1], IC1_ASSIGNSET); au_sync();
619 au_writel(0xffffffff, IC1_WAKECLR); au_sync();
620 au_writel(sleep_intctl_wake[1], IC1_WAKESET); au_sync();
621 au_writel(0xffffffff, IC1_RISINGCLR); au_sync();
622 au_writel(0xffffffff, IC1_FALLINGCLR); au_sync();
623 au_writel(0x00000000, IC1_TESTBIT); au_sync();
624
625 au_writel(sleep_intctl_mask[1], IC1_MASKSET); au_sync();
626
627 au_writel(sleep_intctl_mask[0], IC0_MASKSET); au_sync();
628}
629#endif /* CONFIG_PM */
630
631asmlinkage void plat_irq_dispatch(void) 543asmlinkage void plat_irq_dispatch(void)
632{ 544{
633 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; 545 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
@@ -645,3 +557,63 @@ asmlinkage void plat_irq_dispatch(void)
645 else 557 else
646 spurious_interrupt(); 558 spurious_interrupt();
647} 559}
560
561void __init arch_init_irq(void)
562{
563 int i;
564 unsigned long cp0_status;
565 struct au1xxx_irqmap *imp;
566 extern struct au1xxx_irqmap au1xxx_irq_map[];
567 extern struct au1xxx_irqmap au1xxx_ic0_map[];
568 extern int au1xxx_nr_irqs;
569 extern int au1xxx_ic0_nr_irqs;
570
571 cp0_status = read_c0_status();
572
573 /* Initialize interrupt controllers to a safe state.
574 */
575 au_writel(0xffffffff, IC0_CFG0CLR);
576 au_writel(0xffffffff, IC0_CFG1CLR);
577 au_writel(0xffffffff, IC0_CFG2CLR);
578 au_writel(0xffffffff, IC0_MASKCLR);
579 au_writel(0xffffffff, IC0_ASSIGNSET);
580 au_writel(0xffffffff, IC0_WAKECLR);
581 au_writel(0xffffffff, IC0_SRCSET);
582 au_writel(0xffffffff, IC0_FALLINGCLR);
583 au_writel(0xffffffff, IC0_RISINGCLR);
584 au_writel(0x00000000, IC0_TESTBIT);
585
586 au_writel(0xffffffff, IC1_CFG0CLR);
587 au_writel(0xffffffff, IC1_CFG1CLR);
588 au_writel(0xffffffff, IC1_CFG2CLR);
589 au_writel(0xffffffff, IC1_MASKCLR);
590 au_writel(0xffffffff, IC1_ASSIGNSET);
591 au_writel(0xffffffff, IC1_WAKECLR);
592 au_writel(0xffffffff, IC1_SRCSET);
593 au_writel(0xffffffff, IC1_FALLINGCLR);
594 au_writel(0xffffffff, IC1_RISINGCLR);
595 au_writel(0x00000000, IC1_TESTBIT);
596
597 /* Initialize IC0, which is fixed per processor.
598 */
599 imp = au1xxx_ic0_map;
600 for (i = 0; i < au1xxx_ic0_nr_irqs; i++) {
601 setup_local_irq(imp->im_irq, imp->im_type, imp->im_request);
602 imp++;
603 }
604
605 /* Now set up the irq mapping for the board.
606 */
607 imp = au1xxx_irq_map;
608 for (i = 0; i < au1xxx_nr_irqs; i++) {
609 setup_local_irq(imp->im_irq, imp->im_type, imp->im_request);
610 imp++;
611 }
612
613 set_c0_status(ALLINTS);
614
615 /* Board specific IRQ initialization.
616 */
617 if (board_init_irq)
618 (*board_init_irq)();
619}
diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c
index a8637cdb5b4b..90d70695aa60 100644
--- a/arch/mips/au1000/common/prom.c
+++ b/arch/mips/au1000/common/prom.c
@@ -33,7 +33,6 @@
33 * with this program; if not, write to the Free Software Foundation, Inc., 33 * with this program; if not, write to the Free Software Foundation, Inc.,
34 * 675 Mass Ave, Cambridge, MA 02139, USA. 34 * 675 Mass Ave, Cambridge, MA 02139, USA.
35 */ 35 */
36
37#include <linux/module.h> 36#include <linux/module.h>
38#include <linux/kernel.h> 37#include <linux/kernel.h>
39#include <linux/init.h> 38#include <linux/init.h>
@@ -41,18 +40,16 @@
41 40
42#include <asm/bootinfo.h> 41#include <asm/bootinfo.h>
43 42
44/* #define DEBUG_CMDLINE */ 43int prom_argc;
45 44char **prom_argv;
46extern int prom_argc; 45char **prom_envp;
47extern char **prom_argv, **prom_envp;
48
49 46
50char * __init_or_module prom_getcmdline(void) 47char * __init_or_module prom_getcmdline(void)
51{ 48{
52 return &(arcs_cmdline[0]); 49 return &(arcs_cmdline[0]);
53} 50}
54 51
55void prom_init_cmdline(void) 52void prom_init_cmdline(void)
56{ 53{
57 char *cp; 54 char *cp;
58 int actr; 55 int actr;
@@ -61,7 +58,7 @@ void prom_init_cmdline(void)
61 58
62 cp = &(arcs_cmdline[0]); 59 cp = &(arcs_cmdline[0]);
63 while(actr < prom_argc) { 60 while(actr < prom_argc) {
64 strcpy(cp, prom_argv[actr]); 61 strcpy(cp, prom_argv[actr]);
65 cp += strlen(prom_argv[actr]); 62 cp += strlen(prom_argv[actr]);
66 *cp++ = ' '; 63 *cp++ = ' ';
67 actr++; 64 actr++;
@@ -70,10 +67,8 @@ void prom_init_cmdline(void)
70 --cp; 67 --cp;
71 if (prom_argc > 1) 68 if (prom_argc > 1)
72 *cp = '\0'; 69 *cp = '\0';
73
74} 70}
75 71
76
77char *prom_getenv(char *envname) 72char *prom_getenv(char *envname)
78{ 73{
79 /* 74 /*
@@ -95,21 +90,23 @@ char *prom_getenv(char *envname)
95 } 90 }
96 env++; 91 env++;
97 } 92 }
93
98 return NULL; 94 return NULL;
99} 95}
100 96
101inline unsigned char str2hexnum(unsigned char c) 97static inline unsigned char str2hexnum(unsigned char c)
102{ 98{
103 if(c >= '0' && c <= '9') 99 if (c >= '0' && c <= '9')
104 return c - '0'; 100 return c - '0';
105 if(c >= 'a' && c <= 'f') 101 if (c >= 'a' && c <= 'f')
106 return c - 'a' + 10; 102 return c - 'a' + 10;
107 if(c >= 'A' && c <= 'F') 103 if (c >= 'A' && c <= 'F')
108 return c - 'A' + 10; 104 return c - 'A' + 10;
105
109 return 0; /* foo */ 106 return 0; /* foo */
110} 107}
111 108
112inline void str2eaddr(unsigned char *ea, unsigned char *str) 109static inline void str2eaddr(unsigned char *ea, unsigned char *str)
113{ 110{
114 int i; 111 int i;
115 112
@@ -124,35 +121,29 @@ inline void str2eaddr(unsigned char *ea, unsigned char *str)
124 } 121 }
125} 122}
126 123
127int get_ethernet_addr(char *ethernet_addr) 124int prom_get_ethernet_addr(char *ethernet_addr)
128{ 125{
129 char *ethaddr_str; 126 char *ethaddr_str;
127 char *argptr;
130 128
131 ethaddr_str = prom_getenv("ethaddr"); 129 /* Check the environment variables first */
130 ethaddr_str = prom_getenv("ethaddr");
132 if (!ethaddr_str) { 131 if (!ethaddr_str) {
133 printk("ethaddr not set in boot prom\n"); 132 /* Check command line */
134 return -1; 133 argptr = prom_getcmdline();
135 } 134 ethaddr_str = strstr(argptr, "ethaddr=");
136 str2eaddr(ethernet_addr, ethaddr_str); 135 if (!ethaddr_str)
137 136 return -1;
138#if 0
139 {
140 int i;
141 137
142 printk("get_ethernet_addr: "); 138 ethaddr_str += strlen("ethaddr=");
143 for (i=0; i<5; i++)
144 printk("%02x:", (unsigned char)*(ethernet_addr+i));
145 printk("%02x\n", *(ethernet_addr+i));
146 } 139 }
147#endif 140
141 str2eaddr(ethernet_addr, ethaddr_str);
148 142
149 return 0; 143 return 0;
150} 144}
145EXPORT_SYMBOL(prom_get_ethernet_addr);
151 146
152void __init prom_free_prom_memory(void) 147void __init prom_free_prom_memory(void)
153{ 148{
154} 149}
155
156EXPORT_SYMBOL(prom_getcmdline);
157EXPORT_SYMBOL(get_ethernet_addr);
158EXPORT_SYMBOL(str2eaddr);
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index b212c0726125..a90d425d4651 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -40,10 +40,11 @@
40#include <asm/mipsregs.h> 40#include <asm/mipsregs.h>
41#include <asm/reboot.h> 41#include <asm/reboot.h>
42#include <asm/pgtable.h> 42#include <asm/pgtable.h>
43#include <asm/mach-au1x00/au1000.h>
44#include <asm/time.h> 43#include <asm/time.h>
45 44
46extern char * prom_getcmdline(void); 45#include <au1000.h>
46#include <prom.h>
47
47extern void __init board_setup(void); 48extern void __init board_setup(void);
48extern void au1000_restart(char *); 49extern void au1000_restart(char *);
49extern void au1000_halt(void); 50extern void au1000_halt(void);
diff --git a/arch/mips/au1000/db1x00/init.c b/arch/mips/au1000/db1x00/init.c
index 4d7bcfc8cf73..43298fd9459c 100644
--- a/arch/mips/au1000/db1x00/init.c
+++ b/arch/mips/au1000/db1x00/init.c
@@ -31,15 +31,13 @@
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/bootmem.h> 33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h> 34#include <linux/string.h>
37#include <linux/kernel.h> 35#include <linux/kernel.h>
38 36
39int prom_argc; 37#include <asm/addrspace.h>
40char **prom_argv, **prom_envp; 38#include <asm/bootinfo.h>
41extern void __init prom_init_cmdline(void); 39
42extern char *prom_getenv(char *envname); 40#include <prom.h>
43 41
44const char *get_system_type(void) 42const char *get_system_type(void)
45{ 43{
diff --git a/arch/mips/au1000/db1x00/irqmap.c b/arch/mips/au1000/db1x00/irqmap.c
index 3e5729145c2b..09cea03411b0 100644
--- a/arch/mips/au1000/db1x00/irqmap.c
+++ b/arch/mips/au1000/db1x00/irqmap.c
@@ -79,7 +79,7 @@ char irq_tab_alchemy[][5] __initdata = {
79#endif 79#endif
80 80
81 81
82au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 82struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
83 83
84#ifndef CONFIG_MIPS_MIRAGE 84#ifndef CONFIG_MIPS_MIRAGE
85#ifdef CONFIG_MIPS_DB1550 85#ifdef CONFIG_MIPS_DB1550
diff --git a/arch/mips/au1000/mtx-1/init.c b/arch/mips/au1000/mtx-1/init.c
index 2aa7b2ed6a8c..cdeae3212a2d 100644
--- a/arch/mips/au1000/mtx-1/init.c
+++ b/arch/mips/au1000/mtx-1/init.c
@@ -34,13 +34,11 @@
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/mm.h> 35#include <linux/mm.h>
36#include <linux/bootmem.h> 36#include <linux/bootmem.h>
37
37#include <asm/addrspace.h> 38#include <asm/addrspace.h>
38#include <asm/bootinfo.h> 39#include <asm/bootinfo.h>
39 40
40int prom_argc; 41#include <prom.h>
41char **prom_argv, **prom_envp;
42extern void __init prom_init_cmdline(void);
43extern char *prom_getenv(char *envname);
44 42
45const char *get_system_type(void) 43const char *get_system_type(void)
46{ 44{
diff --git a/arch/mips/au1000/mtx-1/irqmap.c b/arch/mips/au1000/mtx-1/irqmap.c
index a4fa0f227e42..49c612aeddcf 100644
--- a/arch/mips/au1000/mtx-1/irqmap.c
+++ b/arch/mips/au1000/mtx-1/irqmap.c
@@ -58,7 +58,7 @@ char irq_tab_alchemy[][5] __initdata = {
58 [7] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 07 - AdapterD-Slot1 (bottom) */ 58 [7] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 07 - AdapterD-Slot1 (bottom) */
59}; 59};
60 60
61au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 61struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
62 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 62 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
63 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 63 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
64 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 64 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/au1000/pb1000/init.c b/arch/mips/au1000/pb1000/init.c
index 4535f7208e18..ddccaf6997d0 100644
--- a/arch/mips/au1000/pb1000/init.c
+++ b/arch/mips/au1000/pb1000/init.c
@@ -30,15 +30,13 @@
30#include <linux/mm.h> 30#include <linux/mm.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <linux/bootmem.h> 32#include <linux/bootmem.h>
33#include <asm/addrspace.h>
34#include <asm/bootinfo.h>
35#include <linux/string.h> 33#include <linux/string.h>
36#include <linux/kernel.h> 34#include <linux/kernel.h>
37 35
38int prom_argc; 36#include <asm/addrspace.h>
39char **prom_argv, **prom_envp; 37#include <asm/bootinfo.h>
40extern void __init prom_init_cmdline(void); 38
41extern char *prom_getenv(char *envname); 39#include <prom.h>
42 40
43const char *get_system_type(void) 41const char *get_system_type(void)
44{ 42{
diff --git a/arch/mips/au1000/pb1000/irqmap.c b/arch/mips/au1000/pb1000/irqmap.c
index 156500ba467f..88e354508204 100644
--- a/arch/mips/au1000/pb1000/irqmap.c
+++ b/arch/mips/au1000/pb1000/irqmap.c
@@ -47,7 +47,7 @@
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/mach-au1x00/au1000.h> 48#include <asm/mach-au1x00/au1000.h>
49 49
50au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 50struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
51 { AU1000_GPIO_15, INTC_INT_LOW_LEVEL, 0 }, 51 { AU1000_GPIO_15, INTC_INT_LOW_LEVEL, 0 },
52}; 52};
53 53
diff --git a/arch/mips/au1000/pb1100/init.c b/arch/mips/au1000/pb1100/init.c
index 7ba6852de7cd..c93fd39b4aba 100644
--- a/arch/mips/au1000/pb1100/init.c
+++ b/arch/mips/au1000/pb1100/init.c
@@ -31,15 +31,13 @@
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/bootmem.h> 33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h> 34#include <linux/string.h>
37#include <linux/kernel.h> 35#include <linux/kernel.h>
38 36
39int prom_argc; 37#include <asm/addrspace.h>
40char **prom_argv, **prom_envp; 38#include <asm/bootinfo.h>
41extern void __init prom_init_cmdline(void); 39
42extern char *prom_getenv(char *envname); 40#include <prom.h>
43 41
44const char *get_system_type(void) 42const char *get_system_type(void)
45{ 43{
diff --git a/arch/mips/au1000/pb1100/irqmap.c b/arch/mips/au1000/pb1100/irqmap.c
index d986916221b7..880456bf8c11 100644
--- a/arch/mips/au1000/pb1100/irqmap.c
+++ b/arch/mips/au1000/pb1100/irqmap.c
@@ -47,7 +47,7 @@
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/mach-au1x00/au1000.h> 48#include <asm/mach-au1x00/au1000.h>
49 49
50au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 50struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
51 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card Fully_Interted# 51 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card Fully_Interted#
52 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card STSCHG# 52 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card STSCHG#
53 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card IRQ# 53 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card IRQ#
diff --git a/arch/mips/au1000/pb1200/board_setup.c b/arch/mips/au1000/pb1200/board_setup.c
index 2122515f79d7..5dbc9868f598 100644
--- a/arch/mips/au1000/pb1200/board_setup.c
+++ b/arch/mips/au1000/pb1200/board_setup.c
@@ -41,8 +41,10 @@
41#include <asm/mipsregs.h> 41#include <asm/mipsregs.h>
42#include <asm/reboot.h> 42#include <asm/reboot.h>
43#include <asm/pgtable.h> 43#include <asm/pgtable.h>
44#include <asm/mach-au1x00/au1000.h> 44
45#include <asm/mach-au1x00/au1xxx_dbdma.h> 45#include <au1000.h>
46#include <au1xxx_dbdma.h>
47#include <prom.h>
46 48
47#ifdef CONFIG_MIPS_PB1200 49#ifdef CONFIG_MIPS_PB1200
48#include <asm/mach-pb1x00/pb1200.h> 50#include <asm/mach-pb1x00/pb1200.h>
diff --git a/arch/mips/au1000/pb1200/init.c b/arch/mips/au1000/pb1200/init.c
index 5a70029d5388..c251570749ee 100644
--- a/arch/mips/au1000/pb1200/init.c
+++ b/arch/mips/au1000/pb1200/init.c
@@ -31,15 +31,13 @@
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/bootmem.h> 33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h> 34#include <linux/string.h>
37#include <linux/kernel.h> 35#include <linux/kernel.h>
38 36
39int prom_argc; 37#include <asm/addrspace.h>
40char **prom_argv, **prom_envp; 38#include <asm/bootinfo.h>
41extern void __init prom_init_cmdline(void); 39
42extern char *prom_getenv(char *envname); 40#include <prom.h>
43 41
44const char *get_system_type(void) 42const char *get_system_type(void)
45{ 43{
diff --git a/arch/mips/au1000/pb1200/irqmap.c b/arch/mips/au1000/pb1200/irqmap.c
index 7c708db04a88..3bee274445f5 100644
--- a/arch/mips/au1000/pb1200/irqmap.c
+++ b/arch/mips/au1000/pb1200/irqmap.c
@@ -54,7 +54,7 @@
54#define PB1200_INT_END DB1200_INT_END 54#define PB1200_INT_END DB1200_INT_END
55#endif 55#endif
56 56
57au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 57struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
58 { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 }, // This is exteranl interrupt cascade 58 { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 }, // This is exteranl interrupt cascade
59}; 59};
60 60
@@ -74,7 +74,7 @@ irqreturn_t pb1200_cascade_handler( int irq, void *dev_id)
74 bcsr->int_status = bisr; 74 bcsr->int_status = bisr;
75 for( ; bisr; bisr &= (bisr-1) ) 75 for( ; bisr; bisr &= (bisr-1) )
76 { 76 {
77 extirq_nr = (PB1200_INT_BEGIN-1) + au_ffs(bisr); 77 extirq_nr = PB1200_INT_BEGIN + au_ffs(bisr);
78 /* Ack and dispatch IRQ */ 78 /* Ack and dispatch IRQ */
79 do_IRQ(extirq_nr); 79 do_IRQ(extirq_nr);
80 } 80 }
diff --git a/arch/mips/au1000/pb1500/init.c b/arch/mips/au1000/pb1500/init.c
index e58a9d6c5021..507d4b204161 100644
--- a/arch/mips/au1000/pb1500/init.c
+++ b/arch/mips/au1000/pb1500/init.c
@@ -31,15 +31,13 @@
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/bootmem.h> 33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h> 34#include <linux/string.h>
37#include <linux/kernel.h> 35#include <linux/kernel.h>
38 36
39int prom_argc; 37#include <asm/addrspace.h>
40char **prom_argv, **prom_envp; 38#include <asm/bootinfo.h>
41extern void __init prom_init_cmdline(void); 39
42extern char *prom_getenv(char *envname); 40#include <prom.h>
43 41
44const char *get_system_type(void) 42const char *get_system_type(void)
45{ 43{
diff --git a/arch/mips/au1000/pb1500/irqmap.c b/arch/mips/au1000/pb1500/irqmap.c
index 409d1612bb63..810f695e24bb 100644
--- a/arch/mips/au1000/pb1500/irqmap.c
+++ b/arch/mips/au1000/pb1500/irqmap.c
@@ -52,7 +52,7 @@ char irq_tab_alchemy[][5] __initdata = {
52 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */ 52 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */
53}; 53};
54 54
55au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 55struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
56 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 56 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
57 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 57 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
58 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 58 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/au1000/pb1550/init.c b/arch/mips/au1000/pb1550/init.c
index fad53bf5aad1..b03eee601e36 100644
--- a/arch/mips/au1000/pb1550/init.c
+++ b/arch/mips/au1000/pb1550/init.c
@@ -31,15 +31,13 @@
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/bootmem.h> 33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h> 34#include <linux/string.h>
37#include <linux/kernel.h> 35#include <linux/kernel.h>
38 36
39int prom_argc; 37#include <asm/addrspace.h>
40char **prom_argv, **prom_envp; 38#include <asm/bootinfo.h>
41extern void __init prom_init_cmdline(void); 39
42extern char *prom_getenv(char *envname); 40#include <prom.h>
43 41
44const char *get_system_type(void) 42const char *get_system_type(void)
45{ 43{
diff --git a/arch/mips/au1000/pb1550/irqmap.c b/arch/mips/au1000/pb1550/irqmap.c
index 24a9d186cf5a..56becab28e5d 100644
--- a/arch/mips/au1000/pb1550/irqmap.c
+++ b/arch/mips/au1000/pb1550/irqmap.c
@@ -52,7 +52,7 @@ char irq_tab_alchemy[][5] __initdata = {
52 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */ 52 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */
53}; 53};
54 54
55au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 55struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
56 { AU1000_GPIO_0, INTC_INT_LOW_LEVEL, 0 }, 56 { AU1000_GPIO_0, INTC_INT_LOW_LEVEL, 0 },
57 { AU1000_GPIO_1, INTC_INT_LOW_LEVEL, 0 }, 57 { AU1000_GPIO_1, INTC_INT_LOW_LEVEL, 0 },
58}; 58};
diff --git a/arch/mips/au1000/xxs1500/init.c b/arch/mips/au1000/xxs1500/init.c
index 9f839c36f69e..6532939f377a 100644
--- a/arch/mips/au1000/xxs1500/init.c
+++ b/arch/mips/au1000/xxs1500/init.c
@@ -30,15 +30,13 @@
30#include <linux/mm.h> 30#include <linux/mm.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <linux/bootmem.h> 32#include <linux/bootmem.h>
33#include <asm/addrspace.h>
34#include <asm/bootinfo.h>
35#include <linux/string.h> 33#include <linux/string.h>
36#include <linux/kernel.h> 34#include <linux/kernel.h>
37 35
38int prom_argc; 36#include <asm/addrspace.h>
39char **prom_argv, **prom_envp; 37#include <asm/bootinfo.h>
40extern void __init prom_init_cmdline(void); 38
41extern char *prom_getenv(char *envname); 39#include <prom.h>
42 40
43const char *get_system_type(void) 41const char *get_system_type(void)
44{ 42{
diff --git a/arch/mips/au1000/xxs1500/irqmap.c b/arch/mips/au1000/xxs1500/irqmap.c
index 3844c6429e27..389349295d70 100644
--- a/arch/mips/au1000/xxs1500/irqmap.c
+++ b/arch/mips/au1000/xxs1500/irqmap.c
@@ -47,7 +47,7 @@
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/au1000.h> 48#include <asm/au1000.h>
49 49
50au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 50struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
51 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 51 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
52 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 52 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
53 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 53 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
index 7f14f70a1b88..0c7aee1682cd 100644
--- a/arch/mips/jmr3927/rbhma3100/setup.c
+++ b/arch/mips/jmr3927/rbhma3100/setup.c
@@ -425,7 +425,7 @@ static int __init jmr3927_rtc_init(void)
425 .flags = IORESOURCE_MEM, 425 .flags = IORESOURCE_MEM,
426 }; 426 };
427 struct platform_device *dev; 427 struct platform_device *dev;
428 dev = platform_device_register_simple("ds1742", -1, &res, 1); 428 dev = platform_device_register_simple("rtc-ds1742", -1, &res, 1);
429 return IS_ERR(dev) ? PTR_ERR(dev) : 0; 429 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
430} 430}
431device_initcall(jmr3927_rtc_init); 431device_initcall(jmr3927_rtc_init);
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 58aa6fec1146..999f7853de26 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -435,10 +435,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
435 wake_up_process(child); 435 wake_up_process(child);
436 break; 436 break;
437 437
438 case PTRACE_DETACH: /* detach a process that was attached. */
439 ret = ptrace_detach(child, data);
440 break;
441
442 case PTRACE_GET_THREAD_AREA: 438 case PTRACE_GET_THREAD_AREA:
443 ret = put_user(task_thread_info(child)->tp_value, 439 ret = put_user(task_thread_info(child)->tp_value,
444 (unsigned long __user *) data); 440 (unsigned long __user *) data);
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 432f2e376aea..63989e9df4f9 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -379,7 +379,7 @@ void flush_tlb_mm(struct mm_struct *mm)
379 unsigned int cpu; 379 unsigned int cpu;
380 380
381 cpu_clear(smp_processor_id(), mask); 381 cpu_clear(smp_processor_id(), mask);
382 for_each_online_cpu(cpu) 382 for_each_cpu_mask(cpu, mask)
383 if (cpu_context(cpu, mm)) 383 if (cpu_context(cpu, mm))
384 cpu_context(cpu, mm) = 0; 384 cpu_context(cpu, mm) = 0;
385 } 385 }
@@ -419,7 +419,7 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned l
419 unsigned int cpu; 419 unsigned int cpu;
420 420
421 cpu_clear(smp_processor_id(), mask); 421 cpu_clear(smp_processor_id(), mask);
422 for_each_online_cpu(cpu) 422 for_each_cpu_mask(cpu, mask)
423 if (cpu_context(cpu, mm)) 423 if (cpu_context(cpu, mm))
424 cpu_context(cpu, mm) = 0; 424 cpu_context(cpu, mm) = 0;
425 } 425 }
@@ -466,7 +466,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
466 unsigned int cpu; 466 unsigned int cpu;
467 467
468 cpu_clear(smp_processor_id(), mask); 468 cpu_clear(smp_processor_id(), mask);
469 for_each_online_cpu(cpu) 469 for_each_cpu_mask(cpu, mask)
470 if (cpu_context(cpu, vma->vm_mm)) 470 if (cpu_context(cpu, vma->vm_mm))
471 cpu_context(cpu, vma->vm_mm) = 0; 471 cpu_context(cpu, vma->vm_mm) = 0;
472 } 472 }
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 5892491b40eb..05b365167a09 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -421,7 +421,7 @@ void __cpuinit mips_clockevent_init(void)
421 cd->mult = div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32); 421 cd->mult = div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
422 cd->shift = 32; 422 cd->shift = 32;
423 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd); 423 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
424 cd->min_delta_ns = clockevent_delta2ns(0x30, cd); 424 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
425 425
426 cd->rating = 300; 426 cd->rating = 300;
427 cd->irq = irq; 427 cd->irq = irq;
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 632bce1bf420..9c0c478d71ac 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -104,7 +104,7 @@ static int __init set_raw_show_trace(char *str)
104__setup("raw_show_trace", set_raw_show_trace); 104__setup("raw_show_trace", set_raw_show_trace);
105#endif 105#endif
106 106
107static void show_backtrace(struct task_struct *task, struct pt_regs *regs) 107static void show_backtrace(struct task_struct *task, const struct pt_regs *regs)
108{ 108{
109 unsigned long sp = regs->regs[29]; 109 unsigned long sp = regs->regs[29];
110 unsigned long ra = regs->regs[31]; 110 unsigned long ra = regs->regs[31];
@@ -126,7 +126,8 @@ static void show_backtrace(struct task_struct *task, struct pt_regs *regs)
126 * This routine abuses get_user()/put_user() to reference pointers 126 * This routine abuses get_user()/put_user() to reference pointers
127 * with at least a bit of error checking ... 127 * with at least a bit of error checking ...
128 */ 128 */
129static void show_stacktrace(struct task_struct *task, struct pt_regs *regs) 129static void show_stacktrace(struct task_struct *task,
130 const struct pt_regs *regs)
130{ 131{
131 const int field = 2 * sizeof(unsigned long); 132 const int field = 2 * sizeof(unsigned long);
132 long stackdata; 133 long stackdata;
@@ -203,7 +204,7 @@ static void show_code(unsigned int __user *pc)
203 } 204 }
204} 205}
205 206
206void show_regs(struct pt_regs *regs) 207static void __show_regs(const struct pt_regs *regs)
207{ 208{
208 const int field = 2 * sizeof(unsigned long); 209 const int field = 2 * sizeof(unsigned long);
209 unsigned int cause = regs->cp0_cause; 210 unsigned int cause = regs->cp0_cause;
@@ -299,9 +300,17 @@ void show_regs(struct pt_regs *regs)
299 cpu_name_string()); 300 cpu_name_string());
300} 301}
301 302
302void show_registers(struct pt_regs *regs) 303/*
304 * FIXME: really the generic show_regs should take a const pointer argument.
305 */
306void show_regs(struct pt_regs *regs)
307{
308 __show_regs((struct pt_regs *)regs);
309}
310
311void show_registers(const struct pt_regs *regs)
303{ 312{
304 show_regs(regs); 313 __show_regs(regs);
305 print_modules(); 314 print_modules();
306 printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n", 315 printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n",
307 current->comm, current->pid, current_thread_info(), current); 316 current->comm, current->pid, current_thread_info(), current);
@@ -312,7 +321,7 @@ void show_registers(struct pt_regs *regs)
312 321
313static DEFINE_SPINLOCK(die_lock); 322static DEFINE_SPINLOCK(die_lock);
314 323
315void __noreturn die(const char * str, struct pt_regs * regs) 324void __noreturn die(const char * str, const struct pt_regs * regs)
316{ 325{
317 static int die_counter; 326 static int die_counter;
318#ifdef CONFIG_MIPS_MT_SMTC 327#ifdef CONFIG_MIPS_MT_SMTC
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 84f9a4cc6f2f..2781cff1485e 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -5,6 +5,10 @@
5#define mips mips 5#define mips mips
6OUTPUT_ARCH(mips) 6OUTPUT_ARCH(mips)
7ENTRY(kernel_entry) 7ENTRY(kernel_entry)
8PHDRS {
9 text PT_LOAD FLAGS(7); /* RWX */
10 note PT_NOTE FLAGS(4); /* R__ */
11}
8jiffies = JIFFIES; 12jiffies = JIFFIES;
9 13
10SECTIONS 14SECTIONS
@@ -22,7 +26,6 @@ SECTIONS
22 */ 26 */
23 27
24 /* . = 0xa800000000300000; */ 28 /* . = 0xa800000000300000; */
25 /* . = 0xa800000000300000; */
26 . = 0xffffffff80300000; 29 . = 0xffffffff80300000;
27#endif 30#endif
28 . = LOADADDR; 31 . = LOADADDR;
@@ -32,9 +35,10 @@ SECTIONS
32 TEXT_TEXT 35 TEXT_TEXT
33 SCHED_TEXT 36 SCHED_TEXT
34 LOCK_TEXT 37 LOCK_TEXT
38 KPROBES_TEXT
35 *(.fixup) 39 *(.fixup)
36 *(.gnu.warning) 40 *(.gnu.warning)
37 } =0 41 } :text = 0
38 _etext = .; /* End of text section */ 42 _etext = .; /* End of text section */
39 43
40 /* Exception table */ 44 /* Exception table */
@@ -51,6 +55,10 @@ SECTIONS
51 *(__dbe_table) 55 *(__dbe_table)
52 __stop___dbe_table = .; 56 __stop___dbe_table = .;
53 } 57 }
58
59 NOTES :text :note
60 .dummy : { *(.dummy) } :text
61
54 RODATA 62 RODATA
55 63
56 /* writeable */ 64 /* writeable */
@@ -201,7 +209,4 @@ SECTIONS
201 *(.gptab.bss) 209 *(.gptab.bss)
202 *(.gptab.sbss) 210 *(.gptab.sbss)
203 } 211 }
204 .note : {
205 *(.note)
206 }
207} 212}
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 61b729fa0548..df8cbe4c7c0d 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -1317,7 +1317,8 @@ static void kspd_sp_exit( int sp_id)
1317} 1317}
1318#endif 1318#endif
1319 1319
1320static ssize_t store_kill(struct class_device *dev, const char *buf, size_t len) 1320static ssize_t store_kill(struct device *dev, struct device_attribute *attr,
1321 const char *buf, size_t len)
1321{ 1322{
1322 struct vpe *vpe = get_vpe(tclimit); 1323 struct vpe *vpe = get_vpe(tclimit);
1323 struct vpe_notifications *not; 1324 struct vpe_notifications *not;
@@ -1334,14 +1335,16 @@ static ssize_t store_kill(struct class_device *dev, const char *buf, size_t len)
1334 return len; 1335 return len;
1335} 1336}
1336 1337
1337static ssize_t show_ntcs(struct class_device *cd, char *buf) 1338static ssize_t show_ntcs(struct device *cd, struct device_attribute *attr,
1339 char *buf)
1338{ 1340{
1339 struct vpe *vpe = get_vpe(tclimit); 1341 struct vpe *vpe = get_vpe(tclimit);
1340 1342
1341 return sprintf(buf, "%d\n", vpe->ntcs); 1343 return sprintf(buf, "%d\n", vpe->ntcs);
1342} 1344}
1343 1345
1344static ssize_t store_ntcs(struct class_device *dev, const char *buf, size_t len) 1346static ssize_t store_ntcs(struct device *dev, struct device_attribute *attr,
1347 const char *buf, size_t len)
1345{ 1348{
1346 struct vpe *vpe = get_vpe(tclimit); 1349 struct vpe *vpe = get_vpe(tclimit);
1347 unsigned long new; 1350 unsigned long new;
@@ -1362,13 +1365,13 @@ out_einval:
1362 return -EINVAL;; 1365 return -EINVAL;;
1363} 1366}
1364 1367
1365static struct class_device_attribute vpe_class_attributes[] = { 1368static struct device_attribute vpe_class_attributes[] = {
1366 __ATTR(kill, S_IWUSR, NULL, store_kill), 1369 __ATTR(kill, S_IWUSR, NULL, store_kill),
1367 __ATTR(ntcs, S_IRUGO | S_IWUSR, show_ntcs, store_ntcs), 1370 __ATTR(ntcs, S_IRUGO | S_IWUSR, show_ntcs, store_ntcs),
1368 {} 1371 {}
1369}; 1372};
1370 1373
1371static void vpe_class_device_release(struct class_device *cd) 1374static void vpe_device_release(struct device *cd)
1372{ 1375{
1373 kfree(cd); 1376 kfree(cd);
1374} 1377}
@@ -1376,11 +1379,11 @@ static void vpe_class_device_release(struct class_device *cd)
1376struct class vpe_class = { 1379struct class vpe_class = {
1377 .name = "vpe", 1380 .name = "vpe",
1378 .owner = THIS_MODULE, 1381 .owner = THIS_MODULE,
1379 .release = vpe_class_device_release, 1382 .dev_release = vpe_device_release,
1380 .class_dev_attrs = vpe_class_attributes, 1383 .dev_attrs = vpe_class_attributes,
1381}; 1384};
1382 1385
1383struct class_device vpe_device; 1386struct device vpe_device;
1384 1387
1385static int __init vpe_module_init(void) 1388static int __init vpe_module_init(void)
1386{ 1389{
@@ -1423,12 +1426,12 @@ static int __init vpe_module_init(void)
1423 goto out_chrdev; 1426 goto out_chrdev;
1424 } 1427 }
1425 1428
1426 class_device_initialize(&vpe_device); 1429 device_initialize(&vpe_device);
1427 vpe_device.class = &vpe_class, 1430 vpe_device.class = &vpe_class,
1428 vpe_device.parent = NULL, 1431 vpe_device.parent = NULL,
1429 strlcpy(vpe_device.class_id, "vpe1", BUS_ID_SIZE); 1432 strlcpy(vpe_device.bus_id, "vpe1", BUS_ID_SIZE);
1430 vpe_device.devt = MKDEV(major, minor); 1433 vpe_device.devt = MKDEV(major, minor);
1431 err = class_device_add(&vpe_device); 1434 err = device_add(&vpe_device);
1432 if (err) { 1435 if (err) {
1433 printk(KERN_ERR "Adding vpe_device failed\n"); 1436 printk(KERN_ERR "Adding vpe_device failed\n");
1434 goto out_class; 1437 goto out_class;
@@ -1573,7 +1576,7 @@ static void __exit vpe_module_exit(void)
1573 } 1576 }
1574 } 1577 }
1575 1578
1576 class_device_del(&vpe_device); 1579 device_del(&vpe_device);
1577 unregister_chrdev(major, module_name); 1580 unregister_chrdev(major, module_name);
1578} 1581}
1579 1582
diff --git a/arch/mips/lasat/interrupt.c b/arch/mips/lasat/interrupt.c
index 5f35289bfff5..ba9692be3564 100644
--- a/arch/mips/lasat/interrupt.c
+++ b/arch/mips/lasat/interrupt.c
@@ -26,6 +26,7 @@
26#include <linux/kernel_stat.h> 26#include <linux/kernel_stat.h>
27 27
28#include <asm/bootinfo.h> 28#include <asm/bootinfo.h>
29#include <asm/irq_cpu.h>
29#include <asm/lasat/lasatint.h> 30#include <asm/lasat/lasatint.h>
30#include <asm/time.h> 31#include <asm/time.h>
31#include <asm/gdb-stub.h> 32#include <asm/gdb-stub.h>
@@ -88,7 +89,7 @@ asmlinkage void plat_irq_dispatch(void)
88 int irq; 89 int irq;
89 90
90 if (cause & CAUSEF_IP7) { /* R4000 count / compare IRQ */ 91 if (cause & CAUSEF_IP7) { /* R4000 count / compare IRQ */
91 ll_timer_interrupt(7); 92 do_IRQ(7);
92 return; 93 return;
93 } 94 }
94 95
@@ -96,7 +97,7 @@ asmlinkage void plat_irq_dispatch(void)
96 97
97 /* if int_status == 0, then the interrupt has already been cleared */ 98 /* if int_status == 0, then the interrupt has already been cleared */
98 if (int_status) { 99 if (int_status) {
99 irq = ls1bit32(int_status); 100 irq = LASATINT_BASE + ls1bit32(int_status);
100 101
101 do_IRQ(irq); 102 do_IRQ(irq);
102 } 103 }
@@ -125,6 +126,7 @@ void __init arch_init_irq(void)
125 panic("arch_init_irq: mips_machtype incorrect"); 126 panic("arch_init_irq: mips_machtype incorrect");
126 } 127 }
127 128
128 for (i = 0; i <= LASATINT_END; i++) 129 mips_cpu_irq_init();
130 for (i = LASATINT_BASE; i <= LASATINT_END; i++)
129 set_irq_chip_and_handler(i, &lasat_irq_type, handle_level_irq); 131 set_irq_chip_and_handler(i, &lasat_irq_type, handle_level_irq);
130} 132}
diff --git a/arch/mips/mipssim/sim_cmdline.c b/arch/mips/mipssim/sim_cmdline.c
index c63021a5dc6c..74240e1ce5a5 100644
--- a/arch/mips/mipssim/sim_cmdline.c
+++ b/arch/mips/mipssim/sim_cmdline.c
@@ -28,8 +28,5 @@ char * __init prom_getcmdline(void)
28 28
29void __init prom_init_cmdline(void) 29void __init prom_init_cmdline(void)
30{ 30{
31 char *cp; 31 /* XXX: Get boot line from environment? */
32 cp = arcs_cmdline;
33 /* Get boot line from environment? */
34 *cp = '\0';
35} 32}
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 971f6c047b8a..d7088331fb0f 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -983,11 +983,15 @@ static void __init probe_pcache(void)
983 983
984 printk("Primary instruction cache %ldkB, %s, %s, linesize %d bytes.\n", 984 printk("Primary instruction cache %ldkB, %s, %s, linesize %d bytes.\n",
985 icache_size >> 10, 985 icache_size >> 10,
986 cpu_has_vtag_icache ? "virtually tagged" : "physically tagged", 986 cpu_has_vtag_icache ? "VIVT" : "VIPT",
987 way_string[c->icache.ways], c->icache.linesz); 987 way_string[c->icache.ways], c->icache.linesz);
988 988
989 printk("Primary data cache %ldkB, %s, linesize %d bytes.\n", 989 printk("Primary data cache %ldkB, %s, %s, %s, linesize %d bytes\n",
990 dcache_size >> 10, way_string[c->dcache.ways], c->dcache.linesz); 990 dcache_size >> 10, way_string[c->dcache.ways],
991 (c->dcache.flags & MIPS_CACHE_PINDEX) ? "PIPT" : "VIPT",
992 (c->dcache.flags & MIPS_CACHE_ALIASES) ?
993 "cache aliases" : "no aliases",
994 c->dcache.linesz);
991} 995}
992 996
993/* 997/*
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 521771b373de..5699c7713e2f 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -180,7 +180,7 @@ out_of_memory:
180 } 180 }
181 printk("VM: killing process %s\n", tsk->comm); 181 printk("VM: killing process %s\n", tsk->comm);
182 if (user_mode(regs)) 182 if (user_mode(regs))
183 do_exit(SIGKILL); 183 do_group_exit(SIGKILL);
184 goto no_context; 184 goto no_context;
185 185
186do_sigbus: 186do_sigbus:
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 5240432e6d1d..110ee7656b41 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -211,7 +211,7 @@ void copy_user_highpage(struct page *to, struct page *from,
211 void *vfrom, *vto; 211 void *vfrom, *vto;
212 212
213 vto = kmap_atomic(to, KM_USER1); 213 vto = kmap_atomic(to, KM_USER1);
214 if (cpu_has_dc_aliases && !Page_dcache_dirty(from)) { 214 if (cpu_has_dc_aliases && page_mapped(from)) {
215 vfrom = kmap_coherent(from, vaddr); 215 vfrom = kmap_coherent(from, vaddr);
216 copy_page(vto, vfrom); 216 copy_page(vto, vfrom);
217 kunmap_coherent(); 217 kunmap_coherent();
@@ -234,12 +234,15 @@ void copy_to_user_page(struct vm_area_struct *vma,
234 struct page *page, unsigned long vaddr, void *dst, const void *src, 234 struct page *page, unsigned long vaddr, void *dst, const void *src,
235 unsigned long len) 235 unsigned long len)
236{ 236{
237 if (cpu_has_dc_aliases) { 237 if (cpu_has_dc_aliases && page_mapped(page)) {
238 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); 238 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
239 memcpy(vto, src, len); 239 memcpy(vto, src, len);
240 kunmap_coherent(); 240 kunmap_coherent();
241 } else 241 } else {
242 memcpy(dst, src, len); 242 memcpy(dst, src, len);
243 if (cpu_has_dc_aliases)
244 SetPageDcacheDirty(page);
245 }
243 if ((vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc) 246 if ((vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc)
244 flush_cache_page(vma, vaddr, page_to_pfn(page)); 247 flush_cache_page(vma, vaddr, page_to_pfn(page));
245} 248}
@@ -250,13 +253,15 @@ void copy_from_user_page(struct vm_area_struct *vma,
250 struct page *page, unsigned long vaddr, void *dst, const void *src, 253 struct page *page, unsigned long vaddr, void *dst, const void *src,
251 unsigned long len) 254 unsigned long len)
252{ 255{
253 if (cpu_has_dc_aliases) { 256 if (cpu_has_dc_aliases && page_mapped(page)) {
254 void *vfrom = 257 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
255 kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
256 memcpy(dst, vfrom, len); 258 memcpy(dst, vfrom, len);
257 kunmap_coherent(); 259 kunmap_coherent();
258 } else 260 } else {
259 memcpy(dst, src, len); 261 memcpy(dst, src, len);
262 if (cpu_has_dc_aliases)
263 SetPageDcacheDirty(page);
264 }
260} 265}
261 266
262EXPORT_SYMBOL(copy_from_user_page); 267EXPORT_SYMBOL(copy_from_user_page);
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 01b0961acfb6..a61246d3533d 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -66,7 +66,7 @@ static inline int __maybe_unused r10000_llsc_war(void)
66 * why; it's not an issue caused by the core RTL. 66 * why; it's not an issue caused by the core RTL.
67 * 67 *
68 */ 68 */
69static int __init m4kc_tlbp_war(void) 69static __init int __attribute__((unused)) m4kc_tlbp_war(void)
70{ 70{
71 return (current_cpu_data.processor_id & 0xffff00) == 71 return (current_cpu_data.processor_id & 0xffff00) ==
72 (PRID_COMP_MIPS | PRID_IMP_4KC); 72 (PRID_COMP_MIPS | PRID_IMP_4KC);
@@ -140,7 +140,7 @@ struct insn {
140 | (e) << RE_SH \ 140 | (e) << RE_SH \
141 | (f) << FUNC_SH) 141 | (f) << FUNC_SH)
142 142
143static struct insn insn_table[] __initdata = { 143static __initdata struct insn insn_table[] = {
144 { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 144 { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
145 { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD }, 145 { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD },
146 { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD }, 146 { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD },
@@ -193,7 +193,7 @@ static struct insn insn_table[] __initdata = {
193 193
194#undef M 194#undef M
195 195
196static u32 __init build_rs(u32 arg) 196static __init u32 build_rs(u32 arg)
197{ 197{
198 if (arg & ~RS_MASK) 198 if (arg & ~RS_MASK)
199 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 199 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -201,7 +201,7 @@ static u32 __init build_rs(u32 arg)
201 return (arg & RS_MASK) << RS_SH; 201 return (arg & RS_MASK) << RS_SH;
202} 202}
203 203
204static u32 __init build_rt(u32 arg) 204static __init u32 build_rt(u32 arg)
205{ 205{
206 if (arg & ~RT_MASK) 206 if (arg & ~RT_MASK)
207 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 207 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -209,7 +209,7 @@ static u32 __init build_rt(u32 arg)
209 return (arg & RT_MASK) << RT_SH; 209 return (arg & RT_MASK) << RT_SH;
210} 210}
211 211
212static u32 __init build_rd(u32 arg) 212static __init u32 build_rd(u32 arg)
213{ 213{
214 if (arg & ~RD_MASK) 214 if (arg & ~RD_MASK)
215 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 215 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -217,7 +217,7 @@ static u32 __init build_rd(u32 arg)
217 return (arg & RD_MASK) << RD_SH; 217 return (arg & RD_MASK) << RD_SH;
218} 218}
219 219
220static u32 __init build_re(u32 arg) 220static __init u32 build_re(u32 arg)
221{ 221{
222 if (arg & ~RE_MASK) 222 if (arg & ~RE_MASK)
223 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 223 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -225,7 +225,7 @@ static u32 __init build_re(u32 arg)
225 return (arg & RE_MASK) << RE_SH; 225 return (arg & RE_MASK) << RE_SH;
226} 226}
227 227
228static u32 __init build_simm(s32 arg) 228static __init u32 build_simm(s32 arg)
229{ 229{
230 if (arg > 0x7fff || arg < -0x8000) 230 if (arg > 0x7fff || arg < -0x8000)
231 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 231 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -233,7 +233,7 @@ static u32 __init build_simm(s32 arg)
233 return arg & 0xffff; 233 return arg & 0xffff;
234} 234}
235 235
236static u32 __init build_uimm(u32 arg) 236static __init u32 build_uimm(u32 arg)
237{ 237{
238 if (arg & ~IMM_MASK) 238 if (arg & ~IMM_MASK)
239 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 239 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -241,7 +241,7 @@ static u32 __init build_uimm(u32 arg)
241 return arg & IMM_MASK; 241 return arg & IMM_MASK;
242} 242}
243 243
244static u32 __init build_bimm(s32 arg) 244static __init u32 build_bimm(s32 arg)
245{ 245{
246 if (arg > 0x1ffff || arg < -0x20000) 246 if (arg > 0x1ffff || arg < -0x20000)
247 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 247 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -252,7 +252,7 @@ static u32 __init build_bimm(s32 arg)
252 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff); 252 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff);
253} 253}
254 254
255static u32 __init build_jimm(u32 arg) 255static __init u32 build_jimm(u32 arg)
256{ 256{
257 if (arg & ~((JIMM_MASK) << 2)) 257 if (arg & ~((JIMM_MASK) << 2))
258 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 258 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -260,7 +260,7 @@ static u32 __init build_jimm(u32 arg)
260 return (arg >> 2) & JIMM_MASK; 260 return (arg >> 2) & JIMM_MASK;
261} 261}
262 262
263static u32 __init build_func(u32 arg) 263static __init u32 build_func(u32 arg)
264{ 264{
265 if (arg & ~FUNC_MASK) 265 if (arg & ~FUNC_MASK)
266 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 266 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -268,7 +268,7 @@ static u32 __init build_func(u32 arg)
268 return arg & FUNC_MASK; 268 return arg & FUNC_MASK;
269} 269}
270 270
271static u32 __init build_set(u32 arg) 271static __init u32 build_set(u32 arg)
272{ 272{
273 if (arg & ~SET_MASK) 273 if (arg & ~SET_MASK)
274 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 274 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -315,69 +315,69 @@ static void __init build_insn(u32 **buf, enum opcode opc, ...)
315} 315}
316 316
317#define I_u1u2u3(op) \ 317#define I_u1u2u3(op) \
318 static inline void i##op(u32 **buf, unsigned int a, \ 318 static inline void __init i##op(u32 **buf, unsigned int a, \
319 unsigned int b, unsigned int c) \ 319 unsigned int b, unsigned int c) \
320 { \ 320 { \
321 build_insn(buf, insn##op, a, b, c); \ 321 build_insn(buf, insn##op, a, b, c); \
322 } 322 }
323 323
324#define I_u2u1u3(op) \ 324#define I_u2u1u3(op) \
325 static inline void i##op(u32 **buf, unsigned int a, \ 325 static inline void __init i##op(u32 **buf, unsigned int a, \
326 unsigned int b, unsigned int c) \ 326 unsigned int b, unsigned int c) \
327 { \ 327 { \
328 build_insn(buf, insn##op, b, a, c); \ 328 build_insn(buf, insn##op, b, a, c); \
329 } 329 }
330 330
331#define I_u3u1u2(op) \ 331#define I_u3u1u2(op) \
332 static inline void i##op(u32 **buf, unsigned int a, \ 332 static inline void __init i##op(u32 **buf, unsigned int a, \
333 unsigned int b, unsigned int c) \ 333 unsigned int b, unsigned int c) \
334 { \ 334 { \
335 build_insn(buf, insn##op, b, c, a); \ 335 build_insn(buf, insn##op, b, c, a); \
336 } 336 }
337 337
338#define I_u1u2s3(op) \ 338#define I_u1u2s3(op) \
339 static inline void i##op(u32 **buf, unsigned int a, \ 339 static inline void __init i##op(u32 **buf, unsigned int a, \
340 unsigned int b, signed int c) \ 340 unsigned int b, signed int c) \
341 { \ 341 { \
342 build_insn(buf, insn##op, a, b, c); \ 342 build_insn(buf, insn##op, a, b, c); \
343 } 343 }
344 344
345#define I_u2s3u1(op) \ 345#define I_u2s3u1(op) \
346 static inline void i##op(u32 **buf, unsigned int a, \ 346 static inline void __init i##op(u32 **buf, unsigned int a, \
347 signed int b, unsigned int c) \ 347 signed int b, unsigned int c) \
348 { \ 348 { \
349 build_insn(buf, insn##op, c, a, b); \ 349 build_insn(buf, insn##op, c, a, b); \
350 } 350 }
351 351
352#define I_u2u1s3(op) \ 352#define I_u2u1s3(op) \
353 static inline void i##op(u32 **buf, unsigned int a, \ 353 static inline void __init i##op(u32 **buf, unsigned int a, \
354 unsigned int b, signed int c) \ 354 unsigned int b, signed int c) \
355 { \ 355 { \
356 build_insn(buf, insn##op, b, a, c); \ 356 build_insn(buf, insn##op, b, a, c); \
357 } 357 }
358 358
359#define I_u1u2(op) \ 359#define I_u1u2(op) \
360 static inline void i##op(u32 **buf, unsigned int a, \ 360 static inline void __init i##op(u32 **buf, unsigned int a, \
361 unsigned int b) \ 361 unsigned int b) \
362 { \ 362 { \
363 build_insn(buf, insn##op, a, b); \ 363 build_insn(buf, insn##op, a, b); \
364 } 364 }
365 365
366#define I_u1s2(op) \ 366#define I_u1s2(op) \
367 static inline void i##op(u32 **buf, unsigned int a, \ 367 static inline void __init i##op(u32 **buf, unsigned int a, \
368 signed int b) \ 368 signed int b) \
369 { \ 369 { \
370 build_insn(buf, insn##op, a, b); \ 370 build_insn(buf, insn##op, a, b); \
371 } 371 }
372 372
373#define I_u1(op) \ 373#define I_u1(op) \
374 static inline void i##op(u32 **buf, unsigned int a) \ 374 static inline void __init i##op(u32 **buf, unsigned int a) \
375 { \ 375 { \
376 build_insn(buf, insn##op, a); \ 376 build_insn(buf, insn##op, a); \
377 } 377 }
378 378
379#define I_0(op) \ 379#define I_0(op) \
380 static inline void i##op(u32 **buf) \ 380 static inline void __init i##op(u32 **buf) \
381 { \ 381 { \
382 build_insn(buf, insn##op); \ 382 build_insn(buf, insn##op); \
383 } 383 }
@@ -457,7 +457,7 @@ struct label {
457 enum label_id lab; 457 enum label_id lab;
458}; 458};
459 459
460static void __init build_label(struct label **lab, u32 *addr, 460static __init void build_label(struct label **lab, u32 *addr,
461 enum label_id l) 461 enum label_id l)
462{ 462{
463 (*lab)->addr = addr; 463 (*lab)->addr = addr;
@@ -526,34 +526,34 @@ L_LA(_r3000_write_probe_fail)
526#define i_ehb(buf) i_sll(buf, 0, 0, 3) 526#define i_ehb(buf) i_sll(buf, 0, 0, 3)
527 527
528#ifdef CONFIG_64BIT 528#ifdef CONFIG_64BIT
529static int __init __maybe_unused in_compat_space_p(long addr) 529static __init int __maybe_unused in_compat_space_p(long addr)
530{ 530{
531 /* Is this address in 32bit compat space? */ 531 /* Is this address in 32bit compat space? */
532 return (((addr) & 0xffffffff00000000L) == 0xffffffff00000000L); 532 return (((addr) & 0xffffffff00000000L) == 0xffffffff00000000L);
533} 533}
534 534
535static int __init __maybe_unused rel_highest(long val) 535static __init int __maybe_unused rel_highest(long val)
536{ 536{
537 return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000; 537 return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000;
538} 538}
539 539
540static int __init __maybe_unused rel_higher(long val) 540static __init int __maybe_unused rel_higher(long val)
541{ 541{
542 return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000; 542 return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000;
543} 543}
544#endif 544#endif
545 545
546static int __init rel_hi(long val) 546static __init int rel_hi(long val)
547{ 547{
548 return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000; 548 return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000;
549} 549}
550 550
551static int __init rel_lo(long val) 551static __init int rel_lo(long val)
552{ 552{
553 return ((val & 0xffff) ^ 0x8000) - 0x8000; 553 return ((val & 0xffff) ^ 0x8000) - 0x8000;
554} 554}
555 555
556static void __init i_LA_mostly(u32 **buf, unsigned int rs, long addr) 556static __init void i_LA_mostly(u32 **buf, unsigned int rs, long addr)
557{ 557{
558#ifdef CONFIG_64BIT 558#ifdef CONFIG_64BIT
559 if (!in_compat_space_p(addr)) { 559 if (!in_compat_space_p(addr)) {
@@ -571,7 +571,7 @@ static void __init i_LA_mostly(u32 **buf, unsigned int rs, long addr)
571 i_lui(buf, rs, rel_hi(addr)); 571 i_lui(buf, rs, rel_hi(addr));
572} 572}
573 573
574static void __init __maybe_unused i_LA(u32 **buf, unsigned int rs, 574static __init void __maybe_unused i_LA(u32 **buf, unsigned int rs,
575 long addr) 575 long addr)
576{ 576{
577 i_LA_mostly(buf, rs, addr); 577 i_LA_mostly(buf, rs, addr);
@@ -589,7 +589,7 @@ struct reloc {
589 enum label_id lab; 589 enum label_id lab;
590}; 590};
591 591
592static void __init r_mips_pc16(struct reloc **rel, u32 *addr, 592static __init void r_mips_pc16(struct reloc **rel, u32 *addr,
593 enum label_id l) 593 enum label_id l)
594{ 594{
595 (*rel)->addr = addr; 595 (*rel)->addr = addr;
@@ -614,7 +614,7 @@ static inline void __resolve_relocs(struct reloc *rel, struct label *lab)
614 } 614 }
615} 615}
616 616
617static void __init resolve_relocs(struct reloc *rel, struct label *lab) 617static __init void resolve_relocs(struct reloc *rel, struct label *lab)
618{ 618{
619 struct label *l; 619 struct label *l;
620 620
@@ -624,7 +624,7 @@ static void __init resolve_relocs(struct reloc *rel, struct label *lab)
624 __resolve_relocs(rel, l); 624 __resolve_relocs(rel, l);
625} 625}
626 626
627static void __init move_relocs(struct reloc *rel, u32 *first, u32 *end, 627static __init void move_relocs(struct reloc *rel, u32 *first, u32 *end,
628 long off) 628 long off)
629{ 629{
630 for (; rel->lab != label_invalid; rel++) 630 for (; rel->lab != label_invalid; rel++)
@@ -632,7 +632,7 @@ static void __init move_relocs(struct reloc *rel, u32 *first, u32 *end,
632 rel->addr += off; 632 rel->addr += off;
633} 633}
634 634
635static void __init move_labels(struct label *lab, u32 *first, u32 *end, 635static __init void move_labels(struct label *lab, u32 *first, u32 *end,
636 long off) 636 long off)
637{ 637{
638 for (; lab->lab != label_invalid; lab++) 638 for (; lab->lab != label_invalid; lab++)
@@ -640,7 +640,7 @@ static void __init move_labels(struct label *lab, u32 *first, u32 *end,
640 lab->addr += off; 640 lab->addr += off;
641} 641}
642 642
643static void __init copy_handler(struct reloc *rel, struct label *lab, 643static __init void copy_handler(struct reloc *rel, struct label *lab,
644 u32 *first, u32 *end, u32 *target) 644 u32 *first, u32 *end, u32 *target)
645{ 645{
646 long off = (long)(target - first); 646 long off = (long)(target - first);
@@ -651,7 +651,7 @@ static void __init copy_handler(struct reloc *rel, struct label *lab,
651 move_labels(lab, first, end, off); 651 move_labels(lab, first, end, off);
652} 652}
653 653
654static int __init __maybe_unused insn_has_bdelay(struct reloc *rel, 654static __init int __maybe_unused insn_has_bdelay(struct reloc *rel,
655 u32 *addr) 655 u32 *addr)
656{ 656{
657 for (; rel->lab != label_invalid; rel++) { 657 for (; rel->lab != label_invalid; rel++) {
@@ -743,11 +743,11 @@ il_bgez(u32 **p, struct reloc **r, unsigned int reg, enum label_id l)
743 * We deliberately chose a buffer size of 128, so we won't scribble 743 * We deliberately chose a buffer size of 128, so we won't scribble
744 * over anything important on overflow before we panic. 744 * over anything important on overflow before we panic.
745 */ 745 */
746static u32 tlb_handler[128] __initdata; 746static __initdata u32 tlb_handler[128];
747 747
748/* simply assume worst case size for labels and relocs */ 748/* simply assume worst case size for labels and relocs */
749static struct label labels[128] __initdata; 749static __initdata struct label labels[128];
750static struct reloc relocs[128] __initdata; 750static __initdata struct reloc relocs[128];
751 751
752/* 752/*
753 * The R3000 TLB handler is simple. 753 * The R3000 TLB handler is simple.
@@ -801,7 +801,7 @@ static void __init build_r3000_tlb_refill_handler(void)
801 * other one.To keep things simple, we first assume linear space, 801 * other one.To keep things simple, we first assume linear space,
802 * then we relocate it to the final handler layout as needed. 802 * then we relocate it to the final handler layout as needed.
803 */ 803 */
804static u32 final_handler[64] __initdata; 804static __initdata u32 final_handler[64];
805 805
806/* 806/*
807 * Hazards 807 * Hazards
@@ -825,7 +825,7 @@ static u32 final_handler[64] __initdata;
825 * 825 *
826 * As if we MIPS hackers wouldn't know how to nop pipelines happy ... 826 * As if we MIPS hackers wouldn't know how to nop pipelines happy ...
827 */ 827 */
828static void __init __maybe_unused build_tlb_probe_entry(u32 **p) 828static __init void __maybe_unused build_tlb_probe_entry(u32 **p)
829{ 829{
830 switch (current_cpu_type()) { 830 switch (current_cpu_type()) {
831 /* Found by experiment: R4600 v2.0 needs this, too. */ 831 /* Found by experiment: R4600 v2.0 needs this, too. */
@@ -849,7 +849,7 @@ static void __init __maybe_unused build_tlb_probe_entry(u32 **p)
849 */ 849 */
850enum tlb_write_entry { tlb_random, tlb_indexed }; 850enum tlb_write_entry { tlb_random, tlb_indexed };
851 851
852static void __init build_tlb_write_entry(u32 **p, struct label **l, 852static __init void build_tlb_write_entry(u32 **p, struct label **l,
853 struct reloc **r, 853 struct reloc **r,
854 enum tlb_write_entry wmode) 854 enum tlb_write_entry wmode)
855{ 855{
@@ -993,7 +993,7 @@ static void __init build_tlb_write_entry(u32 **p, struct label **l,
993 * TMP and PTR are scratch. 993 * TMP and PTR are scratch.
994 * TMP will be clobbered, PTR will hold the pmd entry. 994 * TMP will be clobbered, PTR will hold the pmd entry.
995 */ 995 */
996static void __init 996static __init void
997build_get_pmde64(u32 **p, struct label **l, struct reloc **r, 997build_get_pmde64(u32 **p, struct label **l, struct reloc **r,
998 unsigned int tmp, unsigned int ptr) 998 unsigned int tmp, unsigned int ptr)
999{ 999{
@@ -1054,7 +1054,7 @@ build_get_pmde64(u32 **p, struct label **l, struct reloc **r,
1054 * BVADDR is the faulting address, PTR is scratch. 1054 * BVADDR is the faulting address, PTR is scratch.
1055 * PTR will hold the pgd for vmalloc. 1055 * PTR will hold the pgd for vmalloc.
1056 */ 1056 */
1057static void __init 1057static __init void
1058build_get_pgd_vmalloc64(u32 **p, struct label **l, struct reloc **r, 1058build_get_pgd_vmalloc64(u32 **p, struct label **l, struct reloc **r,
1059 unsigned int bvaddr, unsigned int ptr) 1059 unsigned int bvaddr, unsigned int ptr)
1060{ 1060{
@@ -1118,7 +1118,7 @@ build_get_pgd_vmalloc64(u32 **p, struct label **l, struct reloc **r,
1118 * TMP and PTR are scratch. 1118 * TMP and PTR are scratch.
1119 * TMP will be clobbered, PTR will hold the pgd entry. 1119 * TMP will be clobbered, PTR will hold the pgd entry.
1120 */ 1120 */
1121static void __init __maybe_unused 1121static __init void __maybe_unused
1122build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr) 1122build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr)
1123{ 1123{
1124 long pgdc = (long)pgd_current; 1124 long pgdc = (long)pgd_current;
@@ -1153,7 +1153,7 @@ build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr)
1153 1153
1154#endif /* !CONFIG_64BIT */ 1154#endif /* !CONFIG_64BIT */
1155 1155
1156static void __init build_adjust_context(u32 **p, unsigned int ctx) 1156static __init void build_adjust_context(u32 **p, unsigned int ctx)
1157{ 1157{
1158 unsigned int shift = 4 - (PTE_T_LOG2 + 1) + PAGE_SHIFT - 12; 1158 unsigned int shift = 4 - (PTE_T_LOG2 + 1) + PAGE_SHIFT - 12;
1159 unsigned int mask = (PTRS_PER_PTE / 2 - 1) << (PTE_T_LOG2 + 1); 1159 unsigned int mask = (PTRS_PER_PTE / 2 - 1) << (PTE_T_LOG2 + 1);
@@ -1179,7 +1179,7 @@ static void __init build_adjust_context(u32 **p, unsigned int ctx)
1179 i_andi(p, ctx, ctx, mask); 1179 i_andi(p, ctx, ctx, mask);
1180} 1180}
1181 1181
1182static void __init build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr) 1182static __init void build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr)
1183{ 1183{
1184 /* 1184 /*
1185 * Bug workaround for the Nevada. It seems as if under certain 1185 * Bug workaround for the Nevada. It seems as if under certain
@@ -1204,7 +1204,7 @@ static void __init build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr)
1204 i_ADDU(p, ptr, ptr, tmp); /* add in offset */ 1204 i_ADDU(p, ptr, ptr, tmp); /* add in offset */
1205} 1205}
1206 1206
1207static void __init build_update_entries(u32 **p, unsigned int tmp, 1207static __init void build_update_entries(u32 **p, unsigned int tmp,
1208 unsigned int ptep) 1208 unsigned int ptep)
1209{ 1209{
1210 /* 1210 /*
diff --git a/arch/mips/pci/pci-lasat.c b/arch/mips/pci/pci-lasat.c
index 5abd5c7119be..174f314933b5 100644
--- a/arch/mips/pci/pci-lasat.c
+++ b/arch/mips/pci/pci-lasat.c
@@ -10,6 +10,7 @@
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/types.h> 11#include <linux/types.h>
12#include <asm/bootinfo.h> 12#include <asm/bootinfo.h>
13#include <asm/lasat/lasatint.h>
13 14
14extern struct pci_ops nile4_pci_ops; 15extern struct pci_ops nile4_pci_ops;
15extern struct pci_ops gt64xxx_pci0_ops; 16extern struct pci_ops gt64xxx_pci0_ops;
@@ -54,15 +55,15 @@ static int __init lasat_pci_setup(void)
54 55
55arch_initcall(lasat_pci_setup); 56arch_initcall(lasat_pci_setup);
56 57
57#define LASATINT_ETH1 0 58#define LASATINT_ETH1 (LASATINT_BASE + 0)
58#define LASATINT_ETH0 1 59#define LASATINT_ETH0 (LASATINT_BASE + 1)
59#define LASATINT_HDC 2 60#define LASATINT_HDC (LASATINT_BASE + 2)
60#define LASATINT_COMP 3 61#define LASATINT_COMP (LASATINT_BASE + 3)
61#define LASATINT_HDLC 4 62#define LASATINT_HDLC (LASATINT_BASE + 4)
62#define LASATINT_PCIA 5 63#define LASATINT_PCIA (LASATINT_BASE + 5)
63#define LASATINT_PCIB 6 64#define LASATINT_PCIB (LASATINT_BASE + 6)
64#define LASATINT_PCIC 7 65#define LASATINT_PCIC (LASATINT_BASE + 7)
65#define LASATINT_PCID 8 66#define LASATINT_PCID (LASATINT_BASE + 8)
66 67
67int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 68int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
68{ 69{
diff --git a/arch/mips/sgi-ip22/Makefile b/arch/mips/sgi-ip22/Makefile
index 1fb3e353e212..e3acb51b70b5 100644
--- a/arch/mips/sgi-ip22/Makefile
+++ b/arch/mips/sgi-ip22/Makefile
@@ -7,3 +7,5 @@ obj-y += ip22-mc.o ip22-hpc.o ip22-int.o ip22-berr.o \
7 ip22-time.o ip22-nvram.o ip22-platform.o ip22-reset.o ip22-setup.o 7 ip22-time.o ip22-nvram.o ip22-platform.o ip22-reset.o ip22-setup.o
8 8
9obj-$(CONFIG_EISA) += ip22-eisa.o 9obj-$(CONFIG_EISA) += ip22-eisa.o
10
11EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
index 63afd7e44428..a435b31cf031 100644
--- a/arch/mips/sgi-ip22/ip22-reset.c
+++ b/arch/mips/sgi-ip22/ip22-reset.c
@@ -232,11 +232,18 @@ static struct notifier_block panic_block = {
232 232
233static int __init reboot_setup(void) 233static int __init reboot_setup(void)
234{ 234{
235 int res;
236
235 _machine_restart = sgi_machine_restart; 237 _machine_restart = sgi_machine_restart;
236 _machine_halt = sgi_machine_halt; 238 _machine_halt = sgi_machine_halt;
237 pm_power_off = sgi_machine_power_off; 239 pm_power_off = sgi_machine_power_off;
238 240
239 request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); 241 res = request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL);
242 if (res) {
243 printk(KERN_ERR "Allocation of front panel IRQ failed\n");
244 return res;
245 }
246
240 init_timer(&blink_timer); 247 init_timer(&blink_timer);
241 blink_timer.function = blink_timeout; 248 blink_timer.function = blink_timeout;
242 atomic_notifier_chain_register(&panic_notifier_list, &panic_block); 249 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index 7f4b793c3df3..7e8094f617bf 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -20,6 +20,7 @@
20#include <linux/random.h> 20#include <linux/random.h>
21#include <linux/sched.h> 21#include <linux/sched.h>
22 22
23#include <asm/irq_cpu.h>
23#include <asm/mipsregs.h> 24#include <asm/mipsregs.h>
24#include <asm/signal.h> 25#include <asm/signal.h>
25#include <asm/system.h> 26#include <asm/system.h>
@@ -46,7 +47,8 @@ static void inline flush_mace_bus(void)
46#define DBG(x...) 47#define DBG(x...)
47#endif 48#endif
48 49
49/* O2 irq map 50/*
51 * O2 irq map
50 * 52 *
51 * IP0 -> software (ignored) 53 * IP0 -> software (ignored)
52 * IP1 -> software (ignored) 54 * IP1 -> software (ignored)
@@ -55,60 +57,60 @@ static void inline flush_mace_bus(void)
55 * IP4 -> (irq2) X unknown 57 * IP4 -> (irq2) X unknown
56 * IP5 -> (irq3) X unknown 58 * IP5 -> (irq3) X unknown
57 * IP6 -> (irq4) X unknown 59 * IP6 -> (irq4) X unknown
58 * IP7 -> (irq5) 0 CPU count/compare timer (system timer) 60 * IP7 -> (irq5) 7 CPU count/compare timer (system timer)
59 * 61 *
60 * crime: (C) 62 * crime: (C)
61 * 63 *
62 * CRIME_INT_STAT 31:0: 64 * CRIME_INT_STAT 31:0:
63 * 65 *
64 * 0 -> 1 Video in 1 66 * 0 -> 8 Video in 1
65 * 1 -> 2 Video in 2 67 * 1 -> 9 Video in 2
66 * 2 -> 3 Video out 68 * 2 -> 10 Video out
67 * 3 -> 4 Mace ethernet 69 * 3 -> 11 Mace ethernet
68 * 4 -> S SuperIO sub-interrupt 70 * 4 -> S SuperIO sub-interrupt
69 * 5 -> M Miscellaneous sub-interrupt 71 * 5 -> M Miscellaneous sub-interrupt
70 * 6 -> A Audio sub-interrupt 72 * 6 -> A Audio sub-interrupt
71 * 7 -> 8 PCI bridge errors 73 * 7 -> 15 PCI bridge errors
72 * 8 -> 9 PCI SCSI aic7xxx 0 74 * 8 -> 16 PCI SCSI aic7xxx 0
73 * 9 -> 10 PCI SCSI aic7xxx 1 75 * 9 -> 17 PCI SCSI aic7xxx 1
74 * 10 -> 11 PCI slot 0 76 * 10 -> 18 PCI slot 0
75 * 11 -> 12 unused (PCI slot 1) 77 * 11 -> 19 unused (PCI slot 1)
76 * 12 -> 13 unused (PCI slot 2) 78 * 12 -> 20 unused (PCI slot 2)
77 * 13 -> 14 unused (PCI shared 0) 79 * 13 -> 21 unused (PCI shared 0)
78 * 14 -> 15 unused (PCI shared 1) 80 * 14 -> 22 unused (PCI shared 1)
79 * 15 -> 16 unused (PCI shared 2) 81 * 15 -> 23 unused (PCI shared 2)
80 * 16 -> 17 GBE0 (E) 82 * 16 -> 24 GBE0 (E)
81 * 17 -> 18 GBE1 (E) 83 * 17 -> 25 GBE1 (E)
82 * 18 -> 19 GBE2 (E) 84 * 18 -> 26 GBE2 (E)
83 * 19 -> 20 GBE3 (E) 85 * 19 -> 27 GBE3 (E)
84 * 20 -> 21 CPU errors 86 * 20 -> 28 CPU errors
85 * 21 -> 22 Memory errors 87 * 21 -> 29 Memory errors
86 * 22 -> 23 RE empty edge (E) 88 * 22 -> 30 RE empty edge (E)
87 * 23 -> 24 RE full edge (E) 89 * 23 -> 31 RE full edge (E)
88 * 24 -> 25 RE idle edge (E) 90 * 24 -> 32 RE idle edge (E)
89 * 25 -> 26 RE empty level 91 * 25 -> 33 RE empty level
90 * 26 -> 27 RE full level 92 * 26 -> 34 RE full level
91 * 27 -> 28 RE idle level 93 * 27 -> 35 RE idle level
92 * 28 -> 29 unused (software 0) (E) 94 * 28 -> 36 unused (software 0) (E)
93 * 29 -> 30 unused (software 1) (E) 95 * 29 -> 37 unused (software 1) (E)
94 * 30 -> 31 unused (software 2) - crime 1.5 CPU SysCorError (E) 96 * 30 -> 38 unused (software 2) - crime 1.5 CPU SysCorError (E)
95 * 31 -> 32 VICE 97 * 31 -> 39 VICE
96 * 98 *
97 * S, M, A: Use the MACE ISA interrupt register 99 * S, M, A: Use the MACE ISA interrupt register
98 * MACE_ISA_INT_STAT 31:0 100 * MACE_ISA_INT_STAT 31:0
99 * 101 *
100 * 0-7 -> 33-40 Audio 102 * 0-7 -> 40-47 Audio
101 * 8 -> 41 RTC 103 * 8 -> 48 RTC
102 * 9 -> 42 Keyboard 104 * 9 -> 49 Keyboard
103 * 10 -> X Keyboard polled 105 * 10 -> X Keyboard polled
104 * 11 -> 44 Mouse 106 * 11 -> 51 Mouse
105 * 12 -> X Mouse polled 107 * 12 -> X Mouse polled
106 * 13-15 -> 46-48 Count/compare timers 108 * 13-15 -> 53-55 Count/compare timers
107 * 16-19 -> 49-52 Parallel (16 E) 109 * 16-19 -> 56-59 Parallel (16 E)
108 * 20-25 -> 53-58 Serial 1 (22 E) 110 * 20-25 -> 60-62 Serial 1 (22 E)
109 * 26-31 -> 59-64 Serial 2 (28 E) 111 * 26-31 -> 66-71 Serial 2 (28 E)
110 * 112 *
111 * Note that this means IRQs 5-7, 43, and 45 do not exist. This is a 113 * Note that this means IRQs 12-14, 50, and 52 do not exist. This is a
112 * different IRQ map than IRIX uses, but that's OK as Linux irq handling 114 * different IRQ map than IRIX uses, but that's OK as Linux irq handling
113 * is quite different anyway. 115 * is quite different anyway.
114 */ 116 */
@@ -131,36 +133,6 @@ struct irqaction cpuerr_irq = {
131}; 133};
132 134
133/* 135/*
134 * For interrupts wired from a single device to the CPU. Only the clock
135 * uses this it seems, which is IRQ 0 and IP7.
136 */
137
138static void enable_cpu_irq(unsigned int irq)
139{
140 set_c0_status(STATUSF_IP7);
141}
142
143static void disable_cpu_irq(unsigned int irq)
144{
145 clear_c0_status(STATUSF_IP7);
146}
147
148static void end_cpu_irq(unsigned int irq)
149{
150 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
151 enable_cpu_irq(irq);
152}
153
154static struct irq_chip ip32_cpu_interrupt = {
155 .name = "IP32 CPU",
156 .ack = disable_cpu_irq,
157 .mask = disable_cpu_irq,
158 .mask_ack = disable_cpu_irq,
159 .unmask = enable_cpu_irq,
160 .end = end_cpu_irq,
161};
162
163/*
164 * This is for pure CRIME interrupts - ie not MACE. The advantage? 136 * This is for pure CRIME interrupts - ie not MACE. The advantage?
165 * We get to split the register in half and do faster lookups. 137 * We get to split the register in half and do faster lookups.
166 */ 138 */
@@ -422,15 +394,23 @@ static void ip32_irq0(void)
422 uint64_t crime_int; 394 uint64_t crime_int;
423 int irq = 0; 395 int irq = 0;
424 396
397 /*
398 * Sanity check interrupt numbering enum.
399 * MACE got 32 interrupts and there are 32 MACE ISA interrupts daisy
400 * chained.
401 */
402 BUILD_BUG_ON(CRIME_VICE_IRQ - MACE_VID_IN1_IRQ != 31);
403 BUILD_BUG_ON(MACEISA_SERIAL2_RDMAOR_IRQ - MACEISA_AUDIO_SW_IRQ != 31);
404
425 crime_int = crime->istat & crime_mask; 405 crime_int = crime->istat & crime_mask;
426 irq = __ffs(crime_int); 406 irq = MACE_VID_IN1_IRQ + __ffs(crime_int);
427 crime_int = 1 << irq; 407 crime_int = 1 << irq;
428 408
429 if (crime_int & CRIME_MACEISA_INT_MASK) { 409 if (crime_int & CRIME_MACEISA_INT_MASK) {
430 unsigned long mace_int = mace->perif.ctrl.istat; 410 unsigned long mace_int = mace->perif.ctrl.istat;
431 irq = __ffs(mace_int & maceisa_mask) + 32; 411 irq = __ffs(mace_int & maceisa_mask) + MACEISA_AUDIO_SW_IRQ;
432 } 412 }
433 irq++; 413
434 DBG("*irq %u*\n", irq); 414 DBG("*irq %u*\n", irq);
435 do_IRQ(irq); 415 do_IRQ(irq);
436} 416}
@@ -457,7 +437,7 @@ static void ip32_irq4(void)
457 437
458static void ip32_irq5(void) 438static void ip32_irq5(void)
459{ 439{
460 do_IRQ(IP32_R4K_TIMER_IRQ); 440 do_IRQ(MIPS_CPU_IRQ_BASE + 7);
461} 441}
462 442
463asmlinkage void plat_irq_dispatch(void) 443asmlinkage void plat_irq_dispatch(void)
@@ -490,21 +470,25 @@ void __init arch_init_irq(void)
490 mace->perif.ctrl.istat = 0; 470 mace->perif.ctrl.istat = 0;
491 mace->perif.ctrl.imask = 0; 471 mace->perif.ctrl.imask = 0;
492 472
493 for (irq = 0; irq <= IP32_IRQ_MAX; irq++) { 473 mips_cpu_irq_init();
494 struct irq_chip *controller; 474 for (irq = MIPS_CPU_IRQ_BASE + 8; irq <= IP32_IRQ_MAX; irq++) {
495 475 struct irq_chip *chip;
496 if (irq == IP32_R4K_TIMER_IRQ) 476
497 controller = &ip32_cpu_interrupt; 477 switch (irq) {
498 else if (irq <= MACE_PCI_BRIDGE_IRQ && irq >= MACE_VID_IN1_IRQ) 478 case MACE_VID_IN1_IRQ ... MACE_PCI_BRIDGE_IRQ:
499 controller = &ip32_mace_interrupt; 479 chip = &ip32_mace_interrupt;
500 else if (irq <= MACEPCI_SHARED2_IRQ && irq >= MACEPCI_SCSI0_IRQ) 480 break;
501 controller = &ip32_macepci_interrupt; 481 case MACEPCI_SCSI0_IRQ ... MACEPCI_SHARED2_IRQ:
502 else if (irq <= CRIME_VICE_IRQ && irq >= CRIME_GBE0_IRQ) 482 chip = &ip32_macepci_interrupt;
503 controller = &ip32_crime_interrupt; 483 break;
504 else 484 case CRIME_GBE0_IRQ ... CRIME_VICE_IRQ:
505 controller = &ip32_maceisa_interrupt; 485 chip = &ip32_crime_interrupt;
506 486 break;
507 set_irq_chip(irq, controller); 487 default:
488 chip = &ip32_maceisa_interrupt;
489 }
490
491 set_irq_chip(irq, chip);
508 } 492 }
509 setup_irq(CRIME_MEMERR_IRQ, &memerr_irq); 493 setup_irq(CRIME_MEMERR_IRQ, &memerr_irq);
510 setup_irq(CRIME_CPUERR_IRQ, &cpuerr_irq); 494 setup_irq(CRIME_CPUERR_IRQ, &cpuerr_irq);
diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
index 4125a5ba119e..fc75bfcb0c0e 100644
--- a/arch/mips/sgi-ip32/ip32-setup.c
+++ b/arch/mips/sgi-ip32/ip32-setup.c
@@ -83,7 +83,7 @@ void __init plat_time_init(void)
83void __init plat_timer_setup(struct irqaction *irq) 83void __init plat_timer_setup(struct irqaction *irq)
84{ 84{
85 irq->handler = no_action; 85 irq->handler = no_action;
86 setup_irq(IP32_R4K_TIMER_IRQ, irq); 86 setup_irq(MIPS_CPU_IRQ_BASE + 7, irq);
87} 87}
88 88
89void __init plat_mem_setup(void) 89void __init plat_mem_setup(void)
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
index acaf613358c7..b97102a1c635 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -963,7 +963,7 @@ static int __init toshiba_rbtx4927_rtc_init(void)
963 .flags = IORESOURCE_MEM, 963 .flags = IORESOURCE_MEM,
964 }; 964 };
965 struct platform_device *dev = 965 struct platform_device *dev =
966 platform_device_register_simple("ds1742", -1, &res, 1); 966 platform_device_register_simple("rtc-ds1742", -1, &res, 1);
967 return IS_ERR(dev) ? PTR_ERR(dev) : 0; 967 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
968} 968}
969device_initcall(toshiba_rbtx4927_rtc_init); 969device_initcall(toshiba_rbtx4927_rtc_init);