aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/Kconfig21
-rw-r--r--arch/mips/au1000/common/setup.c3
-rw-r--r--arch/mips/configs/jazz_defconfig2
-rw-r--r--arch/mips/configs/qemu_defconfig2
-rw-r--r--arch/mips/configs/rm200_defconfig2
-rw-r--r--arch/mips/configs/yosemite_defconfig2
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/entry.S2
-rw-r--r--arch/mips/kernel/genex.S2
-rw-r--r--arch/mips/kernel/pcspeaker.c (renamed from arch/mips/kernel/i8253.c)0
-rw-r--r--arch/mips/kernel/r4k_switch.S7
-rw-r--r--arch/mips/kernel/traps.c2
-rw-r--r--arch/mips/lib/dump_tlb.c1
-rw-r--r--arch/mips/lib/r3k_dump_tlb.c1
-rw-r--r--arch/mips/lib/uncached.c1
-rw-r--r--arch/mips/mipssim/sim_int.c2
-rw-r--r--arch/mips/mipssim/sim_setup.c2
-rw-r--r--arch/mips/mipssim/sim_time.c1
-rw-r--r--arch/mips/pci/pci.c2
-rw-r--r--arch/mips/sibyte/swarm/time.c244
-rw-r--r--arch/mips/sni/a20r.c8
-rw-r--r--arch/mips/sni/rm200.c4
-rw-r--r--arch/mips/vr41xx/common/Makefile2
-rw-r--r--arch/mips/vr41xx/common/giu.c122
-rw-r--r--arch/mips/vr41xx/common/rtc.c117
-rw-r--r--arch/mips/vr41xx/common/siu.c120
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/vr41xx_giu.c132
-rw-r--r--drivers/rtc/rtc-vr41xx.c186
-rw-r--r--drivers/serial/vr41xx_siu.c143
-rw-r--r--drivers/tc/zs.c22
-rw-r--r--include/asm-mips/io.h3
-rw-r--r--include/asm-mips/irq.h2
-rw-r--r--include/asm-mips/mipsregs.h20
-rw-r--r--include/asm-mips/rtc.h73
-rw-r--r--include/asm-mips/tlbdebug.h4
-rw-r--r--include/asm-mips/vr41xx/giu.h9
-rw-r--r--include/asm-mips/vr41xx/siu.h2
38 files changed, 571 insertions, 701 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index a00fabe2e4e0..5c863bcd5614 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -117,9 +117,9 @@ config MACH_JAZZ
117 select ARC32 117 select ARC32
118 select ARCH_MAY_HAVE_PC_FDC 118 select ARCH_MAY_HAVE_PC_FDC
119 select GENERIC_ISA_DMA 119 select GENERIC_ISA_DMA
120 select I8253
121 select I8259 120 select I8259
122 select ISA 121 select ISA
122 select PCSPEAKER
123 select SYS_HAS_CPU_R4X00 123 select SYS_HAS_CPU_R4X00
124 select SYS_SUPPORTS_32BIT_KERNEL 124 select SYS_SUPPORTS_32BIT_KERNEL
125 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL 125 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
@@ -347,9 +347,9 @@ config QEMU
347 select DMA_COHERENT 347 select DMA_COHERENT
348 select GENERIC_ISA_DMA 348 select GENERIC_ISA_DMA
349 select HAVE_STD_PC_SERIAL_PORT 349 select HAVE_STD_PC_SERIAL_PORT
350 select I8253
351 select I8259 350 select I8259
352 select ISA 351 select ISA
352 select PCSPEAKER
353 select SWAP_IO_SPACE 353 select SWAP_IO_SPACE
354 select SYS_HAS_CPU_MIPS32_R1 354 select SYS_HAS_CPU_MIPS32_R1
355 select SYS_SUPPORTS_32BIT_KERNEL 355 select SYS_SUPPORTS_32BIT_KERNEL
@@ -562,9 +562,9 @@ config SNI_RM
562 select HW_HAS_EISA 562 select HW_HAS_EISA
563 select HW_HAS_PCI 563 select HW_HAS_PCI
564 select IRQ_CPU 564 select IRQ_CPU
565 select I8253
566 select I8259 565 select I8259
567 select ISA 566 select ISA
567 select PCSPEAKER
568 select SWAP_IO_SPACE if CPU_BIG_ENDIAN 568 select SWAP_IO_SPACE if CPU_BIG_ENDIAN
569 select SYS_HAS_CPU_R4X00 569 select SYS_HAS_CPU_R4X00
570 select SYS_HAS_CPU_R5000 570 select SYS_HAS_CPU_R5000
@@ -1404,6 +1404,19 @@ config MIPS_MT_SMTC_INSTANT_REPLAY
1404 it off), but ensures that IPIs are handled promptly even under 1404 it off), but ensures that IPIs are handled promptly even under
1405 heavy I/O interrupt load. 1405 heavy I/O interrupt load.
1406 1406
1407config MIPS_MT_SMTC_IM_BACKSTOP
1408 bool "Use per-TC register bits as backstop for inhibited IM bits"
1409 depends on MIPS_MT_SMTC
1410 default y
1411 help
1412 To support multiple TC microthreads acting as "CPUs" within
1413 a VPE, VPE-wide interrupt mask bits must be specially manipulated
1414 during interrupt handling. To support legacy drivers and interrupt
1415 controller management code, SMTC has a "backstop" to track and
1416 if necessary restore the interrupt mask. This has some performance
1417 impact on interrupt service overhead. Disable it only if you know
1418 what you are doing.
1419
1407config MIPS_VPE_LOADER_TOM 1420config MIPS_VPE_LOADER_TOM
1408 bool "Load VPE program into memory hidden from linux" 1421 bool "Load VPE program into memory hidden from linux"
1409 depends on MIPS_VPE_LOADER 1422 depends on MIPS_VPE_LOADER
@@ -1851,7 +1864,7 @@ config MMU
1851 bool 1864 bool
1852 default y 1865 default y
1853 1866
1854config I8253 1867config PCSPEAKER
1855 bool 1868 bool
1856 1869
1857source "drivers/pcmcia/Kconfig" 1870source "drivers/pcmcia/Kconfig"
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index 13fe187f35d6..fdf2b85a69c8 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -100,9 +100,6 @@ void __init plat_mem_setup(void)
100 argptr = prom_getcmdline(); 100 argptr = prom_getcmdline();
101 /* default panel */ 101 /* default panel */
102 /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/ 102 /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/
103#ifdef CONFIG_MIPS_HYDROGEN3
104 strcat(argptr, " video=au1100fb:panel:Hydrogen_3_NEC_panel_320x240,nohwcursor");
105#endif
106 } 103 }
107#endif 104#endif
108 105
diff --git a/arch/mips/configs/jazz_defconfig b/arch/mips/configs/jazz_defconfig
index dd04eece9fd3..8a0b4ac5283d 100644
--- a/arch/mips/configs/jazz_defconfig
+++ b/arch/mips/configs/jazz_defconfig
@@ -241,7 +241,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
241# 241#
242CONFIG_ISA=y 242CONFIG_ISA=y
243CONFIG_MMU=y 243CONFIG_MMU=y
244CONFIG_I8253=y 244CONFIG_PCSPEAKER=y
245 245
246# 246#
247# PCCARD (PCMCIA/CardBus) support 247# PCCARD (PCMCIA/CardBus) support
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig
index 6cca105832ca..703de002e372 100644
--- a/arch/mips/configs/qemu_defconfig
+++ b/arch/mips/configs/qemu_defconfig
@@ -221,7 +221,7 @@ CONFIG_DEFAULT_IOSCHED="noop"
221# 221#
222CONFIG_ISA=y 222CONFIG_ISA=y
223CONFIG_MMU=y 223CONFIG_MMU=y
224CONFIG_I8253=y 224CONFIG_PCSPEAKER=y
225 225
226# 226#
227# PCCARD (PCMCIA/CardBus) support 227# PCCARD (PCMCIA/CardBus) support
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
index 1a67a85aabbb..a5dc5cb97aae 100644
--- a/arch/mips/configs/rm200_defconfig
+++ b/arch/mips/configs/rm200_defconfig
@@ -251,7 +251,7 @@ CONFIG_PCI=y
251CONFIG_ISA=y 251CONFIG_ISA=y
252# CONFIG_EISA is not set 252# CONFIG_EISA is not set
253CONFIG_MMU=y 253CONFIG_MMU=y
254CONFIG_I8253=y 254CONFIG_PCSPEAKER=y
255 255
256# 256#
257# PCCARD (PCMCIA/CardBus) support 257# PCCARD (PCMCIA/CardBus) support
diff --git a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
index f1cdb12f7925..f342d8c887b8 100644
--- a/arch/mips/configs/yosemite_defconfig
+++ b/arch/mips/configs/yosemite_defconfig
@@ -592,8 +592,6 @@ CONFIG_LEGACY_PTY_COUNT=256
592# CONFIG_WATCHDOG is not set 592# CONFIG_WATCHDOG is not set
593# CONFIG_HW_RANDOM is not set 593# CONFIG_HW_RANDOM is not set
594# CONFIG_RTC is not set 594# CONFIG_RTC is not set
595CONFIG_GEN_RTC=y
596CONFIG_GEN_RTC_X=y
597# CONFIG_DTLK is not set 595# CONFIG_DTLK is not set
598# CONFIG_R3964 is not set 596# CONFIG_R3964 is not set
599# CONFIG_APPLICOM is not set 597# CONFIG_APPLICOM is not set
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 961594cb5214..5c8085b6d7ab 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -63,7 +63,7 @@ obj-$(CONFIG_PROC_FS) += proc.o
63 63
64obj-$(CONFIG_64BIT) += cpu-bugs64.o 64obj-$(CONFIG_64BIT) += cpu-bugs64.o
65 65
66obj-$(CONFIG_I8253) += i8253.o 66obj-$(CONFIG_PCSPEAKER) += pcspeaker.o
67 67
68obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 68obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
69obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 69obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S
index 686249c5c328..e29598ae939d 100644
--- a/arch/mips/kernel/entry.S
+++ b/arch/mips/kernel/entry.S
@@ -84,6 +84,7 @@ FEXPORT(restore_all) # restore full frame
84 LONG_S sp, TI_REGS($28) 84 LONG_S sp, TI_REGS($28)
85 jal deferred_smtc_ipi 85 jal deferred_smtc_ipi
86 LONG_S s0, TI_REGS($28) 86 LONG_S s0, TI_REGS($28)
87#ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP
87/* Re-arm any temporarily masked interrupts not explicitly "acked" */ 88/* Re-arm any temporarily masked interrupts not explicitly "acked" */
88 mfc0 v0, CP0_TCSTATUS 89 mfc0 v0, CP0_TCSTATUS
89 ori v1, v0, TCSTATUS_IXMT 90 ori v1, v0, TCSTATUS_IXMT
@@ -110,6 +111,7 @@ FEXPORT(restore_all) # restore full frame
110 _ehb 111 _ehb
111 xor t0, t0, t3 112 xor t0, t0, t3
112 mtc0 t0, CP0_TCCONTEXT 113 mtc0 t0, CP0_TCCONTEXT
114#endif /* CONFIG_MIPS_MT_SMTC_IM_BACKSTOP */
113#endif /* CONFIG_MIPS_MT_SMTC */ 115#endif /* CONFIG_MIPS_MT_SMTC */
114 .set noat 116 .set noat
115 RESTORE_TEMP 117 RESTORE_TEMP
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 297bd56c2347..c0f19d638b98 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -243,9 +243,11 @@ NESTED(except_vec_vi_handler, 0, sp)
243 */ 243 */
244 mfc0 t1, CP0_STATUS 244 mfc0 t1, CP0_STATUS
245 and t0, a0, t1 245 and t0, a0, t1
246#ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP
246 mfc0 t2, CP0_TCCONTEXT 247 mfc0 t2, CP0_TCCONTEXT
247 or t0, t0, t2 248 or t0, t0, t2
248 mtc0 t0, CP0_TCCONTEXT 249 mtc0 t0, CP0_TCCONTEXT
250#endif /* CONFIG_MIPS_MT_SMTC_IM_BACKSTOP */
249 xor t1, t1, t0 251 xor t1, t1, t0
250 mtc0 t1, CP0_STATUS 252 mtc0 t1, CP0_STATUS
251 _ehb 253 _ehb
diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/pcspeaker.c
index 475df6904219..475df6904219 100644
--- a/arch/mips/kernel/i8253.c
+++ b/arch/mips/kernel/pcspeaker.c
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 06729596812f..d9bfae53c43f 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -85,12 +85,7 @@
85 move $28, a2 85 move $28, a2
86 cpu_restore_nonscratch a1 86 cpu_restore_nonscratch a1
87 87
88#if (_THREAD_SIZE - 32) < 0x10000 88 PTR_ADDU t0, $28, _THREAD_SIZE - 32
89 PTR_ADDIU t0, $28, _THREAD_SIZE - 32
90#else
91 PTR_LI t0, _THREAD_SIZE - 32
92 PTR_ADDU t0, $28
93#endif
94 set_saved_sp t0, t1, t2 89 set_saved_sp t0, t1, t2
95#ifdef CONFIG_MIPS_MT_SMTC 90#ifdef CONFIG_MIPS_MT_SMTC
96 /* Read-modify-writes of Status must be atomic on a VPE */ 91 /* Read-modify-writes of Status must be atomic on a VPE */
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 80ea4fa95bd9..5e9fa83c4ef0 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -373,7 +373,7 @@ asmlinkage void do_be(struct pt_regs *regs)
373 action = MIPS_BE_FIXUP; 373 action = MIPS_BE_FIXUP;
374 374
375 if (board_be_handler) 375 if (board_be_handler)
376 action = board_be_handler(regs, fixup != 0); 376 action = board_be_handler(regs, fixup != NULL);
377 377
378 switch (action) { 378 switch (action) {
379 case MIPS_BE_DISCARD: 379 case MIPS_BE_DISCARD:
diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c
index 1a4db7dc77cb..465ff0ec85b9 100644
--- a/arch/mips/lib/dump_tlb.c
+++ b/arch/mips/lib/dump_tlb.c
@@ -10,6 +10,7 @@
10#include <asm/mipsregs.h> 10#include <asm/mipsregs.h>
11#include <asm/page.h> 11#include <asm/page.h>
12#include <asm/pgtable.h> 12#include <asm/pgtable.h>
13#include <asm/tlbdebug.h>
13 14
14static inline const char *msk2str(unsigned int mask) 15static inline const char *msk2str(unsigned int mask)
15{ 16{
diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c
index 52f87795ecc3..9cee907975ae 100644
--- a/arch/mips/lib/r3k_dump_tlb.c
+++ b/arch/mips/lib/r3k_dump_tlb.c
@@ -11,6 +11,7 @@
11#include <asm/mipsregs.h> 11#include <asm/mipsregs.h>
12#include <asm/page.h> 12#include <asm/page.h>
13#include <asm/pgtable.h> 13#include <asm/pgtable.h>
14#include <asm/tlbdebug.h>
14 15
15extern int r3k_have_wired_reg; /* defined in tlb-r3k.c */ 16extern int r3k_have_wired_reg; /* defined in tlb-r3k.c */
16 17
diff --git a/arch/mips/lib/uncached.c b/arch/mips/lib/uncached.c
index 2388f7f3ffde..58d14f4d9349 100644
--- a/arch/mips/lib/uncached.c
+++ b/arch/mips/lib/uncached.c
@@ -12,6 +12,7 @@
12 12
13#include <asm/addrspace.h> 13#include <asm/addrspace.h>
14#include <asm/bug.h> 14#include <asm/bug.h>
15#include <asm/cacheflush.h>
15 16
16#ifndef CKSEG2 17#ifndef CKSEG2
17#define CKSEG2 CKSSEG 18#define CKSEG2 CKSSEG
diff --git a/arch/mips/mipssim/sim_int.c b/arch/mips/mipssim/sim_int.c
index d86b37235cf6..5cbc3509ab52 100644
--- a/arch/mips/mipssim/sim_int.c
+++ b/arch/mips/mipssim/sim_int.c
@@ -77,7 +77,7 @@ asmlinkage void plat_irq_dispatch(void)
77 irq = irq_ffs(pending); 77 irq = irq_ffs(pending);
78 78
79 if (irq > 0) 79 if (irq > 0)
80 do_IRQ(MIPSCPU_INT_BASE + irq); 80 do_IRQ(MIPS_CPU_IRQ_BASE + irq);
81 else 81 else
82 spurious_interrupt(); 82 spurious_interrupt();
83} 83}
diff --git a/arch/mips/mipssim/sim_setup.c b/arch/mips/mipssim/sim_setup.c
index 3643582bdade..60e66906be65 100644
--- a/arch/mips/mipssim/sim_setup.c
+++ b/arch/mips/mipssim/sim_setup.c
@@ -84,7 +84,7 @@ static void __init serial_init(void)
84 /* hardware int 4 - the serial int, is CPU int 6 84 /* hardware int 4 - the serial int, is CPU int 6
85 but poll for now */ 85 but poll for now */
86 s.irq = 0; 86 s.irq = 0;
87 s.uartclk = BASE_BAUD * 16; 87 s.uartclk = 1843200;
88 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 88 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
89 s.iotype = UPIO_PORT; 89 s.iotype = UPIO_PORT;
90 s.regshift = 0; 90 s.regshift = 0;
diff --git a/arch/mips/mipssim/sim_time.c b/arch/mips/mipssim/sim_time.c
index 874a18e8ac24..a0f5a5dca1b2 100644
--- a/arch/mips/mipssim/sim_time.c
+++ b/arch/mips/mipssim/sim_time.c
@@ -5,7 +5,6 @@
5#include <linux/spinlock.h> 5#include <linux/spinlock.h>
6#include <linux/interrupt.h> 6#include <linux/interrupt.h>
7#include <linux/mc146818rtc.h> 7#include <linux/mc146818rtc.h>
8#include <linux/mipsregs.h>
9#include <linux/smp.h> 8#include <linux/smp.h>
10#include <linux/timex.h> 9#include <linux/timex.h>
11 10
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 8108231f2e20..99d8f4fd3ff4 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -269,7 +269,7 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
269 } 269 }
270 270
271 for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) { 271 for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
272 struct pci_dev *dev = pci_dev_b(ln); 272 dev = pci_dev_b(ln);
273 273
274 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) 274 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
275 pcibios_fixup_device_resources(dev, bus); 275 pcibios_fixup_device_resources(dev, bus);
diff --git a/arch/mips/sibyte/swarm/time.c b/arch/mips/sibyte/swarm/time.c
deleted file mode 100644
index 97c73c793c35..000000000000
--- a/arch/mips/sibyte/swarm/time.c
+++ /dev/null
@@ -1,244 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19/*
20 * Time routines for the swarm board. We pass all the hard stuff
21 * through to the sb1250 handling code. Only thing we really keep
22 * track of here is what time of day we think it is. And we don't
23 * really even do a good job of that...
24 */
25
26
27#include <linux/bcd.h>
28#include <linux/init.h>
29#include <linux/time.h>
30#include <linux/sched.h>
31#include <linux/spinlock.h>
32#include <asm/system.h>
33#include <asm/addrspace.h>
34#include <asm/io.h>
35
36#include <asm/sibyte/sb1250.h>
37#include <asm/sibyte/sb1250_regs.h>
38#include <asm/sibyte/sb1250_smbus.h>
39
40static unsigned long long sec_bias = 0;
41static unsigned int usec_bias = 0;
42
43/* Xicor 1241 definitions */
44
45/*
46 * Register bits
47 */
48
49#define X1241REG_SR_BAT 0x80 /* currently on battery power */
50#define X1241REG_SR_RWEL 0x04 /* r/w latch is enabled, can write RTC */
51#define X1241REG_SR_WEL 0x02 /* r/w latch is unlocked, can enable r/w now */
52#define X1241REG_SR_RTCF 0x01 /* clock failed */
53#define X1241REG_BL_BP2 0x80 /* block protect 2 */
54#define X1241REG_BL_BP1 0x40 /* block protect 1 */
55#define X1241REG_BL_BP0 0x20 /* block protect 0 */
56#define X1241REG_BL_WD1 0x10
57#define X1241REG_BL_WD0 0x08
58#define X1241REG_HR_MIL 0x80 /* military time format */
59
60/*
61 * Register numbers
62 */
63
64#define X1241REG_BL 0x10 /* block protect bits */
65#define X1241REG_INT 0x11 /* */
66#define X1241REG_SC 0x30 /* Seconds */
67#define X1241REG_MN 0x31 /* Minutes */
68#define X1241REG_HR 0x32 /* Hours */
69#define X1241REG_DT 0x33 /* Day of month */
70#define X1241REG_MO 0x34 /* Month */
71#define X1241REG_YR 0x35 /* Year */
72#define X1241REG_DW 0x36 /* Day of Week */
73#define X1241REG_Y2K 0x37 /* Year 2K */
74#define X1241REG_SR 0x3F /* Status register */
75
76#define X1241_CCR_ADDRESS 0x6F
77
78#define SMB_CSR(reg) (IOADDR(A_SMB_REGISTER(1, reg)))
79
80static int xicor_read(uint8_t addr)
81{
82 while (__raw_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
83 ;
84
85 __raw_writeq((addr >> 8) & 0x7, SMB_CSR(R_SMB_CMD));
86 __raw_writeq(addr & 0xff, SMB_CSR(R_SMB_DATA));
87 __raw_writeq(V_SMB_ADDR(X1241_CCR_ADDRESS) | V_SMB_TT_WR2BYTE,
88 SMB_CSR(R_SMB_START));
89
90 while (__raw_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
91 ;
92
93 __raw_writeq(V_SMB_ADDR(X1241_CCR_ADDRESS) | V_SMB_TT_RD1BYTE,
94 SMB_CSR(R_SMB_START));
95
96 while (__raw_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
97 ;
98
99 if (__raw_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_ERROR) {
100 /* Clear error bit by writing a 1 */
101 __raw_writeq(M_SMB_ERROR, SMB_CSR(R_SMB_STATUS));
102 return -1;
103 }
104
105 return (__raw_readq(SMB_CSR(R_SMB_DATA)) & 0xff);
106}
107
108static int xicor_write(uint8_t addr, int b)
109{
110 while (__raw_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
111 ;
112
113 __raw_writeq(addr, SMB_CSR(R_SMB_CMD));
114 __raw_writeq((addr & 0xff) | ((b & 0xff) << 8), SMB_CSR(R_SMB_DATA));
115 __raw_writeq(V_SMB_ADDR(X1241_CCR_ADDRESS) | V_SMB_TT_WR3BYTE,
116 SMB_CSR(R_SMB_START));
117
118 while (__raw_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
119 ;
120
121 if (__raw_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_ERROR) {
122 /* Clear error bit by writing a 1 */
123 __raw_writeq(M_SMB_ERROR, SMB_CSR(R_SMB_STATUS));
124 return -1;
125 } else {
126 return 0;
127 }
128}
129
130/*
131 * In order to set the CMOS clock precisely, set_rtc_mmss has to be
132 * called 500 ms after the second nowtime has started, because when
133 * nowtime is written into the registers of the CMOS clock, it will
134 * jump to the next second precisely 500 ms later. Check the Motorola
135 * MC146818A or Dallas DS12887 data sheet for details.
136 *
137 * BUG: This routine does not handle hour overflow properly; it just
138 * sets the minutes. Usually you'll only notice that after reboot!
139 */
140int set_rtc_mmss(unsigned long nowtime)
141{
142 int retval = 0;
143 int real_seconds, real_minutes, cmos_minutes;
144
145 cmos_minutes = xicor_read(X1241REG_MN);
146 cmos_minutes = BCD2BIN(cmos_minutes);
147
148 /*
149 * since we're only adjusting minutes and seconds,
150 * don't interfere with hour overflow. This avoids
151 * messing with unknown time zones but requires your
152 * RTC not to be off by more than 15 minutes
153 */
154 real_seconds = nowtime % 60;
155 real_minutes = nowtime / 60;
156 if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1)
157 real_minutes += 30; /* correct for half hour time zone */
158 real_minutes %= 60;
159
160 /* unlock writes to the CCR */
161 xicor_write(X1241REG_SR, X1241REG_SR_WEL);
162 xicor_write(X1241REG_SR, X1241REG_SR_WEL | X1241REG_SR_RWEL);
163
164 if (abs(real_minutes - cmos_minutes) < 30) {
165 real_seconds = BIN2BCD(real_seconds);
166 real_minutes = BIN2BCD(real_minutes);
167 xicor_write(X1241REG_SC, real_seconds);
168 xicor_write(X1241REG_MN, real_minutes);
169 } else {
170 printk(KERN_WARNING
171 "set_rtc_mmss: can't update from %d to %d\n",
172 cmos_minutes, real_minutes);
173 retval = -1;
174 }
175
176 xicor_write(X1241REG_SR, 0);
177
178 printk("set_rtc_mmss: %02d:%02d\n", real_minutes, real_seconds);
179
180 return retval;
181}
182
183static unsigned long __init get_swarm_time(void)
184{
185 unsigned int year, mon, day, hour, min, sec, y2k;
186
187 sec = xicor_read(X1241REG_SC);
188 min = xicor_read(X1241REG_MN);
189 hour = xicor_read(X1241REG_HR);
190
191 if (hour & X1241REG_HR_MIL) {
192 hour &= 0x3f;
193 } else {
194 if (hour & 0x20)
195 hour = (hour & 0xf) + 0x12;
196 }
197
198 sec = BCD2BIN(sec);
199 min = BCD2BIN(min);
200 hour = BCD2BIN(hour);
201
202 day = xicor_read(X1241REG_DT);
203 mon = xicor_read(X1241REG_MO);
204 year = xicor_read(X1241REG_YR);
205 y2k = xicor_read(X1241REG_Y2K);
206
207 day = BCD2BIN(day);
208 mon = BCD2BIN(mon);
209 year = BCD2BIN(year);
210 y2k = BCD2BIN(y2k);
211
212 year += (y2k * 100);
213
214 return mktime(year, mon, day, hour, min, sec);
215}
216
217/*
218 * Bring up the timer at 100 Hz.
219 */
220void __init swarm_time_init(void)
221{
222 unsigned int flags;
223 int status;
224
225 /* Set up the scd general purpose timer 0 to cpu 0 */
226 sb1250_time_init();
227
228 /* Establish communication with the Xicor 1241 RTC */
229 /* XXXKW how do I share the SMBus with the I2C subsystem? */
230
231 __raw_writeq(K_SMB_FREQ_400KHZ, SMB_CSR(R_SMB_FREQ));
232 __raw_writeq(0, SMB_CSR(R_SMB_CONTROL));
233
234 if ((status = xicor_read(X1241REG_SR_RTCF)) < 0) {
235 printk("x1241: couldn't detect on SWARM SMBus 1\n");
236 } else {
237 if (status & X1241REG_SR_RTCF)
238 printk("x1241: battery failed -- time is probably wrong\n");
239 write_seqlock_irqsave(&xtime_lock, flags);
240 xtime.tv_sec = get_swarm_time();
241 xtime.tv_nsec = 0;
242 write_sequnlock_irqrestore(&xtime_lock, flags);
243 }
244}
diff --git a/arch/mips/sni/a20r.c b/arch/mips/sni/a20r.c
index 6850a29defcd..acc9ba76c1a9 100644
--- a/arch/mips/sni/a20r.c
+++ b/arch/mips/sni/a20r.c
@@ -87,8 +87,8 @@ static struct platform_device snirm_82596_pdev = {
87 87
88static struct resource snirm_53c710_rsrc[] = { 88static struct resource snirm_53c710_rsrc[] = {
89 { 89 {
90 .start = 0xb9000000, 90 .start = 0x19000000,
91 .end = 0xb90fffff, 91 .end = 0x190fffff,
92 .flags = IORESOURCE_MEM 92 .flags = IORESOURCE_MEM
93 }, 93 },
94 { 94 {
@@ -106,8 +106,8 @@ static struct platform_device snirm_53c710_pdev = {
106 106
107static struct resource sc26xx_rsrc[] = { 107static struct resource sc26xx_rsrc[] = {
108 { 108 {
109 .start = 0xbc070000, 109 .start = 0x1c070000,
110 .end = 0xbc0700ff, 110 .end = 0x1c0700ff,
111 .flags = IORESOURCE_MEM 111 .flags = IORESOURCE_MEM
112 }, 112 },
113 { 113 {
diff --git a/arch/mips/sni/rm200.c b/arch/mips/sni/rm200.c
index 4bfda020fdc7..28a11d8605ce 100644
--- a/arch/mips/sni/rm200.c
+++ b/arch/mips/sni/rm200.c
@@ -88,8 +88,8 @@ static struct platform_device snirm_82596_rm200_pdev = {
88 88
89static struct resource snirm_53c710_rm200_rsrc[] = { 89static struct resource snirm_53c710_rm200_rsrc[] = {
90 { 90 {
91 .start = 0xb9000000, 91 .start = 0x19000000,
92 .end = 0xb90fffff, 92 .end = 0x190fffff,
93 .flags = IORESOURCE_MEM 93 .flags = IORESOURCE_MEM
94 }, 94 },
95 { 95 {
diff --git a/arch/mips/vr41xx/common/Makefile b/arch/mips/vr41xx/common/Makefile
index f842783acd86..d0d84ec8d63d 100644
--- a/arch/mips/vr41xx/common/Makefile
+++ b/arch/mips/vr41xx/common/Makefile
@@ -2,4 +2,4 @@
2# Makefile for common code of the NEC VR4100 series. 2# Makefile for common code of the NEC VR4100 series.
3# 3#
4 4
5obj-y += bcu.o cmu.o icu.o init.o irq.o pmu.o type.o 5obj-y += bcu.o cmu.o giu.o icu.o init.o irq.o pmu.o rtc.o siu.o type.o
diff --git a/arch/mips/vr41xx/common/giu.c b/arch/mips/vr41xx/common/giu.c
new file mode 100644
index 000000000000..d21f6f2d22a3
--- /dev/null
+++ b/arch/mips/vr41xx/common/giu.c
@@ -0,0 +1,122 @@
1/*
2 * NEC VR4100 series GIU platform device.
3 *
4 * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/errno.h>
21#include <linux/init.h>
22#include <linux/ioport.h>
23#include <linux/platform_device.h>
24
25#include <asm/cpu.h>
26#include <asm/vr41xx/giu.h>
27#include <asm/vr41xx/irq.h>
28
29static struct resource giu_50pins_pullupdown_resource[] __initdata = {
30 {
31 .start = 0x0b000100,
32 .end = 0x0b00011f,
33 .flags = IORESOURCE_MEM,
34 },
35 {
36 .start = 0x0b0002e0,
37 .end = 0x0b0002e3,
38 .flags = IORESOURCE_MEM,
39 },
40 {
41 .start = GIUINT_IRQ,
42 .end = GIUINT_IRQ,
43 .flags = IORESOURCE_IRQ,
44 },
45};
46
47static struct resource giu_36pins_resource[] __initdata = {
48 {
49 .start = 0x0f000140,
50 .end = 0x0f00015f,
51 .flags = IORESOURCE_MEM,
52 },
53 {
54 .start = GIUINT_IRQ,
55 .end = GIUINT_IRQ,
56 .flags = IORESOURCE_IRQ,
57 },
58};
59
60static struct resource giu_48pins_resource[] __initdata = {
61 {
62 .start = 0x0f000140,
63 .end = 0x0f000167,
64 .flags = IORESOURCE_MEM,
65 },
66 {
67 .start = GIUINT_IRQ,
68 .end = GIUINT_IRQ,
69 .flags = IORESOURCE_IRQ,
70 },
71};
72
73static int __init vr41xx_giu_add(void)
74{
75 struct platform_device *pdev;
76 struct resource *res;
77 unsigned int num;
78 int retval;
79
80 pdev = platform_device_alloc("GIU", -1);
81 if (!pdev)
82 return -ENOMEM;
83
84 switch (current_cpu_data.cputype) {
85 case CPU_VR4111:
86 case CPU_VR4121:
87 pdev->id = GPIO_50PINS_PULLUPDOWN;
88 res = giu_50pins_pullupdown_resource;
89 num = ARRAY_SIZE(giu_50pins_pullupdown_resource);
90 break;
91 case CPU_VR4122:
92 case CPU_VR4131:
93 pdev->id = GPIO_36PINS;
94 res = giu_36pins_resource;
95 num = ARRAY_SIZE(giu_36pins_resource);
96 break;
97 case CPU_VR4133:
98 pdev->id = GPIO_48PINS_EDGE_SELECT;
99 res = giu_48pins_resource;
100 num = ARRAY_SIZE(giu_48pins_resource);
101 break;
102 default:
103 retval = -ENODEV;
104 goto err_free_device;
105 }
106
107 retval = platform_device_add_resources(pdev, res, num);
108 if (retval)
109 goto err_free_device;
110
111 retval = platform_device_add(pdev);
112 if (retval)
113 goto err_free_device;
114
115 return 0;
116
117err_free_device:
118 platform_device_put(pdev);
119
120 return retval;
121}
122device_initcall(vr41xx_giu_add);
diff --git a/arch/mips/vr41xx/common/rtc.c b/arch/mips/vr41xx/common/rtc.c
new file mode 100644
index 000000000000..cce605b3d688
--- /dev/null
+++ b/arch/mips/vr41xx/common/rtc.c
@@ -0,0 +1,117 @@
1/*
2 * NEC VR4100 series RTC platform device.
3 *
4 * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/errno.h>
21#include <linux/init.h>
22#include <linux/ioport.h>
23#include <linux/platform_device.h>
24
25#include <asm/cpu.h>
26#include <asm/vr41xx/irq.h>
27
28static struct resource rtc_type1_resource[] __initdata = {
29 {
30 .start = 0x0b0000c0,
31 .end = 0x0b0000df,
32 .flags = IORESOURCE_MEM,
33 },
34 {
35 .start = 0x0b0001c0,
36 .end = 0x0b0001df,
37 .flags = IORESOURCE_MEM,
38 },
39 {
40 .start = ELAPSEDTIME_IRQ,
41 .end = ELAPSEDTIME_IRQ,
42 .flags = IORESOURCE_IRQ,
43 },
44 {
45 .start = RTCLONG1_IRQ,
46 .end = RTCLONG1_IRQ,
47 .flags = IORESOURCE_IRQ,
48 },
49};
50
51static struct resource rtc_type2_resource[] __initdata = {
52 {
53 .start = 0x0f000100,
54 .end = 0x0f00011f,
55 .flags = IORESOURCE_MEM,
56 },
57 {
58 .start = 0x0f000120,
59 .end = 0x0f00013f,
60 .flags = IORESOURCE_MEM,
61 },
62 {
63 .start = ELAPSEDTIME_IRQ,
64 .end = ELAPSEDTIME_IRQ,
65 .flags = IORESOURCE_IRQ,
66 },
67 {
68 .start = RTCLONG1_IRQ,
69 .end = RTCLONG1_IRQ,
70 .flags = IORESOURCE_IRQ,
71 },
72};
73
74static int __init vr41xx_rtc_add(void)
75{
76 struct platform_device *pdev;
77 struct resource *res;
78 unsigned int num;
79 int retval;
80
81 pdev = platform_device_alloc("RTC", -1);
82 if (!pdev)
83 return -ENOMEM;
84
85 switch (current_cpu_data.cputype) {
86 case CPU_VR4111:
87 case CPU_VR4121:
88 res = rtc_type1_resource;
89 num = ARRAY_SIZE(rtc_type1_resource);
90 break;
91 case CPU_VR4122:
92 case CPU_VR4131:
93 case CPU_VR4133:
94 res = rtc_type2_resource;
95 num = ARRAY_SIZE(rtc_type2_resource);
96 break;
97 default:
98 retval = -ENODEV;
99 goto err_free_device;
100 }
101
102 retval = platform_device_add_resources(pdev, res, num);
103 if (retval)
104 goto err_free_device;
105
106 retval = platform_device_add(pdev);
107 if (retval)
108 goto err_free_device;
109
110 return 0;
111
112err_free_device:
113 platform_device_put(pdev);
114
115 return retval;
116}
117device_initcall(vr41xx_rtc_add);
diff --git a/arch/mips/vr41xx/common/siu.c b/arch/mips/vr41xx/common/siu.c
new file mode 100644
index 000000000000..a1e774142163
--- /dev/null
+++ b/arch/mips/vr41xx/common/siu.c
@@ -0,0 +1,120 @@
1/*
2 * NEC VR4100 series SIU platform device.
3 *
4 * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/errno.h>
21#include <linux/init.h>
22#include <linux/ioport.h>
23#include <linux/platform_device.h>
24#include <linux/serial_core.h>
25
26#include <asm/cpu.h>
27#include <asm/vr41xx/siu.h>
28
29static unsigned int siu_type1_ports[SIU_PORTS_MAX] __initdata = {
30 PORT_VR41XX_SIU,
31 PORT_UNKNOWN,
32};
33
34static struct resource siu_type1_resource[] __initdata = {
35 {
36 .start = 0x0c000000,
37 .end = 0x0c00000a,
38 .flags = IORESOURCE_MEM,
39 },
40 {
41 .start = SIU_IRQ,
42 .end = SIU_IRQ,
43 .flags = IORESOURCE_IRQ,
44 },
45};
46
47static unsigned int siu_type2_ports[SIU_PORTS_MAX] __initdata = {
48 PORT_VR41XX_SIU,
49 PORT_VR41XX_DSIU,
50};
51
52static struct resource siu_type2_resource[] __initdata = {
53 {
54 .start = 0x0f000800,
55 .end = 0x0f00080a,
56 .flags = IORESOURCE_MEM,
57 },
58 {
59 .start = 0x0f000820,
60 .end = 0x0f000829,
61 .flags = IORESOURCE_MEM,
62 },
63 {
64 .start = SIU_IRQ,
65 .end = SIU_IRQ,
66 .flags = IORESOURCE_IRQ,
67 },
68 {
69 .start = DSIU_IRQ,
70 .end = DSIU_IRQ,
71 .flags = IORESOURCE_IRQ,
72 },
73};
74
75static int __init vr41xx_siu_add(void)
76{
77 struct platform_device *pdev;
78 struct resource *res;
79 unsigned int num;
80 int retval;
81
82 pdev = platform_device_alloc("SIU", -1);
83 if (!pdev)
84 return -ENOMEM;
85
86 switch (current_cpu_data.cputype) {
87 case CPU_VR4111:
88 case CPU_VR4121:
89 pdev->dev.platform_data = siu_type1_ports;
90 res = siu_type1_resource;
91 num = ARRAY_SIZE(siu_type1_resource);
92 break;
93 case CPU_VR4122:
94 case CPU_VR4131:
95 case CPU_VR4133:
96 pdev->dev.platform_data = siu_type2_ports;
97 res = siu_type2_resource;
98 num = ARRAY_SIZE(siu_type2_resource);
99 break;
100 default:
101 retval = -ENODEV;
102 goto err_free_device;
103 }
104
105 retval = platform_device_add_resources(pdev, res, num);
106 if (retval)
107 goto err_free_device;
108
109 retval = platform_device_add(pdev);
110 if (retval)
111 goto err_free_device;
112
113 return 0;
114
115err_free_device:
116 platform_device_put(pdev);
117
118 return retval;
119}
120device_initcall(vr41xx_siu_add);
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index ef683ebd367c..a31c6d2c061f 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -815,7 +815,7 @@ config SGI_IP27_RTC
815 815
816config GEN_RTC 816config GEN_RTC
817 tristate "Generic /dev/rtc emulation" 817 tristate "Generic /dev/rtc emulation"
818 depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC && !FRV && !S390 && !SUPERH 818 depends on RTC!=y && !IA64 && !ARM && !M32R && !MIPS && !SPARC && !FRV && !S390 && !SUPERH
819 ---help--- 819 ---help---
820 If you say Y here and create a character special file /dev/rtc with 820 If you say Y here and create a character special file /dev/rtc with
821 major number 10 and minor number 135 using mknod ("man mknod"), you 821 major number 10 and minor number 135 using mknod ("man mknod"), you
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c
index 0cea8d4907df..e5ed09192be8 100644
--- a/drivers/char/vr41xx_giu.c
+++ b/drivers/char/vr41xx_giu.c
@@ -19,18 +19,17 @@
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22#include <linux/platform_device.h>
23#include <linux/errno.h> 22#include <linux/errno.h>
24#include <linux/fs.h> 23#include <linux/fs.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/irq.h>
27#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/irq.h>
28#include <linux/kernel.h> 27#include <linux/kernel.h>
29#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/platform_device.h>
30#include <linux/spinlock.h> 30#include <linux/spinlock.h>
31#include <linux/types.h> 31#include <linux/types.h>
32 32
33#include <asm/cpu.h>
34#include <asm/io.h> 33#include <asm/io.h>
35#include <asm/vr41xx/giu.h> 34#include <asm/vr41xx/giu.h>
36#include <asm/vr41xx/irq.h> 35#include <asm/vr41xx/irq.h>
@@ -44,18 +43,6 @@ static int major; /* default is dynamic major device number */
44module_param(major, int, 0); 43module_param(major, int, 0);
45MODULE_PARM_DESC(major, "Major device number"); 44MODULE_PARM_DESC(major, "Major device number");
46 45
47#define GIU_TYPE1_START 0x0b000100UL
48#define GIU_TYPE1_SIZE 0x20UL
49
50#define GIU_TYPE2_START 0x0f000140UL
51#define GIU_TYPE2_SIZE 0x20UL
52
53#define GIU_TYPE3_START 0x0f000140UL
54#define GIU_TYPE3_SIZE 0x28UL
55
56#define GIU_PULLUPDOWN_START 0x0b0002e0UL
57#define GIU_PULLUPDOWN_SIZE 0x04UL
58
59#define GIUIOSELL 0x00 46#define GIUIOSELL 0x00
60#define GIUIOSELH 0x02 47#define GIUIOSELH 0x02
61#define GIUPIODL 0x04 48#define GIUPIODL 0x04
@@ -89,8 +76,6 @@ MODULE_PARM_DESC(major, "Major device number");
89#define GPIO_HAS_INTERRUPT_EDGE_SELECT 0x0100 76#define GPIO_HAS_INTERRUPT_EDGE_SELECT 0x0100
90 77
91static spinlock_t giu_lock; 78static spinlock_t giu_lock;
92static struct resource *giu_resource1;
93static struct resource *giu_resource2;
94static unsigned long giu_flags; 79static unsigned long giu_flags;
95static unsigned int giu_nr_pins; 80static unsigned int giu_nr_pins;
96 81
@@ -234,7 +219,7 @@ void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_
234 giu_set(GIUINTHTSELL, mask); 219 giu_set(GIUINTHTSELL, mask);
235 else 220 else
236 giu_clear(GIUINTHTSELL, mask); 221 giu_clear(GIUINTHTSELL, mask);
237 if (current_cpu_data.cputype == CPU_VR4133) { 222 if (giu_flags & GPIO_HAS_INTERRUPT_EDGE_SELECT) {
238 switch (trigger) { 223 switch (trigger) {
239 case IRQ_TRIGGER_EDGE_FALLING: 224 case IRQ_TRIGGER_EDGE_FALLING:
240 giu_set(GIUFEDGEINHL, mask); 225 giu_set(GIUFEDGEINHL, mask);
@@ -269,7 +254,7 @@ void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_
269 giu_set(GIUINTHTSELH, mask); 254 giu_set(GIUINTHTSELH, mask);
270 else 255 else
271 giu_clear(GIUINTHTSELH, mask); 256 giu_clear(GIUINTHTSELH, mask);
272 if (current_cpu_data.cputype == CPU_VR4133) { 257 if (giu_flags & GPIO_HAS_INTERRUPT_EDGE_SELECT) {
273 switch (trigger) { 258 switch (trigger) {
274 case IRQ_TRIGGER_EDGE_FALLING: 259 case IRQ_TRIGGER_EDGE_FALLING:
275 giu_set(GIUFEDGEINHH, mask); 260 giu_set(GIUFEDGEINHH, mask);
@@ -298,7 +283,6 @@ void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_
298 giu_write(GIUINTSTATH, mask); 283 giu_write(GIUINTSTATH, mask);
299 } 284 }
300} 285}
301
302EXPORT_SYMBOL_GPL(vr41xx_set_irq_trigger); 286EXPORT_SYMBOL_GPL(vr41xx_set_irq_trigger);
303 287
304void vr41xx_set_irq_level(unsigned int pin, irq_level_t level) 288void vr41xx_set_irq_level(unsigned int pin, irq_level_t level)
@@ -321,7 +305,6 @@ void vr41xx_set_irq_level(unsigned int pin, irq_level_t level)
321 giu_write(GIUINTSTATH, mask); 305 giu_write(GIUINTSTATH, mask);
322 } 306 }
323} 307}
324
325EXPORT_SYMBOL_GPL(vr41xx_set_irq_level); 308EXPORT_SYMBOL_GPL(vr41xx_set_irq_level);
326 309
327gpio_data_t vr41xx_gpio_get_pin(unsigned int pin) 310gpio_data_t vr41xx_gpio_get_pin(unsigned int pin)
@@ -350,7 +333,6 @@ gpio_data_t vr41xx_gpio_get_pin(unsigned int pin)
350 333
351 return GPIO_DATA_LOW; 334 return GPIO_DATA_LOW;
352} 335}
353
354EXPORT_SYMBOL_GPL(vr41xx_gpio_get_pin); 336EXPORT_SYMBOL_GPL(vr41xx_gpio_get_pin);
355 337
356int vr41xx_gpio_set_pin(unsigned int pin, gpio_data_t data) 338int vr41xx_gpio_set_pin(unsigned int pin, gpio_data_t data)
@@ -388,7 +370,6 @@ int vr41xx_gpio_set_pin(unsigned int pin, gpio_data_t data)
388 370
389 return 0; 371 return 0;
390} 372}
391
392EXPORT_SYMBOL_GPL(vr41xx_gpio_set_pin); 373EXPORT_SYMBOL_GPL(vr41xx_gpio_set_pin);
393 374
394int vr41xx_gpio_set_direction(unsigned int pin, gpio_direction_t dir) 375int vr41xx_gpio_set_direction(unsigned int pin, gpio_direction_t dir)
@@ -438,7 +419,6 @@ int vr41xx_gpio_set_direction(unsigned int pin, gpio_direction_t dir)
438 419
439 return 0; 420 return 0;
440} 421}
441
442EXPORT_SYMBOL_GPL(vr41xx_gpio_set_direction); 422EXPORT_SYMBOL_GPL(vr41xx_gpio_set_direction);
443 423
444int vr41xx_gpio_pullupdown(unsigned int pin, gpio_pull_t pull) 424int vr41xx_gpio_pullupdown(unsigned int pin, gpio_pull_t pull)
@@ -477,7 +457,6 @@ int vr41xx_gpio_pullupdown(unsigned int pin, gpio_pull_t pull)
477 457
478 return 0; 458 return 0;
479} 459}
480
481EXPORT_SYMBOL_GPL(vr41xx_gpio_pullupdown); 460EXPORT_SYMBOL_GPL(vr41xx_gpio_pullupdown);
482 461
483static ssize_t gpio_read(struct file *file, char __user *buf, size_t len, 462static ssize_t gpio_read(struct file *file, char __user *buf, size_t len,
@@ -596,61 +575,40 @@ static const struct file_operations gpio_fops = {
596 575
597static int __devinit giu_probe(struct platform_device *dev) 576static int __devinit giu_probe(struct platform_device *dev)
598{ 577{
599 unsigned long start, size, flags = 0; 578 struct resource *res;
600 unsigned int nr_pins = 0, trigger, i, pin; 579 unsigned int trigger, i, pin;
601 struct resource *res1, *res2 = NULL;
602 void *base;
603 struct irq_chip *chip; 580 struct irq_chip *chip;
604 int retval; 581 int irq, retval;
605 582
606 switch (current_cpu_data.cputype) { 583 switch (dev->id) {
607 case CPU_VR4111: 584 case GPIO_50PINS_PULLUPDOWN:
608 case CPU_VR4121: 585 giu_flags = GPIO_HAS_PULLUPDOWN_IO;
609 start = GIU_TYPE1_START; 586 giu_nr_pins = 50;
610 size = GIU_TYPE1_SIZE;
611 flags = GPIO_HAS_PULLUPDOWN_IO;
612 nr_pins = 50;
613 break; 587 break;
614 case CPU_VR4122: 588 case GPIO_36PINS:
615 case CPU_VR4131: 589 giu_nr_pins = 36;
616 start = GIU_TYPE2_START;
617 size = GIU_TYPE2_SIZE;
618 nr_pins = 36;
619 break; 590 break;
620 case CPU_VR4133: 591 case GPIO_48PINS_EDGE_SELECT:
621 start = GIU_TYPE3_START; 592 giu_flags = GPIO_HAS_INTERRUPT_EDGE_SELECT;
622 size = GIU_TYPE3_SIZE; 593 giu_nr_pins = 48;
623 flags = GPIO_HAS_INTERRUPT_EDGE_SELECT;
624 nr_pins = 48;
625 break; 594 break;
626 default: 595 default:
596 printk(KERN_ERR "GIU: unknown ID %d\n", dev->id);
627 return -ENODEV; 597 return -ENODEV;
628 } 598 }
629 599
630 res1 = request_mem_region(start, size, "GIU"); 600 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
631 if (res1 == NULL) 601 if (!res)
632 return -EBUSY; 602 return -EBUSY;
633 603
634 base = ioremap(start, size); 604 giu_base = ioremap(res->start, res->end - res->start + 1);
635 if (base == NULL) { 605 if (!giu_base)
636 release_resource(res1);
637 return -ENOMEM; 606 return -ENOMEM;
638 }
639
640 if (flags & GPIO_HAS_PULLUPDOWN_IO) {
641 res2 = request_mem_region(GIU_PULLUPDOWN_START, GIU_PULLUPDOWN_SIZE, "GIU");
642 if (res2 == NULL) {
643 iounmap(base);
644 release_resource(res1);
645 return -EBUSY;
646 }
647 }
648 607
649 retval = register_chrdev(major, "GIU", &gpio_fops); 608 retval = register_chrdev(major, "GIU", &gpio_fops);
650 if (retval < 0) { 609 if (retval < 0) {
651 iounmap(base); 610 iounmap(giu_base);
652 release_resource(res1); 611 giu_base = NULL;
653 release_resource(res2);
654 return retval; 612 return retval;
655 } 613 }
656 614
@@ -660,11 +618,6 @@ static int __devinit giu_probe(struct platform_device *dev)
660 } 618 }
661 619
662 spin_lock_init(&giu_lock); 620 spin_lock_init(&giu_lock);
663 giu_base = base;
664 giu_resource1 = res1;
665 giu_resource2 = res2;
666 giu_flags = flags;
667 giu_nr_pins = nr_pins;
668 621
669 giu_write(GIUINTENL, 0); 622 giu_write(GIUINTENL, 0);
670 giu_write(GIUINTENH, 0); 623 giu_write(GIUINTENH, 0);
@@ -685,22 +638,23 @@ static int __devinit giu_probe(struct platform_device *dev)
685 638
686 } 639 }
687 640
688 return cascade_irq(GIUINT_IRQ, giu_get_irq); 641 irq = platform_get_irq(dev, 0);
642 if (irq < 0 || irq >= NR_IRQS)
643 return -EBUSY;
644
645 return cascade_irq(irq, giu_get_irq);
689} 646}
690 647
691static int __devexit giu_remove(struct platform_device *dev) 648static int __devexit giu_remove(struct platform_device *dev)
692{ 649{
693 iounmap(giu_base); 650 if (giu_base) {
694 651 iounmap(giu_base);
695 release_resource(giu_resource1); 652 giu_base = NULL;
696 if (giu_flags & GPIO_HAS_PULLUPDOWN_IO) 653 }
697 release_resource(giu_resource2);
698 654
699 return 0; 655 return 0;
700} 656}
701 657
702static struct platform_device *giu_platform_device;
703
704static struct platform_driver giu_device_driver = { 658static struct platform_driver giu_device_driver = {
705 .probe = giu_probe, 659 .probe = giu_probe,
706 .remove = __devexit_p(giu_remove), 660 .remove = __devexit_p(giu_remove),
@@ -712,30 +666,12 @@ static struct platform_driver giu_device_driver = {
712 666
713static int __init vr41xx_giu_init(void) 667static int __init vr41xx_giu_init(void)
714{ 668{
715 int retval; 669 return platform_driver_register(&giu_device_driver);
716
717 giu_platform_device = platform_device_alloc("GIU", -1);
718 if (!giu_platform_device)
719 return -ENOMEM;
720
721 retval = platform_device_add(giu_platform_device);
722 if (retval < 0) {
723 platform_device_put(giu_platform_device);
724 return retval;
725 }
726
727 retval = platform_driver_register(&giu_device_driver);
728 if (retval < 0)
729 platform_device_unregister(giu_platform_device);
730
731 return retval;
732} 670}
733 671
734static void __exit vr41xx_giu_exit(void) 672static void __exit vr41xx_giu_exit(void)
735{ 673{
736 platform_driver_unregister(&giu_device_driver); 674 platform_driver_unregister(&giu_device_driver);
737
738 platform_device_unregister(giu_platform_device);
739} 675}
740 676
741module_init(vr41xx_giu_init); 677module_init(vr41xx_giu_init);
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c
index af7596ef29e2..ce2f78de7a80 100644
--- a/drivers/rtc/rtc-vr41xx.c
+++ b/drivers/rtc/rtc-vr41xx.c
@@ -17,10 +17,11 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#include <linux/err.h>
20#include <linux/fs.h> 21#include <linux/fs.h>
21#include <linux/init.h> 22#include <linux/init.h>
22#include <linux/ioport.h> 23#include <linux/ioport.h>
23#include <linux/irq.h> 24#include <linux/interrupt.h>
24#include <linux/module.h> 25#include <linux/module.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
26#include <linux/rtc.h> 27#include <linux/rtc.h>
@@ -30,25 +31,11 @@
30#include <asm/div64.h> 31#include <asm/div64.h>
31#include <asm/io.h> 32#include <asm/io.h>
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include <asm/vr41xx/irq.h>
34 34
35MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); 35MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>");
36MODULE_DESCRIPTION("NEC VR4100 series RTC driver"); 36MODULE_DESCRIPTION("NEC VR4100 series RTC driver");
37MODULE_LICENSE("GPL"); 37MODULE_LICENSE("GPL");
38 38
39#define RTC1_TYPE1_START 0x0b0000c0UL
40#define RTC1_TYPE1_END 0x0b0000dfUL
41#define RTC2_TYPE1_START 0x0b0001c0UL
42#define RTC2_TYPE1_END 0x0b0001dfUL
43
44#define RTC1_TYPE2_START 0x0f000100UL
45#define RTC1_TYPE2_END 0x0f00011fUL
46#define RTC2_TYPE2_START 0x0f000120UL
47#define RTC2_TYPE2_END 0x0f00013fUL
48
49#define RTC1_SIZE 0x20
50#define RTC2_SIZE 0x20
51
52/* RTC 1 registers */ 39/* RTC 1 registers */
53#define ETIMELREG 0x00 40#define ETIMELREG 0x00
54#define ETIMEMREG 0x02 41#define ETIMEMREG 0x02
@@ -98,13 +85,8 @@ static char rtc_name[] = "RTC";
98static unsigned long periodic_frequency; 85static unsigned long periodic_frequency;
99static unsigned long periodic_count; 86static unsigned long periodic_count;
100static unsigned int alarm_enabled; 87static unsigned int alarm_enabled;
101 88static int aie_irq = -1;
102struct resource rtc_resource[2] = { 89static int pie_irq = -1;
103 { .name = rtc_name,
104 .flags = IORESOURCE_MEM, },
105 { .name = rtc_name,
106 .flags = IORESOURCE_MEM, },
107};
108 90
109static inline unsigned long read_elapsed_second(void) 91static inline unsigned long read_elapsed_second(void)
110{ 92{
@@ -150,8 +132,8 @@ static void vr41xx_rtc_release(struct device *dev)
150 132
151 spin_unlock_irq(&rtc_lock); 133 spin_unlock_irq(&rtc_lock);
152 134
153 disable_irq(ELAPSEDTIME_IRQ); 135 disable_irq(aie_irq);
154 disable_irq(RTCLONG1_IRQ); 136 disable_irq(pie_irq);
155} 137}
156 138
157static int vr41xx_rtc_read_time(struct device *dev, struct rtc_time *time) 139static int vr41xx_rtc_read_time(struct device *dev, struct rtc_time *time)
@@ -209,14 +191,14 @@ static int vr41xx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
209 spin_lock_irq(&rtc_lock); 191 spin_lock_irq(&rtc_lock);
210 192
211 if (alarm_enabled) 193 if (alarm_enabled)
212 disable_irq(ELAPSEDTIME_IRQ); 194 disable_irq(aie_irq);
213 195
214 rtc1_write(ECMPLREG, (uint16_t)(alarm_sec << 15)); 196 rtc1_write(ECMPLREG, (uint16_t)(alarm_sec << 15));
215 rtc1_write(ECMPMREG, (uint16_t)(alarm_sec >> 1)); 197 rtc1_write(ECMPMREG, (uint16_t)(alarm_sec >> 1));
216 rtc1_write(ECMPHREG, (uint16_t)(alarm_sec >> 17)); 198 rtc1_write(ECMPHREG, (uint16_t)(alarm_sec >> 17));
217 199
218 if (wkalrm->enabled) 200 if (wkalrm->enabled)
219 enable_irq(ELAPSEDTIME_IRQ); 201 enable_irq(aie_irq);
220 202
221 alarm_enabled = wkalrm->enabled; 203 alarm_enabled = wkalrm->enabled;
222 204
@@ -234,7 +216,7 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long
234 spin_lock_irq(&rtc_lock); 216 spin_lock_irq(&rtc_lock);
235 217
236 if (!alarm_enabled) { 218 if (!alarm_enabled) {
237 enable_irq(ELAPSEDTIME_IRQ); 219 enable_irq(aie_irq);
238 alarm_enabled = 1; 220 alarm_enabled = 1;
239 } 221 }
240 222
@@ -244,17 +226,17 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long
244 spin_lock_irq(&rtc_lock); 226 spin_lock_irq(&rtc_lock);
245 227
246 if (alarm_enabled) { 228 if (alarm_enabled) {
247 disable_irq(ELAPSEDTIME_IRQ); 229 disable_irq(aie_irq);
248 alarm_enabled = 0; 230 alarm_enabled = 0;
249 } 231 }
250 232
251 spin_unlock_irq(&rtc_lock); 233 spin_unlock_irq(&rtc_lock);
252 break; 234 break;
253 case RTC_PIE_ON: 235 case RTC_PIE_ON:
254 enable_irq(RTCLONG1_IRQ); 236 enable_irq(pie_irq);
255 break; 237 break;
256 case RTC_PIE_OFF: 238 case RTC_PIE_OFF:
257 disable_irq(RTCLONG1_IRQ); 239 disable_irq(pie_irq);
258 break; 240 break;
259 case RTC_IRQP_READ: 241 case RTC_IRQP_READ:
260 return put_user(periodic_frequency, (unsigned long __user *)arg); 242 return put_user(periodic_frequency, (unsigned long __user *)arg);
@@ -331,31 +313,37 @@ static const struct rtc_class_ops vr41xx_rtc_ops = {
331 313
332static int __devinit rtc_probe(struct platform_device *pdev) 314static int __devinit rtc_probe(struct platform_device *pdev)
333{ 315{
316 struct resource *res;
334 struct rtc_device *rtc; 317 struct rtc_device *rtc;
335 unsigned int irq;
336 int retval; 318 int retval;
337 319
338 if (pdev->num_resources != 2) 320 if (pdev->num_resources != 4)
339 return -EBUSY; 321 return -EBUSY;
340 322
341 rtc1_base = ioremap(pdev->resource[0].start, RTC1_SIZE); 323 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
342 if (rtc1_base == NULL) 324 if (!res)
343 return -EBUSY; 325 return -EBUSY;
344 326
345 rtc2_base = ioremap(pdev->resource[1].start, RTC2_SIZE); 327 rtc1_base = ioremap(res->start, res->end - res->start + 1);
346 if (rtc2_base == NULL) { 328 if (!rtc1_base)
347 iounmap(rtc1_base);
348 rtc1_base = NULL;
349 return -EBUSY; 329 return -EBUSY;
330
331 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
332 if (!res) {
333 retval = -EBUSY;
334 goto err_rtc1_iounmap;
335 }
336
337 rtc2_base = ioremap(res->start, res->end - res->start + 1);
338 if (!rtc2_base) {
339 retval = -EBUSY;
340 goto err_rtc1_iounmap;
350 } 341 }
351 342
352 rtc = rtc_device_register(rtc_name, &pdev->dev, &vr41xx_rtc_ops, THIS_MODULE); 343 rtc = rtc_device_register(rtc_name, &pdev->dev, &vr41xx_rtc_ops, THIS_MODULE);
353 if (IS_ERR(rtc)) { 344 if (IS_ERR(rtc)) {
354 iounmap(rtc1_base); 345 retval = PTR_ERR(rtc);
355 iounmap(rtc2_base); 346 goto err_iounmap_all;
356 rtc1_base = NULL;
357 rtc2_base = NULL;
358 return PTR_ERR(rtc);
359 } 347 }
360 348
361 spin_lock_irq(&rtc_lock); 349 spin_lock_irq(&rtc_lock);
@@ -368,35 +356,50 @@ static int __devinit rtc_probe(struct platform_device *pdev)
368 356
369 spin_unlock_irq(&rtc_lock); 357 spin_unlock_irq(&rtc_lock);
370 358
371 irq = ELAPSEDTIME_IRQ; 359 aie_irq = platform_get_irq(pdev, 0);
372 retval = request_irq(irq, elapsedtime_interrupt, IRQF_DISABLED, 360 if (aie_irq < 0 || aie_irq >= NR_IRQS) {
373 "elapsed_time", pdev); 361 retval = -EBUSY;
374 if (retval == 0) { 362 goto err_device_unregister;
375 irq = RTCLONG1_IRQ;
376 retval = request_irq(irq, rtclong1_interrupt, IRQF_DISABLED,
377 "rtclong1", pdev);
378 } 363 }
379 364
380 if (retval < 0) { 365 retval = request_irq(aie_irq, elapsedtime_interrupt, IRQF_DISABLED,
381 printk(KERN_ERR "rtc: IRQ%d is busy\n", irq); 366 "elapsed_time", pdev);
382 rtc_device_unregister(rtc); 367 if (retval < 0)
383 if (irq == RTCLONG1_IRQ) 368 goto err_device_unregister;
384 free_irq(ELAPSEDTIME_IRQ, NULL); 369
385 iounmap(rtc1_base); 370 pie_irq = platform_get_irq(pdev, 1);
386 iounmap(rtc2_base); 371 if (pie_irq < 0 || pie_irq >= NR_IRQS)
387 rtc1_base = NULL; 372 goto err_free_irq;
388 rtc2_base = NULL; 373
389 return retval; 374 retval = request_irq(pie_irq, rtclong1_interrupt, IRQF_DISABLED,
390 } 375 "rtclong1", pdev);
376 if (retval < 0)
377 goto err_free_irq;
391 378
392 platform_set_drvdata(pdev, rtc); 379 platform_set_drvdata(pdev, rtc);
393 380
394 disable_irq(ELAPSEDTIME_IRQ); 381 disable_irq(aie_irq);
395 disable_irq(RTCLONG1_IRQ); 382 disable_irq(pie_irq);
396 383
397 printk(KERN_INFO "rtc: Real Time Clock of NEC VR4100 series\n"); 384 printk(KERN_INFO "rtc: Real Time Clock of NEC VR4100 series\n");
398 385
399 return 0; 386 return 0;
387
388err_free_irq:
389 free_irq(aie_irq, pdev);
390
391err_device_unregister:
392 rtc_device_unregister(rtc);
393
394err_iounmap_all:
395 iounmap(rtc2_base);
396 rtc2_base = NULL;
397
398err_rtc1_iounmap:
399 iounmap(rtc1_base);
400 rtc1_base = NULL;
401
402 return retval;
400} 403}
401 404
402static int __devexit rtc_remove(struct platform_device *pdev) 405static int __devexit rtc_remove(struct platform_device *pdev)
@@ -404,23 +407,21 @@ static int __devexit rtc_remove(struct platform_device *pdev)
404 struct rtc_device *rtc; 407 struct rtc_device *rtc;
405 408
406 rtc = platform_get_drvdata(pdev); 409 rtc = platform_get_drvdata(pdev);
407 if (rtc != NULL) 410 if (rtc)
408 rtc_device_unregister(rtc); 411 rtc_device_unregister(rtc);
409 412
410 platform_set_drvdata(pdev, NULL); 413 platform_set_drvdata(pdev, NULL);
411 414
412 free_irq(ELAPSEDTIME_IRQ, NULL); 415 free_irq(aie_irq, pdev);
413 free_irq(RTCLONG1_IRQ, NULL); 416 free_irq(pie_irq, pdev);
414 if (rtc1_base != NULL) 417 if (rtc1_base)
415 iounmap(rtc1_base); 418 iounmap(rtc1_base);
416 if (rtc2_base != NULL) 419 if (rtc2_base)
417 iounmap(rtc2_base); 420 iounmap(rtc2_base);
418 421
419 return 0; 422 return 0;
420} 423}
421 424
422static struct platform_device *rtc_platform_device;
423
424static struct platform_driver rtc_platform_driver = { 425static struct platform_driver rtc_platform_driver = {
425 .probe = rtc_probe, 426 .probe = rtc_probe,
426 .remove = __devexit_p(rtc_remove), 427 .remove = __devexit_p(rtc_remove),
@@ -432,55 +433,12 @@ static struct platform_driver rtc_platform_driver = {
432 433
433static int __init vr41xx_rtc_init(void) 434static int __init vr41xx_rtc_init(void)
434{ 435{
435 int retval; 436 return platform_driver_register(&rtc_platform_driver);
436
437 switch (current_cpu_data.cputype) {
438 case CPU_VR4111:
439 case CPU_VR4121:
440 rtc_resource[0].start = RTC1_TYPE1_START;
441 rtc_resource[0].end = RTC1_TYPE1_END;
442 rtc_resource[1].start = RTC2_TYPE1_START;
443 rtc_resource[1].end = RTC2_TYPE1_END;
444 break;
445 case CPU_VR4122:
446 case CPU_VR4131:
447 case CPU_VR4133:
448 rtc_resource[0].start = RTC1_TYPE2_START;
449 rtc_resource[0].end = RTC1_TYPE2_END;
450 rtc_resource[1].start = RTC2_TYPE2_START;
451 rtc_resource[1].end = RTC2_TYPE2_END;
452 break;
453 default:
454 return -ENODEV;
455 break;
456 }
457
458 rtc_platform_device = platform_device_alloc("RTC", -1);
459 if (rtc_platform_device == NULL)
460 return -ENOMEM;
461
462 retval = platform_device_add_resources(rtc_platform_device,
463 rtc_resource, ARRAY_SIZE(rtc_resource));
464
465 if (retval == 0)
466 retval = platform_device_add(rtc_platform_device);
467
468 if (retval < 0) {
469 platform_device_put(rtc_platform_device);
470 return retval;
471 }
472
473 retval = platform_driver_register(&rtc_platform_driver);
474 if (retval < 0)
475 platform_device_unregister(rtc_platform_device);
476
477 return retval;
478} 437}
479 438
480static void __exit vr41xx_rtc_exit(void) 439static void __exit vr41xx_rtc_exit(void)
481{ 440{
482 platform_driver_unregister(&rtc_platform_driver); 441 platform_driver_unregister(&rtc_platform_driver);
483 platform_device_unregister(rtc_platform_device);
484} 442}
485 443
486module_init(vr41xx_rtc_init); 444module_init(vr41xx_rtc_init);
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
index cf0e663b42ed..85309acb75f6 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/serial/vr41xx_siu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Driver for NEC VR4100 series Serial Interface Unit. 2 * Driver for NEC VR4100 series Serial Interface Unit.
3 * 3 *
4 * Copyright (C) 2004-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> 4 * Copyright (C) 2004-2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * Based on drivers/serial/8250.c, by Russell King. 6 * Based on drivers/serial/8250.c, by Russell King.
7 * 7 *
@@ -25,12 +25,12 @@
25#endif 25#endif
26 26
27#include <linux/console.h> 27#include <linux/console.h>
28#include <linux/platform_device.h> 28#include <linux/errno.h>
29#include <linux/err.h>
30#include <linux/ioport.h>
31#include <linux/init.h> 29#include <linux/init.h>
32#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/ioport.h>
33#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/platform_device.h>
34#include <linux/serial.h> 34#include <linux/serial.h>
35#include <linux/serial_core.h> 35#include <linux/serial_core.h>
36#include <linux/serial_reg.h> 36#include <linux/serial_reg.h>
@@ -38,11 +38,9 @@
38#include <linux/tty_flip.h> 38#include <linux/tty_flip.h>
39 39
40#include <asm/io.h> 40#include <asm/io.h>
41#include <asm/vr41xx/irq.h>
42#include <asm/vr41xx/siu.h> 41#include <asm/vr41xx/siu.h>
43#include <asm/vr41xx/vr41xx.h> 42#include <asm/vr41xx/vr41xx.h>
44 43
45#define SIU_PORTS_MAX 2
46#define SIU_BAUD_BASE 1152000 44#define SIU_BAUD_BASE 1152000
47#define SIU_MAJOR 204 45#define SIU_MAJOR 204
48#define SIU_MINOR_BASE 82 46#define SIU_MINOR_BASE 82
@@ -60,32 +58,13 @@
60 #define IRUSESEL 0x02 58 #define IRUSESEL 0x02
61 #define SIRSEL 0x01 59 #define SIRSEL 0x01
62 60
63struct siu_port { 61static struct uart_port siu_uart_ports[SIU_PORTS_MAX] = {
64 unsigned int type; 62 [0 ... SIU_PORTS_MAX-1] = {
65 unsigned int irq; 63 .lock = __SPIN_LOCK_UNLOCKED(siu_uart_ports->lock),
66 unsigned long start; 64 .irq = -1,
67}; 65 },
68
69static const struct siu_port siu_type1_ports[] = {
70 { .type = PORT_VR41XX_SIU,
71 .irq = SIU_IRQ,
72 .start = 0x0c000000UL, },
73};
74
75#define SIU_TYPE1_NR_PORTS (sizeof(siu_type1_ports) / sizeof(struct siu_port))
76
77static const struct siu_port siu_type2_ports[] = {
78 { .type = PORT_VR41XX_SIU,
79 .irq = SIU_IRQ,
80 .start = 0x0f000800UL, },
81 { .type = PORT_VR41XX_DSIU,
82 .irq = DSIU_IRQ,
83 .start = 0x0f000820UL, },
84}; 66};
85 67
86#define SIU_TYPE2_NR_PORTS (sizeof(siu_type2_ports) / sizeof(struct siu_port))
87
88static struct uart_port siu_uart_ports[SIU_PORTS_MAX];
89static uint8_t lsr_break_flag[SIU_PORTS_MAX]; 68static uint8_t lsr_break_flag[SIU_PORTS_MAX];
90 69
91#define siu_read(port, offset) readb((port)->membase + (offset)) 70#define siu_read(port, offset) readb((port)->membase + (offset))
@@ -110,7 +89,6 @@ void vr41xx_select_siu_interface(siu_interface_t interface)
110 89
111 spin_unlock_irqrestore(&port->lock, flags); 90 spin_unlock_irqrestore(&port->lock, flags);
112} 91}
113
114EXPORT_SYMBOL_GPL(vr41xx_select_siu_interface); 92EXPORT_SYMBOL_GPL(vr41xx_select_siu_interface);
115 93
116void vr41xx_use_irda(irda_use_t use) 94void vr41xx_use_irda(irda_use_t use)
@@ -132,7 +110,6 @@ void vr41xx_use_irda(irda_use_t use)
132 110
133 spin_unlock_irqrestore(&port->lock, flags); 111 spin_unlock_irqrestore(&port->lock, flags);
134} 112}
135
136EXPORT_SYMBOL_GPL(vr41xx_use_irda); 113EXPORT_SYMBOL_GPL(vr41xx_use_irda);
137 114
138void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed) 115void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed)
@@ -166,7 +143,6 @@ void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed)
166 143
167 spin_unlock_irqrestore(&port->lock, flags); 144 spin_unlock_irqrestore(&port->lock, flags);
168} 145}
169
170EXPORT_SYMBOL_GPL(vr41xx_select_irda_module); 146EXPORT_SYMBOL_GPL(vr41xx_select_irda_module);
171 147
172static inline void siu_clear_fifo(struct uart_port *port) 148static inline void siu_clear_fifo(struct uart_port *port)
@@ -177,21 +153,6 @@ static inline void siu_clear_fifo(struct uart_port *port)
177 siu_write(port, UART_FCR, 0); 153 siu_write(port, UART_FCR, 0);
178} 154}
179 155
180static inline int siu_probe_ports(void)
181{
182 switch (current_cpu_data.cputype) {
183 case CPU_VR4111:
184 case CPU_VR4121:
185 return SIU_TYPE1_NR_PORTS;
186 case CPU_VR4122:
187 case CPU_VR4131:
188 case CPU_VR4133:
189 return SIU_TYPE2_NR_PORTS;
190 }
191
192 return 0;
193}
194
195static inline unsigned long siu_port_size(struct uart_port *port) 156static inline unsigned long siu_port_size(struct uart_port *port)
196{ 157{
197 switch (port->type) { 158 switch (port->type) {
@@ -206,21 +167,10 @@ static inline unsigned long siu_port_size(struct uart_port *port)
206 167
207static inline unsigned int siu_check_type(struct uart_port *port) 168static inline unsigned int siu_check_type(struct uart_port *port)
208{ 169{
209 switch (current_cpu_data.cputype) { 170 if (port->line == 0)
210 case CPU_VR4111: 171 return PORT_VR41XX_SIU;
211 case CPU_VR4121: 172 if (port->line == 1 && port->irq != -1)
212 if (port->line == 0) 173 return PORT_VR41XX_DSIU;
213 return PORT_VR41XX_SIU;
214 break;
215 case CPU_VR4122:
216 case CPU_VR4131:
217 case CPU_VR4133:
218 if (port->line == 0)
219 return PORT_VR41XX_SIU;
220 else if (port->line == 1)
221 return PORT_VR41XX_DSIU;
222 break;
223 }
224 174
225 return PORT_UNKNOWN; 175 return PORT_UNKNOWN;
226} 176}
@@ -751,44 +701,34 @@ static struct uart_ops siu_uart_ops = {
751 .verify_port = siu_verify_port, 701 .verify_port = siu_verify_port,
752}; 702};
753 703
754static int siu_init_ports(void) 704static int siu_init_ports(struct platform_device *pdev)
755{ 705{
756 const struct siu_port *siu;
757 struct uart_port *port; 706 struct uart_port *port;
758 int i, num; 707 struct resource *res;
708 int *type = pdev->dev.platform_data;
709 int i;
759 710
760 switch (current_cpu_data.cputype) { 711 if (!type)
761 case CPU_VR4111:
762 case CPU_VR4121:
763 siu = siu_type1_ports;
764 break;
765 case CPU_VR4122:
766 case CPU_VR4131:
767 case CPU_VR4133:
768 siu = siu_type2_ports;
769 break;
770 default:
771 return 0; 712 return 0;
772 }
773 713
774 port = siu_uart_ports; 714 port = siu_uart_ports;
775 num = siu_probe_ports(); 715 for (i = 0; i < SIU_PORTS_MAX; i++) {
776 for (i = 0; i < num; i++) { 716 port->type = type[i];
777 spin_lock_init(&port->lock); 717 if (port->type == PORT_UNKNOWN)
778 port->irq = siu->irq; 718 continue;
719 port->irq = platform_get_irq(pdev, i);
779 port->uartclk = SIU_BAUD_BASE * 16; 720 port->uartclk = SIU_BAUD_BASE * 16;
780 port->fifosize = 16; 721 port->fifosize = 16;
781 port->regshift = 0; 722 port->regshift = 0;
782 port->iotype = UPIO_MEM; 723 port->iotype = UPIO_MEM;
783 port->flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; 724 port->flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
784 port->type = siu->type;
785 port->line = i; 725 port->line = i;
786 port->mapbase = siu->start; 726 res = platform_get_resource(pdev, IORESOURCE_MEM, i);
787 siu++; 727 port->mapbase = res->start;
788 port++; 728 port++;
789 } 729 }
790 730
791 return num; 731 return i;
792} 732}
793 733
794#ifdef CONFIG_SERIAL_VR41XX_CONSOLE 734#ifdef CONFIG_SERIAL_VR41XX_CONSOLE
@@ -883,13 +823,9 @@ static struct console siu_console = {
883static int __devinit siu_console_init(void) 823static int __devinit siu_console_init(void)
884{ 824{
885 struct uart_port *port; 825 struct uart_port *port;
886 int num, i; 826 int i;
887
888 num = siu_init_ports();
889 if (num <= 0)
890 return -ENODEV;
891 827
892 for (i = 0; i < num; i++) { 828 for (i = 0; i < SIU_PORTS_MAX; i++) {
893 port = &siu_uart_ports[i]; 829 port = &siu_uart_ports[i];
894 port->ops = &siu_uart_ops; 830 port->ops = &siu_uart_ops;
895 } 831 }
@@ -920,7 +856,7 @@ static int __devinit siu_probe(struct platform_device *dev)
920 struct uart_port *port; 856 struct uart_port *port;
921 int num, i, retval; 857 int num, i, retval;
922 858
923 num = siu_init_ports(); 859 num = siu_init_ports(dev);
924 if (num <= 0) 860 if (num <= 0)
925 return -ENODEV; 861 return -ENODEV;
926 862
@@ -998,8 +934,6 @@ static int siu_resume(struct platform_device *dev)
998 return 0; 934 return 0;
999} 935}
1000 936
1001static struct platform_device *siu_platform_device;
1002
1003static struct platform_driver siu_device_driver = { 937static struct platform_driver siu_device_driver = {
1004 .probe = siu_probe, 938 .probe = siu_probe,
1005 .remove = __devexit_p(siu_remove), 939 .remove = __devexit_p(siu_remove),
@@ -1013,29 +947,12 @@ static struct platform_driver siu_device_driver = {
1013 947
1014static int __init vr41xx_siu_init(void) 948static int __init vr41xx_siu_init(void)
1015{ 949{
1016 int retval; 950 return platform_driver_register(&siu_device_driver);
1017
1018 siu_platform_device = platform_device_alloc("SIU", -1);
1019 if (!siu_platform_device)
1020 return -ENOMEM;
1021
1022 retval = platform_device_add(siu_platform_device);
1023 if (retval < 0) {
1024 platform_device_put(siu_platform_device);
1025 return retval;
1026 }
1027
1028 retval = platform_driver_register(&siu_device_driver);
1029 if (retval < 0)
1030 platform_device_unregister(siu_platform_device);
1031
1032 return retval;
1033} 951}
1034 952
1035static void __exit vr41xx_siu_exit(void) 953static void __exit vr41xx_siu_exit(void)
1036{ 954{
1037 platform_driver_unregister(&siu_device_driver); 955 platform_driver_unregister(&siu_device_driver);
1038 platform_device_unregister(siu_platform_device);
1039} 956}
1040 957
1041module_init(vr41xx_siu_init); 958module_init(vr41xx_siu_init);
diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c
index 4fff61b32dcb..ed979f13908a 100644
--- a/drivers/tc/zs.c
+++ b/drivers/tc/zs.c
@@ -136,14 +136,14 @@ struct dec_serial *zs_chain; /* list of all channels */
136struct tty_struct zs_ttys[NUM_CHANNELS]; 136struct tty_struct zs_ttys[NUM_CHANNELS];
137 137
138#ifdef CONFIG_SERIAL_DEC_CONSOLE 138#ifdef CONFIG_SERIAL_DEC_CONSOLE
139static struct console sercons; 139static struct console zs_console;
140#endif 140#endif
141#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ 141#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \
142 !defined(MODULE) 142 !defined(MODULE)
143static unsigned long break_pressed; /* break, really ... */ 143static unsigned long break_pressed; /* break, really ... */
144#endif 144#endif
145 145
146static unsigned char zs_init_regs[16] = { 146static unsigned char zs_init_regs[16] __initdata = {
147 0, /* write 0 */ 147 0, /* write 0 */
148 0, /* write 1 */ 148 0, /* write 1 */
149 0, /* write 2 */ 149 0, /* write 2 */
@@ -383,7 +383,7 @@ static void receive_chars(struct dec_serial *info)
383 383
384#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ 384#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \
385 !defined(MODULE) 385 !defined(MODULE)
386 if (break_pressed && info->line == sercons.index) { 386 if (break_pressed && info->line == zs_console.index) {
387 /* Ignore the null char got when BREAK is removed. */ 387 /* Ignore the null char got when BREAK is removed. */
388 if (ch == 0) 388 if (ch == 0)
389 continue; 389 continue;
@@ -446,7 +446,7 @@ static void status_handle(struct dec_serial *info)
446 if ((stat & BRK_ABRT) && !(info->read_reg_zero & BRK_ABRT)) { 446 if ((stat & BRK_ABRT) && !(info->read_reg_zero & BRK_ABRT)) {
447#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ 447#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \
448 !defined(MODULE) 448 !defined(MODULE)
449 if (info->line == sercons.index) { 449 if (info->line == zs_console.index) {
450 if (!break_pressed) 450 if (!break_pressed)
451 break_pressed = jiffies; 451 break_pressed = jiffies;
452 } else 452 } else
@@ -1557,9 +1557,9 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
1557 } 1557 }
1558 1558
1559#ifdef CONFIG_SERIAL_DEC_CONSOLE 1559#ifdef CONFIG_SERIAL_DEC_CONSOLE
1560 if (sercons.cflag && sercons.index == line) { 1560 if (zs_console.cflag && zs_console.index == line) {
1561 tty->termios->c_cflag = sercons.cflag; 1561 tty->termios->c_cflag = zs_console.cflag;
1562 sercons.cflag = 0; 1562 zs_console.cflag = 0;
1563 change_speed(info); 1563 change_speed(info);
1564 } 1564 }
1565#endif 1565#endif
@@ -1581,7 +1581,7 @@ static void __init show_serial_version(void)
1581/* Initialize Z8530s zs_channels 1581/* Initialize Z8530s zs_channels
1582 */ 1582 */
1583 1583
1584static void probe_sccs(void) 1584static void __init probe_sccs(void)
1585{ 1585{
1586 struct dec_serial **pp; 1586 struct dec_serial **pp;
1587 int i, n, n_chips = 0, n_channels, chip, channel; 1587 int i, n, n_chips = 0, n_channels, chip, channel;
@@ -1923,7 +1923,7 @@ static struct tty_driver *serial_console_device(struct console *c, int *index)
1923 * - initialize the serial port 1923 * - initialize the serial port
1924 * Return non-zero if we didn't find a serial port. 1924 * Return non-zero if we didn't find a serial port.
1925 */ 1925 */
1926static int serial_console_setup(struct console *co, char *options) 1926static int __init serial_console_setup(struct console *co, char *options)
1927{ 1927{
1928 struct dec_serial *info; 1928 struct dec_serial *info;
1929 int baud = 9600; 1929 int baud = 9600;
@@ -2069,7 +2069,7 @@ static int serial_console_setup(struct console *co, char *options)
2069 return 0; 2069 return 0;
2070} 2070}
2071 2071
2072static struct console sercons = { 2072static struct console zs_console = {
2073 .name = "ttyS", 2073 .name = "ttyS",
2074 .write = serial_console_write, 2074 .write = serial_console_write,
2075 .device = serial_console_device, 2075 .device = serial_console_device,
@@ -2083,7 +2083,7 @@ static struct console sercons = {
2083 */ 2083 */
2084void __init zs_serial_console_init(void) 2084void __init zs_serial_console_init(void)
2085{ 2085{
2086 register_console(&sercons); 2086 register_console(&zs_console);
2087} 2087}
2088#endif /* ifdef CONFIG_SERIAL_DEC_CONSOLE */ 2088#endif /* ifdef CONFIG_SERIAL_DEC_CONSOLE */
2089 2089
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 12bcc1f9fba9..7ba92890ea13 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -212,7 +212,8 @@ static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
212 */ 212 */
213 if (__IS_LOW512(phys_addr) && __IS_LOW512(last_addr) && 213 if (__IS_LOW512(phys_addr) && __IS_LOW512(last_addr) &&
214 flags == _CACHE_UNCACHED) 214 flags == _CACHE_UNCACHED)
215 return (void __iomem *)CKSEG1ADDR(phys_addr); 215 return (void __iomem *)
216 (unsigned long)CKSEG1ADDR(phys_addr);
216 } 217 }
217 218
218 return __ioremap(offset, size, flags); 219 return __ioremap(offset, size, flags);
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index 3ca6a076124d..97102ebc54b1 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -24,7 +24,7 @@ static inline int irq_canonicalize(int irq)
24#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */ 24#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
25#endif 25#endif
26 26
27#ifdef CONFIG_MIPS_MT_SMTC 27#ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP
28/* 28/*
29 * Clear interrupt mask handling "backstop" if irq_hwmask 29 * Clear interrupt mask handling "backstop" if irq_hwmask
30 * entry so indicates. This implies that the ack() or end() 30 * entry so indicates. This implies that the ack() or end()
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h
index 706b3691f57e..18f47f1e8cd5 100644
--- a/include/asm-mips/mipsregs.h
+++ b/include/asm-mips/mipsregs.h
@@ -707,10 +707,10 @@ do { \
707 */ 707 */
708#define __read_64bit_c0_split(source, sel) \ 708#define __read_64bit_c0_split(source, sel) \
709({ \ 709({ \
710 unsigned long long val; \ 710 unsigned long long __val; \
711 unsigned long flags; \ 711 unsigned long __flags; \
712 \ 712 \
713 local_irq_save(flags); \ 713 local_irq_save(__flags); \
714 if (sel == 0) \ 714 if (sel == 0) \
715 __asm__ __volatile__( \ 715 __asm__ __volatile__( \
716 ".set\tmips64\n\t" \ 716 ".set\tmips64\n\t" \
@@ -719,7 +719,7 @@ do { \
719 "dsrl\t%M0, %M0, 32\n\t" \ 719 "dsrl\t%M0, %M0, 32\n\t" \
720 "dsrl\t%L0, %L0, 32\n\t" \ 720 "dsrl\t%L0, %L0, 32\n\t" \
721 ".set\tmips0" \ 721 ".set\tmips0" \
722 : "=r" (val)); \ 722 : "=r" (__val)); \
723 else \ 723 else \
724 __asm__ __volatile__( \ 724 __asm__ __volatile__( \
725 ".set\tmips64\n\t" \ 725 ".set\tmips64\n\t" \
@@ -728,17 +728,17 @@ do { \
728 "dsrl\t%M0, %M0, 32\n\t" \ 728 "dsrl\t%M0, %M0, 32\n\t" \
729 "dsrl\t%L0, %L0, 32\n\t" \ 729 "dsrl\t%L0, %L0, 32\n\t" \
730 ".set\tmips0" \ 730 ".set\tmips0" \
731 : "=r" (val)); \ 731 : "=r" (__val)); \
732 local_irq_restore(flags); \ 732 local_irq_restore(__flags); \
733 \ 733 \
734 val; \ 734 __val; \
735}) 735})
736 736
737#define __write_64bit_c0_split(source, sel, val) \ 737#define __write_64bit_c0_split(source, sel, val) \
738do { \ 738do { \
739 unsigned long flags; \ 739 unsigned long __flags; \
740 \ 740 \
741 local_irq_save(flags); \ 741 local_irq_save(__flags); \
742 if (sel == 0) \ 742 if (sel == 0) \
743 __asm__ __volatile__( \ 743 __asm__ __volatile__( \
744 ".set\tmips64\n\t" \ 744 ".set\tmips64\n\t" \
@@ -759,7 +759,7 @@ do { \
759 "dmtc0\t%L0, " #source ", " #sel "\n\t" \ 759 "dmtc0\t%L0, " #source ", " #sel "\n\t" \
760 ".set\tmips0" \ 760 ".set\tmips0" \
761 : : "r" (val)); \ 761 : : "r" (val)); \
762 local_irq_restore(flags); \ 762 local_irq_restore(__flags); \
763} while (0) 763} while (0)
764 764
765#define read_c0_index() __read_32bit_c0_register($0, 0) 765#define read_c0_index() __read_32bit_c0_register($0, 0)
diff --git a/include/asm-mips/rtc.h b/include/asm-mips/rtc.h
deleted file mode 100644
index 82ad401c7dca..000000000000
--- a/include/asm-mips/rtc.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * include/asm-mips/rtc.h
3 *
4 * (Really an interface for drivers/char/genrtc.c)
5 *
6 * Copyright (C) 2004 MontaVista Software Inc.
7 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
8 *
9 * Please read the COPYING file for all license details.
10 */
11
12#ifndef _MIPS_RTC_H
13#define _MIPS_RTC_H
14
15#ifdef __KERNEL__
16
17#include <linux/rtc.h>
18#include <asm/time.h>
19
20#define RTC_PIE 0x40 /* periodic interrupt enable */
21#define RTC_AIE 0x20 /* alarm interrupt enable */
22#define RTC_UIE 0x10 /* update-finished interrupt enable */
23
24/* some dummy definitions */
25#define RTC_BATT_BAD 0x100 /* battery bad */
26#define RTC_SQWE 0x08 /* enable square-wave output */
27#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */
28#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
29#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
30
31static inline unsigned int get_rtc_time(struct rtc_time *time)
32{
33 unsigned long nowtime;
34
35 nowtime = rtc_mips_get_time();
36 to_tm(nowtime, time);
37 time->tm_year -= 1900;
38
39 return RTC_24H;
40}
41
42static inline int set_rtc_time(struct rtc_time *time)
43{
44 unsigned long nowtime;
45 int ret;
46
47 nowtime = mktime(time->tm_year+1900, time->tm_mon+1,
48 time->tm_mday, time->tm_hour, time->tm_min,
49 time->tm_sec);
50 ret = rtc_mips_set_time(nowtime);
51
52 return ret;
53}
54
55static inline unsigned int get_rtc_ss(void)
56{
57 struct rtc_time h;
58
59 get_rtc_time(&h);
60 return h.tm_sec;
61}
62
63static inline int get_rtc_pll(struct rtc_pll_info *pll)
64{
65 return -EINVAL;
66}
67
68static inline int set_rtc_pll(struct rtc_pll_info *pll)
69{
70 return -EINVAL;
71}
72#endif
73#endif
diff --git a/include/asm-mips/tlbdebug.h b/include/asm-mips/tlbdebug.h
index fff7a73e22d0..bb8f5c29c3d9 100644
--- a/include/asm-mips/tlbdebug.h
+++ b/include/asm-mips/tlbdebug.h
@@ -11,10 +11,6 @@
11/* 11/*
12 * TLB debugging functions: 12 * TLB debugging functions:
13 */ 13 */
14extern void dump_tlb(int first, int last);
15extern void dump_tlb_all(void); 14extern void dump_tlb_all(void);
16extern void dump_tlb_wired(void);
17extern void dump_tlb_addr(unsigned long addr);
18extern void dump_tlb_nonwired(void);
19 15
20#endif /* __ASM_TLBDEBUG_H */ 16#endif /* __ASM_TLBDEBUG_H */
diff --git a/include/asm-mips/vr41xx/giu.h b/include/asm-mips/vr41xx/giu.h
index 8109cda557dc..0bcdd3a5c256 100644
--- a/include/asm-mips/vr41xx/giu.h
+++ b/include/asm-mips/vr41xx/giu.h
@@ -20,6 +20,15 @@
20#ifndef __NEC_VR41XX_GIU_H 20#ifndef __NEC_VR41XX_GIU_H
21#define __NEC_VR41XX_GIU_H 21#define __NEC_VR41XX_GIU_H
22 22
23/*
24 * NEC VR4100 series GIU platform device IDs.
25 */
26enum {
27 GPIO_50PINS_PULLUPDOWN,
28 GPIO_36PINS,
29 GPIO_48PINS_EDGE_SELECT,
30};
31
23typedef enum { 32typedef enum {
24 IRQ_TRIGGER_LEVEL, 33 IRQ_TRIGGER_LEVEL,
25 IRQ_TRIGGER_EDGE, 34 IRQ_TRIGGER_EDGE,
diff --git a/include/asm-mips/vr41xx/siu.h b/include/asm-mips/vr41xx/siu.h
index 1fcf6e8082b4..98cdb4096485 100644
--- a/include/asm-mips/vr41xx/siu.h
+++ b/include/asm-mips/vr41xx/siu.h
@@ -20,6 +20,8 @@
20#ifndef __NEC_VR41XX_SIU_H 20#ifndef __NEC_VR41XX_SIU_H
21#define __NEC_VR41XX_SIU_H 21#define __NEC_VR41XX_SIU_H
22 22
23#define SIU_PORTS_MAX 2
24
23typedef enum { 25typedef enum {
24 SIU_INTERFACE_RS232C, 26 SIU_INTERFACE_RS232C,
25 SIU_INTERFACE_IRDA, 27 SIU_INTERFACE_IRDA,