aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/Kconfig33
-rw-r--r--arch/mips/au1000/Kconfig1
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/cevt-r4k.c14
-rw-r--r--arch/mips/kernel/csrc-r4k.c29
-rw-r--r--arch/mips/kernel/setup.c31
-rw-r--r--arch/mips/kernel/smp-up.c67
-rw-r--r--arch/mips/kernel/time.c112
-rw-r--r--arch/mips/kernel/vpe.c4
-rw-r--r--arch/mips/math-emu/ieee754.c2
-rw-r--r--arch/mips/math-emu/ieee754dp.c2
-rw-r--r--arch/mips/math-emu/ieee754sp.c2
-rw-r--r--arch/mips/mipssim/sim_time.c6
-rw-r--r--arch/mips/mm/dma-default.c37
-rw-r--r--arch/mips/mm/init.c43
-rw-r--r--arch/mips/pmc-sierra/Kconfig2
-rw-r--r--arch/mips/sgi-ip22/ip22-eisa.c134
-rw-r--r--arch/mips/sgi-ip22/ip22-nvram.c40
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c24
-rw-r--r--arch/mips/vr41xx/Kconfig6
20 files changed, 301 insertions, 290 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2f2ce0c28bc0..455bd1f560aa 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -22,6 +22,7 @@ config MACH_ALCHEMY
22config BASLER_EXCITE 22config BASLER_EXCITE
23 bool "Basler eXcite smart camera" 23 bool "Basler eXcite smart camera"
24 select CEVT_R4K 24 select CEVT_R4K
25 select CSRC_R4K
25 select DMA_COHERENT 26 select DMA_COHERENT
26 select HW_HAS_PCI 27 select HW_HAS_PCI
27 select IRQ_CPU 28 select IRQ_CPU
@@ -49,6 +50,7 @@ config BASLER_EXCITE_PROTOTYPE
49config BCM47XX 50config BCM47XX
50 bool "BCM47XX based boards" 51 bool "BCM47XX based boards"
51 select CEVT_R4K 52 select CEVT_R4K
53 select CSRC_R4K
52 select DMA_NONCOHERENT 54 select DMA_NONCOHERENT
53 select HW_HAS_PCI 55 select HW_HAS_PCI
54 select IRQ_CPU 56 select IRQ_CPU
@@ -66,6 +68,7 @@ config BCM47XX
66config MIPS_COBALT 68config MIPS_COBALT
67 bool "Cobalt Server" 69 bool "Cobalt Server"
68 select CEVT_R4K 70 select CEVT_R4K
71 select CSRC_R4K
69 select CEVT_GT641XX 72 select CEVT_GT641XX
70 select DMA_NONCOHERENT 73 select DMA_NONCOHERENT
71 select HW_HAS_PCI 74 select HW_HAS_PCI
@@ -85,6 +88,7 @@ config MACH_DECSTATION
85 bool "DECstations" 88 bool "DECstations"
86 select BOOT_ELF32 89 select BOOT_ELF32
87 select CEVT_R4K 90 select CEVT_R4K
91 select CSRC_R4K
88 select DMA_NONCOHERENT 92 select DMA_NONCOHERENT
89 select NO_IOPORT 93 select NO_IOPORT
90 select IRQ_CPU 94 select IRQ_CPU
@@ -117,6 +121,7 @@ config MACH_JAZZ
117 select ARC32 121 select ARC32
118 select ARCH_MAY_HAVE_PC_FDC 122 select ARCH_MAY_HAVE_PC_FDC
119 select CEVT_R4K 123 select CEVT_R4K
124 select CSRC_R4K
120 select GENERIC_ISA_DMA 125 select GENERIC_ISA_DMA
121 select IRQ_CPU 126 select IRQ_CPU
122 select I8253 127 select I8253
@@ -137,6 +142,7 @@ config MACH_JAZZ
137config LASAT 142config LASAT
138 bool "LASAT Networks platforms" 143 bool "LASAT Networks platforms"
139 select CEVT_R4K 144 select CEVT_R4K
145 select CSRC_R4K
140 select DMA_NONCOHERENT 146 select DMA_NONCOHERENT
141 select SYS_HAS_EARLY_PRINTK 147 select SYS_HAS_EARLY_PRINTK
142 select HW_HAS_PCI 148 select HW_HAS_PCI
@@ -154,6 +160,7 @@ config LEMOTE_FULONG
154 bool "Lemote Fulong mini-PC" 160 bool "Lemote Fulong mini-PC"
155 select ARCH_SPARSEMEM_ENABLE 161 select ARCH_SPARSEMEM_ENABLE
156 select CEVT_R4K 162 select CEVT_R4K
163 select CSRC_R4K
157 select SYS_HAS_CPU_LOONGSON2 164 select SYS_HAS_CPU_LOONGSON2
158 select DMA_NONCOHERENT 165 select DMA_NONCOHERENT
159 select BOOT_ELF32 166 select BOOT_ELF32
@@ -179,6 +186,7 @@ config MIPS_ATLAS
179 bool "MIPS Atlas board" 186 bool "MIPS Atlas board"
180 select BOOT_ELF32 187 select BOOT_ELF32
181 select CEVT_R4K 188 select CEVT_R4K
189 select CSRC_R4K
182 select DMA_NONCOHERENT 190 select DMA_NONCOHERENT
183 select SYS_HAS_EARLY_PRINTK 191 select SYS_HAS_EARLY_PRINTK
184 select IRQ_CPU 192 select IRQ_CPU
@@ -210,6 +218,7 @@ config MIPS_MALTA
210 select ARCH_MAY_HAVE_PC_FDC 218 select ARCH_MAY_HAVE_PC_FDC
211 select BOOT_ELF32 219 select BOOT_ELF32
212 select CEVT_R4K 220 select CEVT_R4K
221 select CSRC_R4K
213 select DMA_NONCOHERENT 222 select DMA_NONCOHERENT
214 select GENERIC_ISA_DMA 223 select GENERIC_ISA_DMA
215 select IRQ_CPU 224 select IRQ_CPU
@@ -241,6 +250,7 @@ config MIPS_MALTA
241config MIPS_SEAD 250config MIPS_SEAD
242 bool "MIPS SEAD board" 251 bool "MIPS SEAD board"
243 select CEVT_R4K 252 select CEVT_R4K
253 select CSRC_R4K
244 select IRQ_CPU 254 select IRQ_CPU
245 select DMA_NONCOHERENT 255 select DMA_NONCOHERENT
246 select SYS_HAS_EARLY_PRINTK 256 select SYS_HAS_EARLY_PRINTK
@@ -260,6 +270,7 @@ config MIPS_SEAD
260config MIPS_SIM 270config MIPS_SIM
261 bool 'MIPS simulator (MIPSsim)' 271 bool 'MIPS simulator (MIPSsim)'
262 select CEVT_R4K 272 select CEVT_R4K
273 select CSRC_R4K
263 select DMA_NONCOHERENT 274 select DMA_NONCOHERENT
264 select SYS_HAS_EARLY_PRINTK 275 select SYS_HAS_EARLY_PRINTK
265 select IRQ_CPU 276 select IRQ_CPU
@@ -278,6 +289,7 @@ config MIPS_SIM
278config MARKEINS 289config MARKEINS
279 bool "NEC EMMA2RH Mark-eins" 290 bool "NEC EMMA2RH Mark-eins"
280 select CEVT_R4K 291 select CEVT_R4K
292 select CSRC_R4K
281 select DMA_NONCOHERENT 293 select DMA_NONCOHERENT
282 select HW_HAS_PCI 294 select HW_HAS_PCI
283 select IRQ_CPU 295 select IRQ_CPU
@@ -293,6 +305,7 @@ config MARKEINS
293config MACH_VR41XX 305config MACH_VR41XX
294 bool "NEC VR4100 series based machines" 306 bool "NEC VR4100 series based machines"
295 select CEVT_R4K 307 select CEVT_R4K
308 select CSRC_R4K
296 select SYS_HAS_CPU_VR41XX 309 select SYS_HAS_CPU_VR41XX
297 select GENERIC_HARDIRQS_NO__DO_IRQ 310 select GENERIC_HARDIRQS_NO__DO_IRQ
298 311
@@ -330,6 +343,7 @@ config PMC_MSP
330config PMC_YOSEMITE 343config PMC_YOSEMITE
331 bool "PMC-Sierra Yosemite eval board" 344 bool "PMC-Sierra Yosemite eval board"
332 select CEVT_R4K 345 select CEVT_R4K
346 select CSRC_R4K
333 select DMA_COHERENT 347 select DMA_COHERENT
334 select HW_HAS_PCI 348 select HW_HAS_PCI
335 select IRQ_CPU 349 select IRQ_CPU
@@ -351,6 +365,7 @@ config PMC_YOSEMITE
351config QEMU 365config QEMU
352 bool "Qemu" 366 bool "Qemu"
353 select CEVT_R4K 367 select CEVT_R4K
368 select CSRC_R4K
354 select DMA_COHERENT 369 select DMA_COHERENT
355 select GENERIC_ISA_DMA 370 select GENERIC_ISA_DMA
356 select HAVE_STD_PC_SERIAL_PORT 371 select HAVE_STD_PC_SERIAL_PORT
@@ -382,9 +397,11 @@ config SGI_IP22
382 select ARC32 397 select ARC32
383 select BOOT_ELF32 398 select BOOT_ELF32
384 select CEVT_R4K 399 select CEVT_R4K
400 select CSRC_R4K
385 select DMA_NONCOHERENT 401 select DMA_NONCOHERENT
386 select HW_HAS_EISA 402 select HW_HAS_EISA
387 select I8253 403 select I8253
404 select I8259
388 select IP22_CPU_SCACHE 405 select IP22_CPU_SCACHE
389 select IRQ_CPU 406 select IRQ_CPU
390 select GENERIC_ISA_DMA_SUPPORT_BROKEN 407 select GENERIC_ISA_DMA_SUPPORT_BROKEN
@@ -427,6 +444,7 @@ config SGI_IP32
427 select ARC32 444 select ARC32
428 select BOOT_ELF32 445 select BOOT_ELF32
429 select CEVT_R4K 446 select CEVT_R4K
447 select CSRC_R4K
430 select DMA_NONCOHERENT 448 select DMA_NONCOHERENT
431 select HW_HAS_PCI 449 select HW_HAS_PCI
432 select IRQ_CPU 450 select IRQ_CPU
@@ -498,6 +516,7 @@ config SIBYTE_SWARM
498 select SYS_SUPPORTS_HIGHMEM 516 select SYS_SUPPORTS_HIGHMEM
499 select SYS_SUPPORTS_KGDB 517 select SYS_SUPPORTS_KGDB
500 select SYS_SUPPORTS_LITTLE_ENDIAN 518 select SYS_SUPPORTS_LITTLE_ENDIAN
519 select ZONE_DMA32 if 64BIT
501 520
502config SIBYTE_LITTLESUR 521config SIBYTE_LITTLESUR
503 bool "Sibyte BCM91250C2-LittleSur" 522 bool "Sibyte BCM91250C2-LittleSur"
@@ -548,6 +567,7 @@ config SIBYTE_BIGSUR
548 select SYS_SUPPORTS_BIG_ENDIAN 567 select SYS_SUPPORTS_BIG_ENDIAN
549 select SYS_SUPPORTS_HIGHMEM 568 select SYS_SUPPORTS_HIGHMEM
550 select SYS_SUPPORTS_LITTLE_ENDIAN 569 select SYS_SUPPORTS_LITTLE_ENDIAN
570 select ZONE_DMA32 if 64BIT
551 571
552config SNI_RM 572config SNI_RM
553 bool "SNI RM200/300/400" 573 bool "SNI RM200/300/400"
@@ -556,6 +576,7 @@ config SNI_RM
556 select ARCH_MAY_HAVE_PC_FDC 576 select ARCH_MAY_HAVE_PC_FDC
557 select BOOT_ELF32 577 select BOOT_ELF32
558 select CEVT_R4K 578 select CEVT_R4K
579 select CSRC_R4K
559 select DMA_NONCOHERENT 580 select DMA_NONCOHERENT
560 select GENERIC_ISA_DMA 581 select GENERIC_ISA_DMA
561 select HW_HAS_EISA 582 select HW_HAS_EISA
@@ -599,6 +620,7 @@ config TOSHIBA_JMR3927
599config TOSHIBA_RBTX4927 620config TOSHIBA_RBTX4927
600 bool "Toshiba RBTX49[23]7 board" 621 bool "Toshiba RBTX49[23]7 board"
601 select CEVT_R4K 622 select CEVT_R4K
623 select CSRC_R4K
602 select CEVT_TXX9 624 select CEVT_TXX9
603 select DMA_NONCOHERENT 625 select DMA_NONCOHERENT
604 select HAS_TXX9_SERIAL 626 select HAS_TXX9_SERIAL
@@ -621,6 +643,7 @@ config TOSHIBA_RBTX4927
621config TOSHIBA_RBTX4938 643config TOSHIBA_RBTX4938
622 bool "Toshiba RBTX4938 board" 644 bool "Toshiba RBTX4938 board"
623 select CEVT_R4K 645 select CEVT_R4K
646 select CSRC_R4K
624 select CEVT_TXX9 647 select CEVT_TXX9
625 select DMA_NONCOHERENT 648 select DMA_NONCOHERENT
626 select HAS_TXX9_SERIAL 649 select HAS_TXX9_SERIAL
@@ -642,6 +665,7 @@ config TOSHIBA_RBTX4938
642config WR_PPMC 665config WR_PPMC
643 bool "Wind River PPMC board" 666 bool "Wind River PPMC board"
644 select CEVT_R4K 667 select CEVT_R4K
668 select CSRC_R4K
645 select IRQ_CPU 669 select IRQ_CPU
646 select BOOT_ELF32 670 select BOOT_ELF32
647 select DMA_NONCOHERENT 671 select DMA_NONCOHERENT
@@ -752,6 +776,9 @@ config CEVT_TXX9
752config CSRC_BCM1480 776config CSRC_BCM1480
753 bool 777 bool
754 778
779config CSRC_R4K
780 bool
781
755config CSRC_SB1250 782config CSRC_SB1250
756 bool 783 bool
757 784
@@ -1640,6 +1667,9 @@ config ARCH_DISCONTIGMEM_ENABLE
1640 or have huge holes in the physical address space for other reasons. 1667 or have huge holes in the physical address space for other reasons.
1641 See <file:Documentation/vm/numa> for more. 1668 See <file:Documentation/vm/numa> for more.
1642 1669
1670config ARCH_POPULATES_NODE_MAP
1671 def_bool y
1672
1643config ARCH_SPARSEMEM_ENABLE 1673config ARCH_SPARSEMEM_ENABLE
1644 bool 1674 bool
1645 select SPARSEMEM_STATIC 1675 select SPARSEMEM_STATIC
@@ -1945,6 +1975,9 @@ config I8253
1945config PCSPEAKER 1975config PCSPEAKER
1946 bool 1976 bool
1947 1977
1978config ZONE_DMA32
1979 bool
1980
1948source "drivers/pcmcia/Kconfig" 1981source "drivers/pcmcia/Kconfig"
1949 1982
1950source "drivers/pci/hotplug/Kconfig" 1983source "drivers/pci/hotplug/Kconfig"
diff --git a/arch/mips/au1000/Kconfig b/arch/mips/au1000/Kconfig
index b36cec58a9a8..05d1354aad3a 100644
--- a/arch/mips/au1000/Kconfig
+++ b/arch/mips/au1000/Kconfig
@@ -138,6 +138,7 @@ config SOC_AU1X00
138 bool 138 bool
139 select 64BIT_PHYS_ADDR 139 select 64BIT_PHYS_ADDR
140 select CEVT_R4K 140 select CEVT_R4K
141 select CSRC_R4K
141 select IRQ_CPU 142 select IRQ_CPU
142 select SYS_HAS_CPU_MIPS32_R1 143 select SYS_HAS_CPU_MIPS32_R1
143 select SYS_SUPPORTS_32BIT_KERNEL 144 select SYS_SUPPORTS_32BIT_KERNEL
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index b551535b7e48..ffa08362de17 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o
14obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o 14obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o
15obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o 15obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o
16obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o 16obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o
17obj-$(CONFIG_CSRC_R4K) += csrc-r4k.o
17obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o 18obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o
18 19
19binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \ 20binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \
@@ -43,6 +44,7 @@ obj-$(CONFIG_CPU_TX49XX) += r4k_fpu.o r4k_switch.o
43obj-$(CONFIG_CPU_VR41XX) += r4k_fpu.o r4k_switch.o 44obj-$(CONFIG_CPU_VR41XX) += r4k_fpu.o r4k_switch.o
44 45
45obj-$(CONFIG_SMP) += smp.o 46obj-$(CONFIG_SMP) += smp.o
47obj-$(CONFIG_SMP_UP) += smp-up.o
46 48
47obj-$(CONFIG_MIPS_MT) += mips-mt.o 49obj-$(CONFIG_MIPS_MT) += mips-mt.o
48obj-$(CONFIG_MIPS_MT_FPAFF) += mips-mt-fpaff.o 50obj-$(CONFIG_MIPS_MT_FPAFF) += mips-mt-fpaff.o
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index bab935a3d74b..24a2d907aa0d 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -219,7 +219,7 @@ static int c0_compare_int_usable(void)
219 return 1; 219 return 1;
220} 220}
221 221
222void __cpuinit mips_clockevent_init(void) 222int __cpuinit mips_clockevent_init(void)
223{ 223{
224 uint64_t mips_freq = mips_hpt_frequency; 224 uint64_t mips_freq = mips_hpt_frequency;
225 unsigned int cpu = smp_processor_id(); 225 unsigned int cpu = smp_processor_id();
@@ -227,7 +227,7 @@ void __cpuinit mips_clockevent_init(void)
227 unsigned int irq; 227 unsigned int irq;
228 228
229 if (!cpu_has_counter || !mips_hpt_frequency) 229 if (!cpu_has_counter || !mips_hpt_frequency)
230 return; 230 return -ENXIO;
231 231
232#ifdef CONFIG_MIPS_MT_SMTC 232#ifdef CONFIG_MIPS_MT_SMTC
233 setup_smtc_dummy_clockevent_device(); 233 setup_smtc_dummy_clockevent_device();
@@ -237,11 +237,11 @@ void __cpuinit mips_clockevent_init(void)
237 * device. 237 * device.
238 */ 238 */
239 if (cpu) 239 if (cpu)
240 return; 240 return 0;
241#endif 241#endif
242 242
243 if (!c0_compare_int_usable()) 243 if (!c0_compare_int_usable())
244 return; 244 return -ENXIO;
245 245
246 /* 246 /*
247 * With vectored interrupts things are getting platform specific. 247 * With vectored interrupts things are getting platform specific.
@@ -276,8 +276,8 @@ void __cpuinit mips_clockevent_init(void)
276 276
277 clockevents_register_device(cd); 277 clockevents_register_device(cd);
278 278
279 if (!cp0_timer_irq_installed) 279 if (cp0_timer_irq_installed)
280 return; 280 return 0;
281 281
282 cp0_timer_irq_installed = 1; 282 cp0_timer_irq_installed = 1;
283 283
@@ -287,4 +287,6 @@ void __cpuinit mips_clockevent_init(void)
287#else 287#else
288 setup_irq(irq, &c0_compare_irqaction); 288 setup_irq(irq, &c0_compare_irqaction);
289#endif 289#endif
290
291 return 0;
290} 292}
diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c
new file mode 100644
index 000000000000..74c5c62365a8
--- /dev/null
+++ b/arch/mips/kernel/csrc-r4k.c
@@ -0,0 +1,29 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2007 by Ralf Baechle
7 */
8
9static cycle_t c0_hpt_read(void)
10{
11 return read_c0_count();
12}
13
14static struct clocksource clocksource_mips = {
15 .name = "MIPS",
16 .read = c0_hpt_read,
17 .mask = CLOCKSOURCE_MASK(32),
18 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
19};
20
21static void __init init_mips_clocksource(void)
22{
23 /* Calclate a somewhat reasonable rating value */
24 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
25
26 clocksource_set_clock(&clocksource_mips, mips_hpt_frequency);
27
28 clocksource_register(&clocksource_mips);
29}
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index a06a27d6cfcd..7f6ddcb5d485 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -269,7 +269,7 @@ static void __init bootmem_init(void)
269 269
270static void __init bootmem_init(void) 270static void __init bootmem_init(void)
271{ 271{
272 unsigned long reserved_end; 272 unsigned long init_begin, reserved_end;
273 unsigned long mapstart = ~0UL; 273 unsigned long mapstart = ~0UL;
274 unsigned long bootmap_size; 274 unsigned long bootmap_size;
275 int i; 275 int i;
@@ -342,6 +342,35 @@ static void __init bootmem_init(void)
342 */ 342 */
343 bootmap_size = init_bootmem_node(NODE_DATA(0), mapstart, 343 bootmap_size = init_bootmem_node(NODE_DATA(0), mapstart,
344 min_low_pfn, max_low_pfn); 344 min_low_pfn, max_low_pfn);
345
346
347 init_begin = PFN_UP(__pa_symbol(&__init_begin));
348 for (i = 0; i < boot_mem_map.nr_map; i++) {
349 unsigned long start, end;
350
351 start = PFN_UP(boot_mem_map.map[i].addr);
352 end = PFN_DOWN(boot_mem_map.map[i].addr
353 + boot_mem_map.map[i].size);
354
355 if (start <= init_begin)
356 start = init_begin;
357 if (start >= end)
358 continue;
359
360#ifndef CONFIG_HIGHMEM
361 if (end > max_low_pfn)
362 end = max_low_pfn;
363
364 /*
365 * ... finally, is the area going away?
366 */
367 if (end <= start)
368 continue;
369#endif
370
371 add_active_range(0, start, end);
372 }
373
345 /* 374 /*
346 * Register fully available low RAM pages with the bootmem allocator. 375 * Register fully available low RAM pages with the bootmem allocator.
347 */ 376 */
diff --git a/arch/mips/kernel/smp-up.c b/arch/mips/kernel/smp-up.c
new file mode 100644
index 000000000000..ead6c30eeb14
--- /dev/null
+++ b/arch/mips/kernel/smp-up.c
@@ -0,0 +1,67 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2006, 07 by Ralf Baechle (ralf@linux-mips.org)
7 *
8 * Symmetric Uniprocessor (TM) Support
9 */
10#include <linux/kernel.h>
11#include <linux/sched.h>
12
13/*
14 * Send inter-processor interrupt
15 */
16void up_send_ipi_single(int cpu, unsigned int action)
17{
18 panic(KERN_ERR "%s called", __func__);
19}
20
21static inline void up_send_ipi_mask(cpumask_t mask, unsigned int action)
22{
23 panic(KERN_ERR "%s called", __func__);
24}
25
26/*
27 * After we've done initial boot, this function is called to allow the
28 * board code to clean up state, if needed
29 */
30void __cpuinit up_init_secondary(void)
31{
32}
33
34void __cpuinit up_smp_finish(void)
35{
36}
37
38/* Hook for after all CPUs are online */
39void up_cpus_done(void)
40{
41}
42
43/*
44 * Firmware CPU startup hook
45 */
46void __cpuinit up_boot_secondary(int cpu, struct task_struct *idle)
47{
48}
49
50void __init up_smp_setup(void)
51{
52}
53
54void __init up_prepare_cpus(unsigned int max_cpus)
55{
56}
57
58struct plat_smp_ops up_smp_ops = {
59 .send_ipi_single = up_send_ipi_single,
60 .send_ipi_mask = up_send_ipi_mask,
61 .init_secondary = up_init_secondary,
62 .smp_finish = up_smp_finish,
63 .cpus_done = up_cpus_done,
64 .boot_secondary = up_boot_secondary,
65 .smp_setup = up_smp_setup,
66 .prepare_cpus = up_prepare_cpus,
67};
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 3284b9b4ecac..52075426c373 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -50,14 +50,6 @@ int update_persistent_clock(struct timespec now)
50 return rtc_mips_set_mmss(now.tv_sec); 50 return rtc_mips_set_mmss(now.tv_sec);
51} 51}
52 52
53/*
54 * High precision timer functions for a R4k-compatible timer.
55 */
56static cycle_t c0_hpt_read(void)
57{
58 return read_c0_count();
59}
60
61int (*mips_timer_state)(void); 53int (*mips_timer_state)(void);
62 54
63int null_perf_irq(void) 55int null_perf_irq(void)
@@ -84,55 +76,6 @@ EXPORT_SYMBOL(perf_irq);
84 76
85unsigned int mips_hpt_frequency; 77unsigned int mips_hpt_frequency;
86 78
87static struct clocksource clocksource_mips = {
88 .name = "MIPS",
89 .read = c0_hpt_read,
90 .mask = CLOCKSOURCE_MASK(32),
91 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
92};
93
94static unsigned int __init calibrate_hpt(void)
95{
96 cycle_t frequency, hpt_start, hpt_end, hpt_count, hz;
97
98 const int loops = HZ / 10;
99 int log_2_loops = 0;
100 int i;
101
102 /*
103 * We want to calibrate for 0.1s, but to avoid a 64-bit
104 * division we round the number of loops up to the nearest
105 * power of 2.
106 */
107 while (loops > 1 << log_2_loops)
108 log_2_loops++;
109 i = 1 << log_2_loops;
110
111 /*
112 * Wait for a rising edge of the timer interrupt.
113 */
114 while (mips_timer_state());
115 while (!mips_timer_state());
116
117 /*
118 * Now see how many high precision timer ticks happen
119 * during the calculated number of periods between timer
120 * interrupts.
121 */
122 hpt_start = clocksource_mips.read();
123 do {
124 while (mips_timer_state());
125 while (!mips_timer_state());
126 } while (--i);
127 hpt_end = clocksource_mips.read();
128
129 hpt_count = (hpt_end - hpt_start) & clocksource_mips.mask;
130 hz = HZ;
131 frequency = hpt_count * hz;
132
133 return frequency >> log_2_loops;
134}
135
136void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock) 79void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock)
137{ 80{
138 u64 temp; 81 u64 temp;
@@ -166,16 +109,6 @@ void __cpuinit clockevent_set_clock(struct clock_event_device *cd,
166 cd->mult = (u32) temp; 109 cd->mult = (u32) temp;
167} 110}
168 111
169static void __init init_mips_clocksource(void)
170{
171 /* Calclate a somewhat reasonable rating value */
172 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
173
174 clocksource_set_clock(&clocksource_mips, mips_hpt_frequency);
175
176 clocksource_register(&clocksource_mips);
177}
178
179void __init __weak plat_time_init(void) 112void __init __weak plat_time_init(void)
180{ 113{
181} 114}
@@ -194,21 +127,42 @@ void __init plat_timer_setup(void)
194 BUG(); 127 BUG();
195} 128}
196 129
130static __init int cpu_has_mfc0_count_bug(void)
131{
132 switch (current_cpu_type()) {
133 case CPU_R4000PC:
134 case CPU_R4000SC:
135 case CPU_R4000MC:
136 /*
137 * V3.0 is documented as suffering from the mfc0 from count bug.
138 * Afaik this is the last version of the R4000. Later versions
139 * were marketed as R4400.
140 */
141 return 1;
142
143 case CPU_R4400PC:
144 case CPU_R4400SC:
145 case CPU_R4400MC:
146 /*
147 * The published errata for the R4400 upto 3.0 say the CPU
148 * has the mfc0 from count bug.
149 */
150 if ((current_cpu_data.processor_id & 0xff) <= 0x30)
151 return 1;
152
153 /*
154 * I don't have erratas for newer R4400 so be paranoid.
155 */
156 return 1;
157 }
158
159 return 0;
160}
161
197void __init time_init(void) 162void __init time_init(void)
198{ 163{
199 plat_time_init(); 164 plat_time_init();
200 165
201 if (cpu_has_counter && (mips_hpt_frequency || mips_timer_state)) { 166 if (mips_clockevent_init() || !cpu_has_mfc0_count_bug())
202 /* We know counter frequency. Or we can get it. */
203 if (!mips_hpt_frequency)
204 mips_hpt_frequency = calibrate_hpt();
205
206 /* Report the high precision timer rate for a reference. */
207 printk("Using %u.%03u MHz high precision timer.\n",
208 ((mips_hpt_frequency + 500) / 1000) / 1000,
209 ((mips_hpt_frequency + 500) / 1000) % 1000);
210 init_mips_clocksource(); 167 init_mips_clocksource();
211 }
212
213 mips_clockevent_init();
214} 168}
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 38bd33fa2a23..c06eb812a95e 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -470,7 +470,7 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location,
470 */ 470 */
471 if (v != l->value) { 471 if (v != l->value) {
472 printk(KERN_DEBUG "VPE loader: " 472 printk(KERN_DEBUG "VPE loader: "
473 "apply_r_mips_lo16/hi16: " 473 "apply_r_mips_lo16/hi16: \t"
474 "inconsistent value information\n"); 474 "inconsistent value information\n");
475 return -ENOEXEC; 475 return -ENOEXEC;
476 } 476 }
@@ -629,7 +629,7 @@ static void simplify_symbols(Elf_Shdr * sechdrs,
629 break; 629 break;
630 630
631 case SHN_MIPS_SCOMMON: 631 case SHN_MIPS_SCOMMON:
632 printk(KERN_DEBUG "simplify_symbols: ignoring SHN_MIPS_SCOMMON" 632 printk(KERN_DEBUG "simplify_symbols: ignoring SHN_MIPS_SCOMMON "
633 "symbol <%s> st_shndx %d\n", strtab + sym[i].st_name, 633 "symbol <%s> st_shndx %d\n", strtab + sym[i].st_name,
634 sym[i].st_shndx); 634 sym[i].st_shndx);
635 // .sbss section 635 // .sbss section
diff --git a/arch/mips/math-emu/ieee754.c b/arch/mips/math-emu/ieee754.c
index 946aee331788..cb1b6822711a 100644
--- a/arch/mips/math-emu/ieee754.c
+++ b/arch/mips/math-emu/ieee754.c
@@ -108,6 +108,7 @@ int ieee754si_xcpt(int r, const char *op, ...)
108 ax.rv.si = r; 108 ax.rv.si = r;
109 va_start(ax.ap, op); 109 va_start(ax.ap, op);
110 ieee754_xcpt(&ax); 110 ieee754_xcpt(&ax);
111 va_end(ax.ap);
111 return ax.rv.si; 112 return ax.rv.si;
112} 113}
113 114
@@ -122,5 +123,6 @@ s64 ieee754di_xcpt(s64 r, const char *op, ...)
122 ax.rv.di = r; 123 ax.rv.di = r;
123 va_start(ax.ap, op); 124 va_start(ax.ap, op);
124 ieee754_xcpt(&ax); 125 ieee754_xcpt(&ax);
126 va_end(ax.ap);
125 return ax.rv.di; 127 return ax.rv.di;
126} 128}
diff --git a/arch/mips/math-emu/ieee754dp.c b/arch/mips/math-emu/ieee754dp.c
index 3e214aac4b12..6d2d89f32472 100644
--- a/arch/mips/math-emu/ieee754dp.c
+++ b/arch/mips/math-emu/ieee754dp.c
@@ -57,6 +57,7 @@ ieee754dp ieee754dp_xcpt(ieee754dp r, const char *op, ...)
57 ax.rv.dp = r; 57 ax.rv.dp = r;
58 va_start(ax.ap, op); 58 va_start(ax.ap, op);
59 ieee754_xcpt(&ax); 59 ieee754_xcpt(&ax);
60 va_end(ax.ap);
60 return ax.rv.dp; 61 return ax.rv.dp;
61} 62}
62 63
@@ -83,6 +84,7 @@ ieee754dp ieee754dp_nanxcpt(ieee754dp r, const char *op, ...)
83 ax.rv.dp = r; 84 ax.rv.dp = r;
84 va_start(ax.ap, op); 85 va_start(ax.ap, op);
85 ieee754_xcpt(&ax); 86 ieee754_xcpt(&ax);
87 va_end(ax.ap);
86 return ax.rv.dp; 88 return ax.rv.dp;
87} 89}
88 90
diff --git a/arch/mips/math-emu/ieee754sp.c b/arch/mips/math-emu/ieee754sp.c
index adda851cd04f..463534045ab6 100644
--- a/arch/mips/math-emu/ieee754sp.c
+++ b/arch/mips/math-emu/ieee754sp.c
@@ -58,6 +58,7 @@ ieee754sp ieee754sp_xcpt(ieee754sp r, const char *op, ...)
58 ax.rv.sp = r; 58 ax.rv.sp = r;
59 va_start(ax.ap, op); 59 va_start(ax.ap, op);
60 ieee754_xcpt(&ax); 60 ieee754_xcpt(&ax);
61 va_end(ax.ap);
61 return ax.rv.sp; 62 return ax.rv.sp;
62} 63}
63 64
@@ -84,6 +85,7 @@ ieee754sp ieee754sp_nanxcpt(ieee754sp r, const char *op, ...)
84 ax.rv.sp = r; 85 ax.rv.sp = r;
85 va_start(ax.ap, op); 86 va_start(ax.ap, op);
86 ieee754_xcpt(&ax); 87 ieee754_xcpt(&ax);
88 va_end(ax.ap);
87 return ax.rv.sp; 89 return ax.rv.sp;
88} 90}
89 91
diff --git a/arch/mips/mipssim/sim_time.c b/arch/mips/mipssim/sim_time.c
index bfaafa38846f..e39bbe989da3 100644
--- a/arch/mips/mipssim/sim_time.c
+++ b/arch/mips/mipssim/sim_time.c
@@ -101,9 +101,7 @@ unsigned __init get_c0_compare_int(void)
101 101
102void __init plat_time_init(void) 102void __init plat_time_init(void)
103{ 103{
104 unsigned int est_freq, flags; 104 unsigned int est_freq;
105
106 local_irq_save(flags);
107 105
108 /* Set Data mode - binary. */ 106 /* Set Data mode - binary. */
109 CMOS_WRITE(CMOS_READ(RTC_CONTROL) | RTC_DM_BINARY, RTC_CONTROL); 107 CMOS_WRITE(CMOS_READ(RTC_CONTROL) | RTC_DM_BINARY, RTC_CONTROL);
@@ -114,6 +112,4 @@ void __init plat_time_init(void)
114 (est_freq % 1000000) * 100 / 1000000); 112 (est_freq % 1000000) * 100 / 1000000);
115 113
116 cpu_khz = est_freq / 1000; 114 cpu_khz = est_freq / 1000;
117
118 local_irq_restore(flags);
119} 115}
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 33519ce49540..ae76795685cc 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -40,16 +40,38 @@ static inline int cpu_is_noncoherent_r10000(struct device *dev)
40 current_cpu_type() == CPU_R12000); 40 current_cpu_type() == CPU_R12000);
41} 41}
42 42
43static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp)
44{
45 /* ignore region specifiers */
46 gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
47
48#ifdef CONFIG_ZONE_DMA32
49 if (dev == NULL)
50 gfp |= __GFP_DMA;
51 else if (dev->coherent_dma_mask < DMA_BIT_MASK(24))
52 gfp |= __GFP_DMA;
53 else
54#endif
55#ifdef CONFIG_ZONE_DMA32
56 if (dev->coherent_dma_mask < DMA_BIT_MASK(32))
57 gfp |= __GFP_DMA32;
58 else
59#endif
60 ;
61
62 /* Don't invoke OOM killer */
63 gfp |= __GFP_NORETRY;
64
65 return gfp;
66}
67
43void *dma_alloc_noncoherent(struct device *dev, size_t size, 68void *dma_alloc_noncoherent(struct device *dev, size_t size,
44 dma_addr_t * dma_handle, gfp_t gfp) 69 dma_addr_t * dma_handle, gfp_t gfp)
45{ 70{
46 void *ret; 71 void *ret;
47 72
48 /* ignore region specifiers */ 73 gfp = massage_gfp_flags(dev, gfp);
49 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
50 74
51 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
52 gfp |= GFP_DMA;
53 ret = (void *) __get_free_pages(gfp, get_order(size)); 75 ret = (void *) __get_free_pages(gfp, get_order(size));
54 76
55 if (ret != NULL) { 77 if (ret != NULL) {
@@ -67,11 +89,8 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
67{ 89{
68 void *ret; 90 void *ret;
69 91
70 /* ignore region specifiers */ 92 gfp = massage_gfp_flags(dev, gfp);
71 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
72 93
73 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
74 gfp |= GFP_DMA;
75 ret = (void *) __get_free_pages(gfp, get_order(size)); 94 ret = (void *) __get_free_pages(gfp, get_order(size));
76 95
77 if (ret) { 96 if (ret) {
@@ -343,7 +362,7 @@ int dma_supported(struct device *dev, u64 mask)
343 * so we can't guarantee allocations that must be 362 * so we can't guarantee allocations that must be
344 * within a tighter range than GFP_DMA.. 363 * within a tighter range than GFP_DMA..
345 */ 364 */
346 if (mask < 0x00ffffff) 365 if (mask < DMA_BIT_MASK(24))
347 return 0; 366 return 0;
348 367
349 return 1; 368 return 1;
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index ec3b9e9f30f4..480dec04f552 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -347,11 +347,8 @@ static int __init page_is_ram(unsigned long pagenr)
347 347
348void __init paging_init(void) 348void __init paging_init(void)
349{ 349{
350 unsigned long zones_size[MAX_NR_ZONES] = { 0, }; 350 unsigned long max_zone_pfns[MAX_NR_ZONES];
351#ifndef CONFIG_FLATMEM 351 unsigned long lastpfn;
352 unsigned long zholes_size[MAX_NR_ZONES] = { 0, };
353 unsigned long i, j, pfn;
354#endif
355 352
356 pagetable_init(); 353 pagetable_init();
357 354
@@ -361,35 +358,27 @@ void __init paging_init(void)
361 kmap_coherent_init(); 358 kmap_coherent_init();
362 359
363#ifdef CONFIG_ZONE_DMA 360#ifdef CONFIG_ZONE_DMA
364 if (min_low_pfn < MAX_DMA_PFN && MAX_DMA_PFN <= max_low_pfn) { 361 max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
365 zones_size[ZONE_DMA] = MAX_DMA_PFN - min_low_pfn;
366 zones_size[ZONE_NORMAL] = max_low_pfn - MAX_DMA_PFN;
367 } else if (max_low_pfn < MAX_DMA_PFN)
368 zones_size[ZONE_DMA] = max_low_pfn - min_low_pfn;
369 else
370#endif 362#endif
371 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn; 363#ifdef CONFIG_ZONE_DMA32
372 364 max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
365#endif
366 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
367 lastpfn = max_low_pfn;
373#ifdef CONFIG_HIGHMEM 368#ifdef CONFIG_HIGHMEM
374 zones_size[ZONE_HIGHMEM] = highend_pfn - highstart_pfn; 369 max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
370 lastpfn = highend_pfn;
375 371
376 if (cpu_has_dc_aliases && zones_size[ZONE_HIGHMEM]) { 372 if (cpu_has_dc_aliases && max_low_pfn != highend_pfn) {
377 printk(KERN_WARNING "This processor doesn't support highmem." 373 printk(KERN_WARNING "This processor doesn't support highmem."
378 " %ldk highmem ignored\n", zones_size[ZONE_HIGHMEM]); 374 " %ldk highmem ignored\n",
379 zones_size[ZONE_HIGHMEM] = 0; 375 (highend_pfn - max_low_pfn) << (PAGE_SHIFT - 10));
376 max_zone_pfns[ZONE_HIGHMEM] = max_low_pfn;
377 lastpfn = max_low_pfn;
380 } 378 }
381#endif 379#endif
382 380
383#ifdef CONFIG_FLATMEM 381 free_area_init_nodes(max_zone_pfns);
384 free_area_init(zones_size);
385#else
386 pfn = min_low_pfn;
387 for (i = 0; i < MAX_NR_ZONES; i++)
388 for (j = 0; j < zones_size[i]; j++, pfn++)
389 if (!page_is_ram(pfn))
390 zholes_size[i]++;
391 free_area_init_node(0, NODE_DATA(0), zones_size, 0, zholes_size);
392#endif
393} 382}
394 383
395static struct kcore_list kcore_mem, kcore_vmalloc; 384static struct kcore_list kcore_mem, kcore_vmalloc;
diff --git a/arch/mips/pmc-sierra/Kconfig b/arch/mips/pmc-sierra/Kconfig
index 6b293ce0935f..90261b83db04 100644
--- a/arch/mips/pmc-sierra/Kconfig
+++ b/arch/mips/pmc-sierra/Kconfig
@@ -5,12 +5,14 @@ choice
5config PMC_MSP4200_EVAL 5config PMC_MSP4200_EVAL
6 bool "PMC-Sierra MSP4200 Eval Board" 6 bool "PMC-Sierra MSP4200 Eval Board"
7 select CEVT_R4K 7 select CEVT_R4K
8 select CSRC_R4K
8 select IRQ_MSP_SLP 9 select IRQ_MSP_SLP
9 select HW_HAS_PCI 10 select HW_HAS_PCI
10 11
11config PMC_MSP4200_GW 12config PMC_MSP4200_GW
12 bool "PMC-Sierra MSP4200 VoIP Gateway" 13 bool "PMC-Sierra MSP4200 VoIP Gateway"
13 select CEVT_R4K 14 select CEVT_R4K
15 select CSRC_R4K
14 select IRQ_MSP_SLP 16 select IRQ_MSP_SLP
15 select HW_HAS_PCI 17 select HW_HAS_PCI
16 18
diff --git a/arch/mips/sgi-ip22/ip22-eisa.c b/arch/mips/sgi-ip22/ip22-eisa.c
index 26854fb11e7c..1617241d2737 100644
--- a/arch/mips/sgi-ip22/ip22-eisa.c
+++ b/arch/mips/sgi-ip22/ip22-eisa.c
@@ -36,6 +36,7 @@
36#include <asm/sgi/ioc.h> 36#include <asm/sgi/ioc.h>
37#include <asm/sgi/mc.h> 37#include <asm/sgi/mc.h>
38#include <asm/sgi/ip22.h> 38#include <asm/sgi/ip22.h>
39#include <asm/i8259.h>
39 40
40/* I2 has four EISA slots. */ 41/* I2 has four EISA slots. */
41#define IP22_EISA_MAX_SLOTS 4 42#define IP22_EISA_MAX_SLOTS 4
@@ -93,126 +94,11 @@ static irqreturn_t ip22_eisa_intr(int irq, void *dev_id)
93 return IRQ_NONE; 94 return IRQ_NONE;
94} 95}
95 96
96static void enable_eisa1_irq(unsigned int irq)
97{
98 u8 mask;
99
100 mask = inb(EISA_INT1_MASK);
101 mask &= ~((u8) (1 << irq));
102 outb(mask, EISA_INT1_MASK);
103}
104
105static unsigned int startup_eisa1_irq(unsigned int irq)
106{
107 u8 edge;
108
109 /* Only use edge interrupts for EISA */
110
111 edge = inb(EISA_INT1_EDGE_LEVEL);
112 edge &= ~((u8) (1 << irq));
113 outb(edge, EISA_INT1_EDGE_LEVEL);
114
115 enable_eisa1_irq(irq);
116 return 0;
117}
118
119static void disable_eisa1_irq(unsigned int irq)
120{
121 u8 mask;
122
123 mask = inb(EISA_INT1_MASK);
124 mask |= ((u8) (1 << irq));
125 outb(mask, EISA_INT1_MASK);
126}
127
128static void mask_and_ack_eisa1_irq(unsigned int irq)
129{
130 disable_eisa1_irq(irq);
131
132 outb(0x20, EISA_INT1_CTRL);
133}
134
135static void end_eisa1_irq(unsigned int irq)
136{
137 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
138 enable_eisa1_irq(irq);
139}
140
141static struct irq_chip ip22_eisa1_irq_type = {
142 .name = "IP22 EISA",
143 .startup = startup_eisa1_irq,
144 .ack = mask_and_ack_eisa1_irq,
145 .mask = disable_eisa1_irq,
146 .mask_ack = mask_and_ack_eisa1_irq,
147 .unmask = enable_eisa1_irq,
148 .end = end_eisa1_irq,
149};
150
151static void enable_eisa2_irq(unsigned int irq)
152{
153 u8 mask;
154
155 mask = inb(EISA_INT2_MASK);
156 mask &= ~((u8) (1 << (irq - 8)));
157 outb(mask, EISA_INT2_MASK);
158}
159
160static unsigned int startup_eisa2_irq(unsigned int irq)
161{
162 u8 edge;
163
164 /* Only use edge interrupts for EISA */
165
166 edge = inb(EISA_INT2_EDGE_LEVEL);
167 edge &= ~((u8) (1 << (irq - 8)));
168 outb(edge, EISA_INT2_EDGE_LEVEL);
169
170 enable_eisa2_irq(irq);
171 return 0;
172}
173
174static void disable_eisa2_irq(unsigned int irq)
175{
176 u8 mask;
177
178 mask = inb(EISA_INT2_MASK);
179 mask |= ((u8) (1 << (irq - 8)));
180 outb(mask, EISA_INT2_MASK);
181}
182
183static void mask_and_ack_eisa2_irq(unsigned int irq)
184{
185 disable_eisa2_irq(irq);
186
187 outb(0x20, EISA_INT2_CTRL);
188}
189
190static void end_eisa2_irq(unsigned int irq)
191{
192 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
193 enable_eisa2_irq(irq);
194}
195
196static struct irq_chip ip22_eisa2_irq_type = {
197 .name = "IP22 EISA",
198 .startup = startup_eisa2_irq,
199 .ack = mask_and_ack_eisa2_irq,
200 .mask = disable_eisa2_irq,
201 .mask_ack = mask_and_ack_eisa2_irq,
202 .unmask = enable_eisa2_irq,
203 .end = end_eisa2_irq,
204};
205
206static struct irqaction eisa_action = { 97static struct irqaction eisa_action = {
207 .handler = ip22_eisa_intr, 98 .handler = ip22_eisa_intr,
208 .name = "EISA", 99 .name = "EISA",
209}; 100};
210 101
211static struct irqaction cascade_action = {
212 .handler = no_action,
213 .name = "EISA cascade",
214};
215
216int __init ip22_eisa_init(void) 102int __init ip22_eisa_init(void)
217{ 103{
218 int i, c; 104 int i, c;
@@ -248,29 +134,13 @@ int __init ip22_eisa_init(void)
248 outb(1, EISA_EXT_NMI_RESET_CTRL); 134 outb(1, EISA_EXT_NMI_RESET_CTRL);
249 udelay(50); /* Wait long enough for the dust to settle */ 135 udelay(50); /* Wait long enough for the dust to settle */
250 outb(0, EISA_EXT_NMI_RESET_CTRL); 136 outb(0, EISA_EXT_NMI_RESET_CTRL);
251 outb(0x11, EISA_INT1_CTRL);
252 outb(0x11, EISA_INT2_CTRL);
253 outb(0, EISA_INT1_MASK);
254 outb(8, EISA_INT2_MASK);
255 outb(4, EISA_INT1_MASK);
256 outb(2, EISA_INT2_MASK);
257 outb(1, EISA_INT1_MASK);
258 outb(1, EISA_INT2_MASK);
259 outb(0xfb, EISA_INT1_MASK);
260 outb(0xff, EISA_INT2_MASK);
261 outb(0, EISA_DMA2_WRITE_SINGLE); 137 outb(0, EISA_DMA2_WRITE_SINGLE);
262 138
263 for (i = SGINT_EISA; i < (SGINT_EISA + EISA_MAX_IRQ); i++) { 139 init_i8259_irqs();
264 if (i < (SGINT_EISA + 8))
265 set_irq_chip(i, &ip22_eisa1_irq_type);
266 else
267 set_irq_chip(i, &ip22_eisa2_irq_type);
268 }
269 140
270 /* Cannot use request_irq because of kmalloc not being ready at such 141 /* Cannot use request_irq because of kmalloc not being ready at such
271 * an early stage. Yes, I've been bitten... */ 142 * an early stage. Yes, I've been bitten... */
272 setup_irq(SGI_EISA_IRQ, &eisa_action); 143 setup_irq(SGI_EISA_IRQ, &eisa_action);
273 setup_irq(SGINT_EISA + 2, &cascade_action);
274 144
275 EISA_bus = 1; 145 EISA_bus = 1;
276 return 0; 146 return 0;
diff --git a/arch/mips/sgi-ip22/ip22-nvram.c b/arch/mips/sgi-ip22/ip22-nvram.c
index e19d60d5fcc1..0177566475d4 100644
--- a/arch/mips/sgi-ip22/ip22-nvram.c
+++ b/arch/mips/sgi-ip22/ip22-nvram.c
@@ -32,19 +32,19 @@
32 for (x=0; x<100000; x++) __asm__ __volatile__(""); }) 32 for (x=0; x<100000; x++) __asm__ __volatile__(""); })
33 33
34#define eeprom_cs_on(ptr) ({ \ 34#define eeprom_cs_on(ptr) ({ \
35 *ptr &= ~EEPROM_DATO; \ 35 __raw_writel(__raw_readl(ptr) & ~EEPROM_DATO, ptr); \
36 *ptr &= ~EEPROM_ECLK; \ 36 __raw_writel(__raw_readl(ptr) & ~EEPROM_ECLK, ptr); \
37 *ptr &= ~EEPROM_EPROT; \ 37 __raw_writel(__raw_readl(ptr) & ~EEPROM_EPROT, ptr); \
38 delay(); \ 38 delay(); \
39 *ptr |= EEPROM_CSEL; \ 39 __raw_writel(__raw_readl(ptr) | EEPROM_CSEL, ptr); \
40 *ptr |= EEPROM_ECLK; }) 40 __raw_writel(__raw_readl(ptr) | EEPROM_ECLK, ptr); })
41 41
42 42
43#define eeprom_cs_off(ptr) ({ \ 43#define eeprom_cs_off(ptr) ({ \
44 *ptr &= ~EEPROM_ECLK; \ 44 __raw_writel(__raw_readl(ptr) & ~EEPROM_ECLK, ptr); \
45 *ptr &= ~EEPROM_CSEL; \ 45 __raw_writel(__raw_readl(ptr) & ~EEPROM_CSEL, ptr); \
46 *ptr |= EEPROM_EPROT; \ 46 __raw_writel(__raw_readl(ptr) | EEPROM_EPROT, ptr); \
47 *ptr |= EEPROM_ECLK; }) 47 __raw_writel(__raw_readl(ptr) | EEPROM_ECLK, ptr); })
48 48
49#define BITS_IN_COMMAND 11 49#define BITS_IN_COMMAND 11
50/* 50/*
@@ -60,15 +60,17 @@ static inline void eeprom_cmd(unsigned int *ctrl, unsigned cmd, unsigned reg)
60 ser_cmd = cmd | (reg << (16 - BITS_IN_COMMAND)); 60 ser_cmd = cmd | (reg << (16 - BITS_IN_COMMAND));
61 for (i = 0; i < BITS_IN_COMMAND; i++) { 61 for (i = 0; i < BITS_IN_COMMAND; i++) {
62 if (ser_cmd & (1<<15)) /* if high order bit set */ 62 if (ser_cmd & (1<<15)) /* if high order bit set */
63 writel(readl(ctrl) | EEPROM_DATO, ctrl); 63 __raw_writel(__raw_readl(ctrl) | EEPROM_DATO, ctrl);
64 else 64 else
65 writel(readl(ctrl) & ~EEPROM_DATO, ctrl); 65 __raw_writel(__raw_readl(ctrl) & ~EEPROM_DATO, ctrl);
66 writel(readl(ctrl) & ~EEPROM_ECLK, ctrl); 66 __raw_writel(__raw_readl(ctrl) & ~EEPROM_ECLK, ctrl);
67 writel(readl(ctrl) | EEPROM_ECLK, ctrl); 67 delay();
68 __raw_writel(__raw_readl(ctrl) | EEPROM_ECLK, ctrl);
69 delay();
68 ser_cmd <<= 1; 70 ser_cmd <<= 1;
69 } 71 }
70 /* see data sheet timing diagram */ 72 /* see data sheet timing diagram */
71 writel(readl(ctrl) & ~EEPROM_DATO, ctrl); 73 __raw_writel(__raw_readl(ctrl) & ~EEPROM_DATO, ctrl);
72} 74}
73 75
74unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg) 76unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg)
@@ -76,18 +78,18 @@ unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg)
76 unsigned short res = 0; 78 unsigned short res = 0;
77 int i; 79 int i;
78 80
79 writel(readl(ctrl) & ~EEPROM_EPROT, ctrl); 81 __raw_writel(__raw_readl(ctrl) & ~EEPROM_EPROT, ctrl);
80 eeprom_cs_on(ctrl); 82 eeprom_cs_on(ctrl);
81 eeprom_cmd(ctrl, EEPROM_READ, reg); 83 eeprom_cmd(ctrl, EEPROM_READ, reg);
82 84
83 /* clock the data ouf of serial mem */ 85 /* clock the data ouf of serial mem */
84 for (i = 0; i < 16; i++) { 86 for (i = 0; i < 16; i++) {
85 writel(readl(ctrl) & ~EEPROM_ECLK, ctrl); 87 __raw_writel(__raw_readl(ctrl) & ~EEPROM_ECLK, ctrl);
86 delay(); 88 delay();
87 writel(readl(ctrl) | EEPROM_ECLK, ctrl); 89 __raw_writel(__raw_readl(ctrl) | EEPROM_ECLK, ctrl);
88 delay(); 90 delay();
89 res <<= 1; 91 res <<= 1;
90 if (readl(ctrl) & EEPROM_DATI) 92 if (__raw_readl(ctrl) & EEPROM_DATI)
91 res |= 1; 93 res |= 1;
92 } 94 }
93 95
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index aab17ddd2f30..cab7cc22ab67 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -209,18 +209,18 @@ static unsigned long macepci_mask;
209 209
210static void enable_macepci_irq(unsigned int irq) 210static void enable_macepci_irq(unsigned int irq)
211{ 211{
212 macepci_mask |= MACEPCI_CONTROL_INT(irq - 9); 212 macepci_mask |= MACEPCI_CONTROL_INT(irq - MACEPCI_SCSI0_IRQ);
213 mace->pci.control = macepci_mask; 213 mace->pci.control = macepci_mask;
214 crime_mask |= 1 << (irq - 1); 214 crime_mask |= 1 << (irq - CRIME_IRQ_BASE);
215 crime->imask = crime_mask; 215 crime->imask = crime_mask;
216} 216}
217 217
218static void disable_macepci_irq(unsigned int irq) 218static void disable_macepci_irq(unsigned int irq)
219{ 219{
220 crime_mask &= ~(1 << (irq - 1)); 220 crime_mask &= ~(1 << (irq - CRIME_IRQ_BASE));
221 crime->imask = crime_mask; 221 crime->imask = crime_mask;
222 flush_crime_bus(); 222 flush_crime_bus();
223 macepci_mask &= ~MACEPCI_CONTROL_INT(irq - 9); 223 macepci_mask &= ~MACEPCI_CONTROL_INT(irq - MACEPCI_SCSI0_IRQ);
224 mace->pci.control = macepci_mask; 224 mace->pci.control = macepci_mask;
225 flush_mace_bus(); 225 flush_mace_bus();
226} 226}
@@ -299,7 +299,7 @@ static void enable_maceisa_irq(unsigned int irq)
299 pr_debug("crime_int %08x enabled\n", crime_int); 299 pr_debug("crime_int %08x enabled\n", crime_int);
300 crime_mask |= crime_int; 300 crime_mask |= crime_int;
301 crime->imask = crime_mask; 301 crime->imask = crime_mask;
302 maceisa_mask |= 1 << (irq - 33); 302 maceisa_mask |= 1 << (irq - MACEISA_AUDIO_SW_IRQ);
303 mace->perif.ctrl.imask = maceisa_mask; 303 mace->perif.ctrl.imask = maceisa_mask;
304} 304}
305 305
@@ -307,7 +307,7 @@ static void disable_maceisa_irq(unsigned int irq)
307{ 307{
308 unsigned int crime_int = 0; 308 unsigned int crime_int = 0;
309 309
310 maceisa_mask &= ~(1 << (irq - 33)); 310 maceisa_mask &= ~(1 << (irq - MACEISA_AUDIO_SW_IRQ));
311 if (!(maceisa_mask & MACEISA_AUDIO_INT)) 311 if (!(maceisa_mask & MACEISA_AUDIO_INT))
312 crime_int |= MACE_AUDIO_INT; 312 crime_int |= MACE_AUDIO_INT;
313 if (!(maceisa_mask & MACEISA_MISC_INT)) 313 if (!(maceisa_mask & MACEISA_MISC_INT))
@@ -331,7 +331,7 @@ static void mask_and_ack_maceisa_irq(unsigned int irq)
331 case MACEISA_SERIAL2_TDMAPR_IRQ: 331 case MACEISA_SERIAL2_TDMAPR_IRQ:
332 /* edge triggered */ 332 /* edge triggered */
333 mace_int = mace->perif.ctrl.istat; 333 mace_int = mace->perif.ctrl.istat;
334 mace_int &= ~(1 << (irq - 33)); 334 mace_int &= ~(1 << (irq - MACEISA_AUDIO_SW_IRQ));
335 mace->perif.ctrl.istat = mace_int; 335 mace->perif.ctrl.istat = mace_int;
336 break; 336 break;
337 } 337 }
@@ -359,13 +359,17 @@ static struct irq_chip ip32_maceisa_interrupt = {
359 359
360static void enable_mace_irq(unsigned int irq) 360static void enable_mace_irq(unsigned int irq)
361{ 361{
362 crime_mask |= 1 << (irq - 1); 362 unsigned int bit = irq - CRIME_IRQ_BASE;
363
364 crime_mask |= (1 << bit);
363 crime->imask = crime_mask; 365 crime->imask = crime_mask;
364} 366}
365 367
366static void disable_mace_irq(unsigned int irq) 368static void disable_mace_irq(unsigned int irq)
367{ 369{
368 crime_mask &= ~(1 << (irq - 1)); 370 unsigned int bit = irq - CRIME_IRQ_BASE;
371
372 crime_mask &= ~(1 << bit);
369 crime->imask = crime_mask; 373 crime->imask = crime_mask;
370 flush_crime_bus(); 374 flush_crime_bus();
371} 375}
@@ -489,7 +493,7 @@ void __init arch_init_irq(void)
489 mace->perif.ctrl.imask = 0; 493 mace->perif.ctrl.imask = 0;
490 494
491 mips_cpu_irq_init(); 495 mips_cpu_irq_init();
492 for (irq = MIPS_CPU_IRQ_BASE + 8; irq <= IP32_IRQ_MAX; irq++) { 496 for (irq = CRIME_IRQ_BASE; irq <= IP32_IRQ_MAX; irq++) {
493 switch (irq) { 497 switch (irq) {
494 case MACE_VID_IN1_IRQ ... MACE_PCI_BRIDGE_IRQ: 498 case MACE_VID_IN1_IRQ ... MACE_PCI_BRIDGE_IRQ:
495 set_irq_chip(irq, &ip32_mace_interrupt); 499 set_irq_chip(irq, &ip32_mace_interrupt);
diff --git a/arch/mips/vr41xx/Kconfig b/arch/mips/vr41xx/Kconfig
index eeb089f20c0d..559acc09c819 100644
--- a/arch/mips/vr41xx/Kconfig
+++ b/arch/mips/vr41xx/Kconfig
@@ -6,6 +6,7 @@ choice
6config CASIO_E55 6config CASIO_E55
7 bool "CASIO CASSIOPEIA E-10/15/55/65" 7 bool "CASIO CASSIOPEIA E-10/15/55/65"
8 select CEVT_R4K 8 select CEVT_R4K
9 select CSRC_R4K
9 select DMA_NONCOHERENT 10 select DMA_NONCOHERENT
10 select IRQ_CPU 11 select IRQ_CPU
11 select ISA 12 select ISA
@@ -15,6 +16,7 @@ config CASIO_E55
15config IBM_WORKPAD 16config IBM_WORKPAD
16 bool "IBM WorkPad z50" 17 bool "IBM WorkPad z50"
17 select CEVT_R4K 18 select CEVT_R4K
19 select CSRC_R4K
18 select DMA_NONCOHERENT 20 select DMA_NONCOHERENT
19 select IRQ_CPU 21 select IRQ_CPU
20 select ISA 22 select ISA
@@ -24,6 +26,7 @@ config IBM_WORKPAD
24config NEC_CMBVR4133 26config NEC_CMBVR4133
25 bool "NEC CMB-VR4133" 27 bool "NEC CMB-VR4133"
26 select CEVT_R4K 28 select CEVT_R4K
29 select CSRC_R4K
27 select DMA_NONCOHERENT 30 select DMA_NONCOHERENT
28 select IRQ_CPU 31 select IRQ_CPU
29 select HW_HAS_PCI 32 select HW_HAS_PCI
@@ -33,6 +36,7 @@ config NEC_CMBVR4133
33config TANBAC_TB022X 36config TANBAC_TB022X
34 bool "TANBAC VR4131 multichip module and TANBAC VR4131DIMM" 37 bool "TANBAC VR4131 multichip module and TANBAC VR4131DIMM"
35 select CEVT_R4K 38 select CEVT_R4K
39 select CSRC_R4K
36 select DMA_NONCOHERENT 40 select DMA_NONCOHERENT
37 select IRQ_CPU 41 select IRQ_CPU
38 select HW_HAS_PCI 42 select HW_HAS_PCI
@@ -48,6 +52,7 @@ config TANBAC_TB022X
48config VICTOR_MPC30X 52config VICTOR_MPC30X
49 bool "Victor MP-C303/304" 53 bool "Victor MP-C303/304"
50 select CEVT_R4K 54 select CEVT_R4K
55 select CSRC_R4K
51 select DMA_NONCOHERENT 56 select DMA_NONCOHERENT
52 select IRQ_CPU 57 select IRQ_CPU
53 select HW_HAS_PCI 58 select HW_HAS_PCI
@@ -58,6 +63,7 @@ config VICTOR_MPC30X
58config ZAO_CAPCELLA 63config ZAO_CAPCELLA
59 bool "ZAO Networks Capcella" 64 bool "ZAO Networks Capcella"
60 select CEVT_R4K 65 select CEVT_R4K
66 select CSRC_R4K
61 select DMA_NONCOHERENT 67 select DMA_NONCOHERENT
62 select IRQ_CPU 68 select IRQ_CPU
63 select HW_HAS_PCI 69 select HW_HAS_PCI