aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-04 16:15:00 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-04 16:15:00 -0500
commit2c89a8d09f03bc569d3237d97e2293d67c36d75d (patch)
treede7527695c28e89d5e1c6f679e086b6a182bdc0e /arch
parente9cdb1e330d805f4453c1359cebe2bd6a06ce692 (diff)
parent8b4ac6f316b493fae511921e25c72119f7b03170 (diff)
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: [MIPS] MTX1: clear PCI errors [MIPS] MTX1: add idsel cardbus ressources [MIPS] MTX1: remove unneeded settings [MIPS] dma_sync_sg_for_cpu is a no-op except for non-coherent R10000s. [MIPS] Cobalt: update reserved resources [MIPS] SN: PCI fixup needs to include <irq.h>. [MIPS] DMA: Fix a bunch of warnings due to missing inline keywords. [MIPS] RM: It should be #ifdef CONFIG_FOO not #if CONFIG_FOO ... [MIPS] Fix and cleanup the mess that a dozen prom_printf variants are. [MIPS] DEC: Remove redeclarations of mips_machgroup and mips_machtype. [MIPS] No need to write c0_compare in plat_timer_setup [MIPS] Convert to RTC-class ds1742 driver [MIPS] Oprofile: Add missing break statements. [MIPS] jmr3927: build fix [MIPS] SNI: Fix mc146818_decode_year [MIPS] Replace sys32_timer_create with the generic compat_sys_timer_create. [MIPS] Replace sys32_socketcall with the generic compat_sys_socketcall. [MIPS] N32 waitid is the same as o32.
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/Kconfig35
-rw-r--r--arch/mips/arc/console.c32
-rw-r--r--arch/mips/arc/init.c9
-rw-r--r--arch/mips/arc/memory.c6
-rw-r--r--arch/mips/arc/tree.c10
-rw-r--r--arch/mips/au1000/mtx-1/board_setup.c33
-rw-r--r--arch/mips/au1000/mtx-1/irqmap.c2
-rw-r--r--arch/mips/cobalt/console.c26
-rw-r--r--arch/mips/cobalt/setup.c51
-rw-r--r--arch/mips/configs/jmr3927_defconfig24
-rw-r--r--arch/mips/dec/prom/console.c38
-rw-r--r--arch/mips/dec/prom/identify.c3
-rw-r--r--arch/mips/gt64120/ev64120/promcon.c5
-rw-r--r--arch/mips/jmr3927/common/Makefile2
-rw-r--r--arch/mips/jmr3927/common/rtc_ds1742.c171
-rw-r--r--arch/mips/jmr3927/rbhma3100/setup.c39
-rw-r--r--arch/mips/kernel/Makefile1
-rw-r--r--arch/mips/kernel/early_printk.c40
-rw-r--r--arch/mips/kernel/linux32.c173
-rw-r--r--arch/mips/kernel/scall64-n32.S4
-rw-r--r--arch/mips/kernel/scall64-o32.S4
-rw-r--r--arch/mips/kernel/setup.c8
-rw-r--r--arch/mips/lasat/lasat_board.c13
-rw-r--r--arch/mips/lasat/prom.c47
-rw-r--r--arch/mips/lasat/prom.h1
-rw-r--r--arch/mips/lasat/setup.c3
-rw-r--r--arch/mips/lib/Makefile4
-rw-r--r--arch/mips/lib/promlib.c24
-rw-r--r--arch/mips/mips-boards/generic/Makefile4
-rw-r--r--arch/mips/mips-boards/generic/console.c (renamed from arch/mips/mips-boards/generic/printf.c)12
-rw-r--r--arch/mips/mips-boards/generic/init.c9
-rw-r--r--arch/mips/mips-boards/generic/memory.c11
-rw-r--r--arch/mips/mips-boards/generic/time.c3
-rw-r--r--arch/mips/mips-boards/sim/Makefile6
-rw-r--r--arch/mips/mips-boards/sim/sim_console.c (renamed from arch/mips/mips-boards/sim/sim_printf.c)44
-rw-r--r--arch/mips/mips-boards/sim/sim_mem.c2
-rw-r--r--arch/mips/mips-boards/sim/sim_setup.c6
-rw-r--r--arch/mips/mips-boards/sim/sim_time.c3
-rw-r--r--arch/mips/mm/cerr-sb1.c124
-rw-r--r--arch/mips/mm/dma-default.c2
-rw-r--r--arch/mips/momentum/jaguar_atx/ja-console.c5
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c2
-rw-r--r--arch/mips/pci/fixup-jmr3927.c14
-rw-r--r--arch/mips/pci/fixup-sni.c2
-rw-r--r--arch/mips/pci/ops-au1000.c6
-rw-r--r--arch/mips/philips/pnx8550/common/prom.c2
-rw-r--r--arch/mips/philips/pnx8550/common/setup.c9
-rw-r--r--arch/mips/pmc-sierra/yosemite/py-console.c5
-rw-r--r--arch/mips/sgi-ip27/ip27-console.c35
-rw-r--r--arch/mips/sibyte/Kconfig2
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c2
-rw-r--r--arch/mips/sibyte/bcm1480/setup.c10
-rw-r--r--arch/mips/sibyte/cfe/setup.c8
-rw-r--r--arch/mips/sibyte/sb1250/setup.c24
-rw-r--r--arch/mips/sni/sniprom.c51
-rw-r--r--arch/mips/tx4927/common/tx4927_setup.c10
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c3
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c76
-rw-r--r--arch/mips/tx4938/common/setup.c9
59 files changed, 395 insertions, 914 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 71729d0f013..4ec2dd5455f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -176,7 +176,7 @@ config MACH_DECSTATION
176 bool "DECstations" 176 bool "DECstations"
177 select BOOT_ELF32 177 select BOOT_ELF32
178 select DMA_NONCOHERENT 178 select DMA_NONCOHERENT
179 select EARLY_PRINTK 179 select SYS_HAS_EARLY_PRINTK
180 select IRQ_CPU 180 select IRQ_CPU
181 select SYS_HAS_CPU_R3000 181 select SYS_HAS_CPU_R3000
182 select SYS_HAS_CPU_R4X00 182 select SYS_HAS_CPU_R4X00
@@ -242,6 +242,7 @@ config MACH_JAZZ
242config LASAT 242config LASAT
243 bool "LASAT Networks platforms" 243 bool "LASAT Networks platforms"
244 select DMA_NONCOHERENT 244 select DMA_NONCOHERENT
245 select SYS_HAS_EARLY_PRINTK
245 select HW_HAS_PCI 246 select HW_HAS_PCI
246 select MIPS_GT64120 247 select MIPS_GT64120
247 select MIPS_NILE4 248 select MIPS_NILE4
@@ -256,6 +257,7 @@ config MIPS_ATLAS
256 bool "MIPS Atlas board" 257 bool "MIPS Atlas board"
257 select BOOT_ELF32 258 select BOOT_ELF32
258 select DMA_NONCOHERENT 259 select DMA_NONCOHERENT
260 select SYS_HAS_EARLY_PRINTK
259 select IRQ_CPU 261 select IRQ_CPU
260 select HW_HAS_PCI 262 select HW_HAS_PCI
261 select MIPS_BOARDS_GEN 263 select MIPS_BOARDS_GEN
@@ -301,6 +303,7 @@ config MIPS_MALTA
301 select SYS_HAS_CPU_MIPS64_R1 303 select SYS_HAS_CPU_MIPS64_R1
302 select SYS_HAS_CPU_NEVADA 304 select SYS_HAS_CPU_NEVADA
303 select SYS_HAS_CPU_RM7000 305 select SYS_HAS_CPU_RM7000
306 select SYS_HAS_EARLY_PRINTK
304 select SYS_SUPPORTS_32BIT_KERNEL 307 select SYS_SUPPORTS_32BIT_KERNEL
305 select SYS_SUPPORTS_64BIT_KERNEL 308 select SYS_SUPPORTS_64BIT_KERNEL
306 select SYS_SUPPORTS_BIG_ENDIAN 309 select SYS_SUPPORTS_BIG_ENDIAN
@@ -316,6 +319,7 @@ config MIPS_SEAD
316 depends on EXPERIMENTAL 319 depends on EXPERIMENTAL
317 select IRQ_CPU 320 select IRQ_CPU
318 select DMA_NONCOHERENT 321 select DMA_NONCOHERENT
322 select SYS_HAS_EARLY_PRINTK
319 select MIPS_BOARDS_GEN 323 select MIPS_BOARDS_GEN
320 select SYS_HAS_CPU_MIPS32_R1 324 select SYS_HAS_CPU_MIPS32_R1
321 select SYS_HAS_CPU_MIPS32_R2 325 select SYS_HAS_CPU_MIPS32_R2
@@ -353,9 +357,11 @@ config WR_PPMC
353config MIPS_SIM 357config MIPS_SIM
354 bool 'MIPS simulator (MIPSsim)' 358 bool 'MIPS simulator (MIPSsim)'
355 select DMA_NONCOHERENT 359 select DMA_NONCOHERENT
360 select SYS_HAS_EARLY_PRINTK
356 select IRQ_CPU 361 select IRQ_CPU
357 select SYS_HAS_CPU_MIPS32_R1 362 select SYS_HAS_CPU_MIPS32_R1
358 select SYS_HAS_CPU_MIPS32_R2 363 select SYS_HAS_CPU_MIPS32_R2
364 select SYS_HAS_EARLY_PRINTK
359 select SYS_SUPPORTS_32BIT_KERNEL 365 select SYS_SUPPORTS_32BIT_KERNEL
360 select SYS_SUPPORTS_BIG_ENDIAN 366 select SYS_SUPPORTS_BIG_ENDIAN
361 select SYS_SUPPORTS_LITTLE_ENDIAN 367 select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -376,6 +382,7 @@ config MOMENCO_JAGUAR_ATX
376 select RM7000_CPU_SCACHE 382 select RM7000_CPU_SCACHE
377 select SWAP_IO_SPACE 383 select SWAP_IO_SPACE
378 select SYS_HAS_CPU_RM9000 384 select SYS_HAS_CPU_RM9000
385 select SYS_HAS_EARLY_PRINTK
379 select SYS_SUPPORTS_32BIT_KERNEL 386 select SYS_SUPPORTS_32BIT_KERNEL
380 select SYS_SUPPORTS_64BIT_KERNEL 387 select SYS_SUPPORTS_64BIT_KERNEL
381 select SYS_SUPPORTS_BIG_ENDIAN 388 select SYS_SUPPORTS_BIG_ENDIAN
@@ -513,6 +520,7 @@ config PMC_YOSEMITE
513 select IRQ_CPU_RM9K 520 select IRQ_CPU_RM9K
514 select SWAP_IO_SPACE 521 select SWAP_IO_SPACE
515 select SYS_HAS_CPU_RM9000 522 select SYS_HAS_CPU_RM9000
523 select SYS_HAS_EARLY_PRINTK
516 select SYS_SUPPORTS_32BIT_KERNEL 524 select SYS_SUPPORTS_32BIT_KERNEL
517 select SYS_SUPPORTS_64BIT_KERNEL 525 select SYS_SUPPORTS_64BIT_KERNEL
518 select SYS_SUPPORTS_BIG_ENDIAN 526 select SYS_SUPPORTS_BIG_ENDIAN
@@ -573,6 +581,7 @@ config SGI_IP22
573 select SWAP_IO_SPACE 581 select SWAP_IO_SPACE
574 select SYS_HAS_CPU_R4X00 582 select SYS_HAS_CPU_R4X00
575 select SYS_HAS_CPU_R5000 583 select SYS_HAS_CPU_R5000
584 select SYS_HAS_EARLY_PRINTK
576 select SYS_SUPPORTS_32BIT_KERNEL 585 select SYS_SUPPORTS_32BIT_KERNEL
577 select SYS_SUPPORTS_64BIT_KERNEL 586 select SYS_SUPPORTS_64BIT_KERNEL
578 select SYS_SUPPORTS_BIG_ENDIAN 587 select SYS_SUPPORTS_BIG_ENDIAN
@@ -587,7 +596,7 @@ config SGI_IP27
587 select ARC64 596 select ARC64
588 select BOOT_ELF64 597 select BOOT_ELF64
589 select DMA_IP27 598 select DMA_IP27
590 select EARLY_PRINTK 599 select SYS_HAS_EARLY_PRINTK
591 select HW_HAS_PCI 600 select HW_HAS_PCI
592 select NR_CPUS_DEFAULT_64 601 select NR_CPUS_DEFAULT_64
593 select PCI_DOMAINS 602 select PCI_DOMAINS
@@ -749,6 +758,7 @@ config SNI_RM
749 select SYS_HAS_CPU_R5000 758 select SYS_HAS_CPU_R5000
750 select SYS_HAS_CPU_R10000 759 select SYS_HAS_CPU_R10000
751 select R5000_CPU_SCACHE 760 select R5000_CPU_SCACHE
761 select SYS_HAS_EARLY_PRINTK
752 select SYS_SUPPORTS_32BIT_KERNEL 762 select SYS_SUPPORTS_32BIT_KERNEL
753 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL 763 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
754 select SYS_SUPPORTS_BIG_ENDIAN 764 select SYS_SUPPORTS_BIG_ENDIAN
@@ -897,6 +907,20 @@ config DMA_NEED_PCI_MAP_STATE
897 bool 907 bool
898 908
899config EARLY_PRINTK 909config EARLY_PRINTK
910 bool "Early printk" if EMBEDDED && DEBUG_KERNEL
911 depends on SYS_HAS_EARLY_PRINTK
912 default y
913 help
914 This option enables special console drivers which allow the kernel
915 to print messages very early in the bootup process.
916
917 This is useful for kernel debugging when your machine crashes very
918 early before the console code is initialized. For normal operation
919 it is not recommended because it looks on some machines ugly and
920 oesn't cooperate with an X server. You should normally N here,
921 unless you want to debug such a crash.
922
923config SYS_HAS_EARLY_PRINTK
900 bool 924 bool
901 925
902config GENERIC_ISA_DMA 926config GENERIC_ISA_DMA
@@ -1033,6 +1057,7 @@ config SOC_PNX8550
1033 select DMA_NONCOHERENT 1057 select DMA_NONCOHERENT
1034 select HW_HAS_PCI 1058 select HW_HAS_PCI
1035 select SYS_HAS_CPU_MIPS32_R1 1059 select SYS_HAS_CPU_MIPS32_R1
1060 select SYS_HAS_EARLY_PRINTK
1036 select SYS_SUPPORTS_32BIT_KERNEL 1061 select SYS_SUPPORTS_32BIT_KERNEL
1037 select GENERIC_HARDIRQS_NO__DO_IRQ 1062 select GENERIC_HARDIRQS_NO__DO_IRQ
1038 select SYS_SUPPORTS_KGDB 1063 select SYS_SUPPORTS_KGDB
@@ -1093,7 +1118,7 @@ config HAVE_STD_PC_SERIAL_PORT
1093 1118
1094config ARC_CONSOLE 1119config ARC_CONSOLE
1095 bool "ARC console support" 1120 bool "ARC console support"
1096 depends on SGI_IP22 || SNI_RM 1121 depends on SGI_IP22 || (SNI_RM && CPU_LITTLE_ENDIAN)
1097 1122
1098config ARC_MEMORY 1123config ARC_MEMORY
1099 bool 1124 bool
@@ -1895,10 +1920,6 @@ config HZ
1895 1920
1896source "kernel/Kconfig.preempt" 1921source "kernel/Kconfig.preempt"
1897 1922
1898config RTC_DS1742
1899 bool "DS1742 BRAM/RTC support"
1900 depends on TOSHIBA_JMR3927 || TOSHIBA_RBTX4927
1901
1902config MIPS_INSANE_LARGE 1923config MIPS_INSANE_LARGE
1903 bool "Support for large 64-bit configurations" 1924 bool "Support for large 64-bit configurations"
1904 depends on CPU_R10000 && 64BIT 1925 depends on CPU_R10000 && 64BIT
diff --git a/arch/mips/arc/console.c b/arch/mips/arc/console.c
index 6a9d144512c..0fe6032999c 100644
--- a/arch/mips/arc/console.c
+++ b/arch/mips/arc/console.c
@@ -29,35 +29,3 @@ void prom_putchar(char c)
29 ArcWrite(1, &it, 1, &cnt); 29 ArcWrite(1, &it, 1, &cnt);
30 bc_enable(); 30 bc_enable();
31} 31}
32
33char prom_getchar(void)
34{
35 ULONG cnt;
36 CHAR c;
37
38 bc_disable();
39 ArcRead(0, &c, 1, &cnt);
40 bc_enable();
41
42 return c;
43}
44
45void prom_printf(char *fmt, ...)
46{
47 va_list args;
48 char ppbuf[1024];
49 char *bptr;
50
51 va_start(args, fmt);
52 vsprintf(ppbuf, fmt, args);
53
54 bptr = ppbuf;
55
56 while (*bptr != 0) {
57 if (*bptr == '\n')
58 prom_putchar('\r');
59
60 prom_putchar(*bptr++);
61 }
62 va_end(args);
63}
diff --git a/arch/mips/arc/init.c b/arch/mips/arc/init.c
index 76ab505ca69..0ac8f42d375 100644
--- a/arch/mips/arc/init.c
+++ b/arch/mips/arc/init.c
@@ -24,12 +24,15 @@ void __init prom_init(void)
24{ 24{
25 PSYSTEM_PARAMETER_BLOCK pb = PROMBLOCK; 25 PSYSTEM_PARAMETER_BLOCK pb = PROMBLOCK;
26 romvec = ROMVECTOR; 26 romvec = ROMVECTOR;
27 ULONG cnt;
28 CHAR c;
29
27 prom_argc = fw_arg0; 30 prom_argc = fw_arg0;
28 _prom_argv = (LONG *) fw_arg1; 31 _prom_argv = (LONG *) fw_arg1;
29 _prom_envp = (LONG *) fw_arg2; 32 _prom_envp = (LONG *) fw_arg2;
30 33
31 if (pb->magic != 0x53435241) { 34 if (pb->magic != 0x53435241) {
32 prom_printf("Aieee, bad prom vector magic %08lx\n", pb->magic); 35 printk(KERN_CRIT "Aieee, bad prom vector magic %08lx\n", pb->magic);
33 while(1) 36 while(1)
34 ; 37 ;
35 } 38 }
@@ -41,8 +44,8 @@ void __init prom_init(void)
41 prom_meminit(); 44 prom_meminit();
42 45
43#ifdef DEBUG_PROM_INIT 46#ifdef DEBUG_PROM_INIT
44 prom_printf("Press a key to reboot\n"); 47 pr_info("Press a key to reboot\n");
45 prom_getchar(); 48 ArcRead(0, &c, 1, &cnt);
46 ArcEnterInteractiveMode(); 49 ArcEnterInteractiveMode();
47#endif 50#endif
48} 51}
diff --git a/arch/mips/arc/memory.c b/arch/mips/arc/memory.c
index 456cb81a32d..83d15791ef6 100644
--- a/arch/mips/arc/memory.c
+++ b/arch/mips/arc/memory.c
@@ -118,11 +118,11 @@ void __init prom_meminit(void)
118#ifdef DEBUG 118#ifdef DEBUG
119 int i = 0; 119 int i = 0;
120 120
121 prom_printf("ARCS MEMORY DESCRIPTOR dump:\n"); 121 printk("ARCS MEMORY DESCRIPTOR dump:\n");
122 p = ArcGetMemoryDescriptor(PROM_NULL_MDESC); 122 p = ArcGetMemoryDescriptor(PROM_NULL_MDESC);
123 while(p) { 123 while(p) {
124 prom_printf("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n", 124 printk("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n",
125 i, p, p->base, p->pages, mtypes(p->type)); 125 i, p, p->base, p->pages, mtypes(p->type));
126 p = ArcGetMemoryDescriptor(p); 126 p = ArcGetMemoryDescriptor(p);
127 i++; 127 i++;
128 } 128 }
diff --git a/arch/mips/arc/tree.c b/arch/mips/arc/tree.c
index 2aedd4f5283..abd1786ea09 100644
--- a/arch/mips/arc/tree.c
+++ b/arch/mips/arc/tree.c
@@ -93,11 +93,11 @@ static char *iflags[] = {
93static void __init 93static void __init
94dump_component(pcomponent *p) 94dump_component(pcomponent *p)
95{ 95{
96 prom_printf("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>", 96 printk("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",
97 p, classes[p->class], types[p->type], 97 p, classes[p->class], types[p->type],
98 iflags[p->iflags], p->vers, p->rev); 98 iflags[p->iflags], p->vers, p->rev);
99 prom_printf("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n", 99 printk("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n",
100 p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname); 100 p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);
101} 101}
102 102
103static void __init 103static void __init
diff --git a/arch/mips/au1000/mtx-1/board_setup.c b/arch/mips/au1000/mtx-1/board_setup.c
index 13f9bf5f91a..7bc5af8917d 100644
--- a/arch/mips/au1000/mtx-1/board_setup.c
+++ b/arch/mips/au1000/mtx-1/board_setup.c
@@ -43,6 +43,9 @@
43#include <asm/pgtable.h> 43#include <asm/pgtable.h>
44#include <asm/mach-au1x00/au1000.h> 44#include <asm/mach-au1x00/au1000.h>
45 45
46extern int (*board_pci_idsel)(unsigned int devsel, int assert);
47int mtx1_pci_idsel(unsigned int devsel, int assert);
48
46void board_reset (void) 49void board_reset (void)
47{ 50{
48 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 51 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
@@ -66,19 +69,43 @@ void __init board_setup(void)
66#endif 69#endif
67 70
68 // initialize sys_pinfunc: 71 // initialize sys_pinfunc:
69 // disable second ethernet port (SYS_PF_NI2) 72 au_writel( SYS_PF_NI2, SYS_PINFUNC );
70 // set U3/GPIO23 to GPIO23 (SYS_PF_U3)
71 au_writel( SYS_PF_NI2 | SYS_PF_U3, SYS_PINFUNC );
72 73
73 // initialize GPIO 74 // initialize GPIO
74 au_writel( 0xFFFFFFFF, SYS_TRIOUTCLR ); 75 au_writel( 0xFFFFFFFF, SYS_TRIOUTCLR );
75 au_writel( 0x00000001, SYS_OUTPUTCLR ); // set M66EN (PCI 66MHz) to OFF 76 au_writel( 0x00000001, SYS_OUTPUTCLR ); // set M66EN (PCI 66MHz) to OFF
76 au_writel( 0x00000008, SYS_OUTPUTSET ); // set PCI CLKRUN# to OFF 77 au_writel( 0x00000008, SYS_OUTPUTSET ); // set PCI CLKRUN# to OFF
78 au_writel( 0x00000002, SYS_OUTPUTSET ); // set EXT_IO3 ON
77 au_writel( 0x00000020, SYS_OUTPUTCLR ); // set eth PHY TX_ER to OFF 79 au_writel( 0x00000020, SYS_OUTPUTCLR ); // set eth PHY TX_ER to OFF
78 80
79 // enable LED and set it to green 81 // enable LED and set it to green
80 au_writel( au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR ); 82 au_writel( au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR );
81 au_writel( 0x18000800, GPIO2_OUTPUT ); 83 au_writel( 0x18000800, GPIO2_OUTPUT );
82 84
85 board_pci_idsel = mtx1_pci_idsel;
86
83 printk("4G Systems MTX-1 Board\n"); 87 printk("4G Systems MTX-1 Board\n");
84} 88}
89
90int
91mtx1_pci_idsel(unsigned int devsel, int assert)
92{
93#define MTX_IDSEL_ONLY_0_AND_3 0
94#if MTX_IDSEL_ONLY_0_AND_3
95 if (devsel != 0 && devsel != 3) {
96 printk("*** not 0 or 3\n");
97 return 0;
98 }
99#endif
100
101 if (assert && devsel != 0) {
102 // supress signal to cardbus
103 au_writel( 0x00000002, SYS_OUTPUTCLR ); // set EXT_IO3 OFF
104 }
105 else {
106 au_writel( 0x00000002, SYS_OUTPUTSET ); // set EXT_IO3 ON
107 }
108 au_sync_udelay(1);
109 return 1;
110}
111
diff --git a/arch/mips/au1000/mtx-1/irqmap.c b/arch/mips/au1000/mtx-1/irqmap.c
index 4693a4eb2b8..a4fa0f227e4 100644
--- a/arch/mips/au1000/mtx-1/irqmap.c
+++ b/arch/mips/au1000/mtx-1/irqmap.c
@@ -48,7 +48,7 @@
48#include <asm/mach-au1x00/au1000.h> 48#include <asm/mach-au1x00/au1000.h>
49 49
50char irq_tab_alchemy[][5] __initdata = { 50char irq_tab_alchemy[][5] __initdata = {
51 [0] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 00 - AdapterA-Slot0 (top) */ 51 [0] = { -1, INTA, INTA, INTX, INTX}, /* IDSEL 00 - AdapterA-Slot0 (top) */
52 [1] = { -1, INTB, INTA, INTX, INTX}, /* IDSEL 01 - AdapterA-Slot1 (bottom) */ 52 [1] = { -1, INTB, INTA, INTX, INTX}, /* IDSEL 01 - AdapterA-Slot1 (bottom) */
53 [2] = { -1, INTC, INTD, INTX, INTX}, /* IDSEL 02 - AdapterB-Slot0 (top) */ 53 [2] = { -1, INTC, INTD, INTX, INTX}, /* IDSEL 02 - AdapterB-Slot0 (top) */
54 [3] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 03 - AdapterB-Slot1 (bottom) */ 54 [3] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 03 - AdapterB-Slot1 (bottom) */
diff --git a/arch/mips/cobalt/console.c b/arch/mips/cobalt/console.c
index 46c23b66bc1..fff20d28114 100644
--- a/arch/mips/cobalt/console.c
+++ b/arch/mips/cobalt/console.c
@@ -19,29 +19,3 @@ static void putchar(int c)
19 19
20 COBALT_UART[UART_TX] = c; 20 COBALT_UART[UART_TX] = c;
21} 21}
22
23static void cons_write(struct console *c, const char *s, unsigned n)
24{
25 while(n-- && *s)
26 putchar(*s++);
27}
28
29static struct console cons_info =
30{
31 .name = "uart",
32 .write = cons_write,
33 .flags = CON_PRINTBUFFER | CON_BOOT,
34 .index = -1,
35};
36
37void __init cobalt_early_console(void)
38{
39 register_console(&cons_info);
40
41 printk("Cobalt: early console registered\n");
42}
43
44void __init disable_early_printk(void)
45{
46 unregister_console(&cons_info);
47}
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index 415ff8710b5..88d34f11385 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -79,37 +79,38 @@ static struct resource cobalt_io_resource = {
79 .flags = IORESOURCE_IO 79 .flags = IORESOURCE_IO
80}; 80};
81 81
82static struct resource cobalt_io_resources[] = { 82/*
83 { 83 * Cobalt doesn't have PS/2 keyboard/mouse interfaces,
84 * keyboard conntroller is never used.
85 * Also PCI-ISA bridge DMA contoroller is never used.
86 */
87static struct resource cobalt_reserved_resources[] = {
88 { /* dma1 */
84 .start = 0x00, 89 .start = 0x00,
85 .end = 0x1f, 90 .end = 0x1f,
86 .name = "dma1", 91 .name = "reserved",
87 .flags = IORESOURCE_BUSY 92 .flags = IORESOURCE_BUSY | IORESOURCE_IO,
88 }, { 93 },
89 .start = 0x40, 94 { /* keyboard */
90 .end = 0x5f,
91 .name = "timer",
92 .flags = IORESOURCE_BUSY
93 }, {
94 .start = 0x60, 95 .start = 0x60,
95 .end = 0x6f, 96 .end = 0x6f,
96 .name = "keyboard", 97 .name = "reserved",
97 .flags = IORESOURCE_BUSY 98 .flags = IORESOURCE_BUSY | IORESOURCE_IO,
98 }, { 99 },
100 { /* dma page reg */
99 .start = 0x80, 101 .start = 0x80,
100 .end = 0x8f, 102 .end = 0x8f,
101 .name = "dma page reg", 103 .name = "reserved",
102 .flags = IORESOURCE_BUSY 104 .flags = IORESOURCE_BUSY | IORESOURCE_IO,
103 }, { 105 },
106 { /* dma2 */
104 .start = 0xc0, 107 .start = 0xc0,
105 .end = 0xdf, 108 .end = 0xdf,
106 .name = "dma2", 109 .name = "reserved",
107 .flags = IORESOURCE_BUSY 110 .flags = IORESOURCE_BUSY | IORESOURCE_IO,
108 }, 111 },
109}; 112};
110 113
111#define COBALT_IO_RESOURCES (sizeof(cobalt_io_resources)/sizeof(struct resource))
112
113static struct pci_controller cobalt_pci_controller = { 114static struct pci_controller cobalt_pci_controller = {
114 .pci_ops = &gt64111_pci_ops, 115 .pci_ops = &gt64111_pci_ops,
115 .mem_resource = &cobalt_mem_resource, 116 .mem_resource = &cobalt_mem_resource,
@@ -133,9 +134,9 @@ void __init plat_mem_setup(void)
133 /* I/O port resource must include LCD/buttons */ 134 /* I/O port resource must include LCD/buttons */
134 ioport_resource.end = 0x0fffffff; 135 ioport_resource.end = 0x0fffffff;
135 136
136 /* request I/O space for devices used on all i[345]86 PCs */ 137 /* These resources have been reserved by VIA SuperI/O chip. */
137 for (i = 0; i < COBALT_IO_RESOURCES; i++) 138 for (i = 0; i < ARRAY_SIZE(cobalt_reserved_resources); i++)
138 request_resource(&ioport_resource, cobalt_io_resources + i); 139 request_resource(&ioport_resource, cobalt_reserved_resources + i);
139 140
140 /* Read the cobalt id register out of the PCI config space */ 141 /* Read the cobalt id register out of the PCI config space */
141 PCI_CFG_SET(devfn, (VIA_COBALT_BRD_ID_REG & ~0x3)); 142 PCI_CFG_SET(devfn, (VIA_COBALT_BRD_ID_REG & ~0x3));
@@ -150,10 +151,6 @@ void __init plat_mem_setup(void)
150#endif 151#endif
151 152
152 if (cobalt_board_id > COBALT_BRD_ID_RAQ1) { 153 if (cobalt_board_id > COBALT_BRD_ID_RAQ1) {
153#ifdef CONFIG_EARLY_PRINTK
154 cobalt_early_console();
155#endif
156
157#ifdef CONFIG_SERIAL_8250 154#ifdef CONFIG_SERIAL_8250
158 uart.line = 0; 155 uart.line = 0;
159 uart.type = PORT_UNKNOWN; 156 uart.type = PORT_UNKNOWN;
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
index 9ebb522fbbb..98b9fbc042f 100644
--- a/arch/mips/configs/jmr3927_defconfig
+++ b/arch/mips/configs/jmr3927_defconfig
@@ -148,7 +148,6 @@ CONFIG_HZ=1000
148CONFIG_PREEMPT_NONE=y 148CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT_VOLUNTARY is not set 149# CONFIG_PREEMPT_VOLUNTARY is not set
150# CONFIG_PREEMPT is not set 150# CONFIG_PREEMPT is not set
151CONFIG_RTC_DS1742=y
152# CONFIG_KEXEC is not set 151# CONFIG_KEXEC is not set
153CONFIG_LOCKDEP_SUPPORT=y 152CONFIG_LOCKDEP_SUPPORT=y
154CONFIG_STACKTRACE_SUPPORT=y 153CONFIG_STACKTRACE_SUPPORT=y
@@ -802,7 +801,28 @@ CONFIG_USB_ARCH_HAS_EHCI=y
802# 801#
803# Real Time Clock 802# Real Time Clock
804# 803#
805# CONFIG_RTC_CLASS is not set 804CONFIG_RTC_LIB=y
805CONFIG_RTC_CLASS=y
806CONFIG_RTC_HCTOSYS=y
807CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
808# CONFIG_RTC_DEBUG is not set
809
810#
811# RTC interfaces
812#
813CONFIG_RTC_INTF_SYSFS=y
814CONFIG_RTC_INTF_PROC=y
815CONFIG_RTC_INTF_DEV=y
816# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
817
818#
819# RTC drivers
820#
821# CONFIG_RTC_DRV_DS1553 is not set
822CONFIG_RTC_DRV_DS1742=y
823# CONFIG_RTC_DRV_M48T86 is not set
824# CONFIG_RTC_DRV_TEST is not set
825# CONFIG_RTC_DRV_V3020 is not set
806 826
807# 827#
808# DMA Engine support 828# DMA Engine support
diff --git a/arch/mips/dec/prom/console.c b/arch/mips/dec/prom/console.c
index cade16ec7e5..65419bf3244 100644
--- a/arch/mips/dec/prom/console.c
+++ b/arch/mips/dec/prom/console.c
@@ -16,40 +16,12 @@
16 16
17#include <asm/dec/prom.h> 17#include <asm/dec/prom.h>
18 18
19static void __init prom_console_write(struct console *con, const char *s, 19void prom_putchar(char c)
20 unsigned int c)
21{ 20{
22 static char sfmt[] __initdata = "%%%us"; 21 char s[2];
23 char fmt[13];
24 22
25 snprintf(fmt, sizeof(fmt), sfmt, c); 23 s[0] = c;
26 prom_printf(fmt, s); 24 s[1] = '\0';
27}
28
29static struct console promcons __initdata = {
30 .name = "prom",
31 .write = prom_console_write,
32 .flags = CON_PRINTBUFFER,
33 .index = -1,
34};
35
36static int promcons_output __initdata = 0;
37
38void __init register_prom_console(void)
39{
40 if (!promcons_output) {
41 promcons_output = 1;
42 register_console(&promcons);
43 }
44}
45 25
46void __init unregister_prom_console(void) 26 prom_printf( s);
47{
48 if (promcons_output) {
49 unregister_console(&promcons);
50 promcons_output = 0;
51 }
52} 27}
53
54void disable_early_printk(void)
55 __attribute__((alias("unregister_prom_console")));
diff --git a/arch/mips/dec/prom/identify.c b/arch/mips/dec/prom/identify.c
index c4e3c1ea0d4..cd85924e257 100644
--- a/arch/mips/dec/prom/identify.c
+++ b/arch/mips/dec/prom/identify.c
@@ -26,9 +26,6 @@
26 26
27#include "dectypes.h" 27#include "dectypes.h"
28 28
29extern unsigned long mips_machgroup;
30extern unsigned long mips_machtype;
31
32static const char *dec_system_strings[] = { 29static const char *dec_system_strings[] = {
33 [MACH_DSUNKNOWN] "unknown DECstation", 30 [MACH_DSUNKNOWN] "unknown DECstation",
34 [MACH_DS23100] "DECstation 2100/3100", 31 [MACH_DS23100] "DECstation 2100/3100",
diff --git a/arch/mips/gt64120/ev64120/promcon.c b/arch/mips/gt64120/ev64120/promcon.c
index b5937c4ba7d..6e0ecfed964 100644
--- a/arch/mips/gt64120/ev64120/promcon.c
+++ b/arch/mips/gt64120/ev64120/promcon.c
@@ -24,11 +24,6 @@ static void prom_console_write(struct console *co, const char *s,
24 } 24 }
25} 25}
26 26
27int prom_getchar(void)
28{
29 return 0;
30}
31
32static struct console sercons = { 27static struct console sercons = {
33 .name = "ttyS", 28 .name = "ttyS",
34 .write = prom_console_write, 29 .write = prom_console_write,
diff --git a/arch/mips/jmr3927/common/Makefile b/arch/mips/jmr3927/common/Makefile
index cb09a8eede1..01e7db19bcb 100644
--- a/arch/mips/jmr3927/common/Makefile
+++ b/arch/mips/jmr3927/common/Makefile
@@ -2,4 +2,4 @@
2# Makefile for the common code of TOSHIBA JMR-TX3927 board 2# Makefile for the common code of TOSHIBA JMR-TX3927 board
3# 3#
4 4
5obj-y += prom.o puts.o rtc_ds1742.o 5obj-y += prom.o puts.o
diff --git a/arch/mips/jmr3927/common/rtc_ds1742.c b/arch/mips/jmr3927/common/rtc_ds1742.c
deleted file mode 100644
index e6561345d12..00000000000
--- a/arch/mips/jmr3927/common/rtc_ds1742.c
+++ /dev/null
@@ -1,171 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ahennessy@mvista.com
5 *
6 * arch/mips/jmr3927/common/rtc_ds1742.c
7 * Based on arch/mips/ddb5xxx/common/rtc_ds1386.c
8 * low-level RTC hookups for s for Dallas 1742 chip.
9 *
10 * Copyright (C) 2000-2001 Toshiba Corporation
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32
33
34/*
35 * This file exports a function, rtc_ds1386_init(), which expects an
36 * uncached base address as the argument. It will set the two function
37 * pointers expected by the MIPS generic timer code.
38 */
39
40#include <linux/bcd.h>
41#include <linux/types.h>
42#include <linux/time.h>
43#include <linux/rtc.h>
44#include <linux/ds1742rtc.h>
45
46#include <asm/time.h>
47#include <asm/addrspace.h>
48
49#include <asm/debug.h>
50
51#define EPOCH 2000
52
53static unsigned long rtc_base;
54
55static unsigned long
56rtc_ds1742_get_time(void)
57{
58 unsigned int year, month, day, hour, minute, second;
59 unsigned int century;
60 unsigned long flags;
61
62 spin_lock_irqsave(&rtc_lock, flags);
63 rtc_write(RTC_READ, RTC_CONTROL);
64 second = BCD2BIN(rtc_read(RTC_SECONDS) & RTC_SECONDS_MASK);
65 minute = BCD2BIN(rtc_read(RTC_MINUTES));
66 hour = BCD2BIN(rtc_read(RTC_HOURS));
67 day = BCD2BIN(rtc_read(RTC_DATE));
68 month = BCD2BIN(rtc_read(RTC_MONTH));
69 year = BCD2BIN(rtc_read(RTC_YEAR));
70 century = BCD2BIN(rtc_read(RTC_CENTURY) & RTC_CENTURY_MASK);
71 rtc_write(0, RTC_CONTROL);
72 spin_unlock_irqrestore(&rtc_lock, flags);
73
74 year += century * 100;
75
76 return mktime(year, month, day, hour, minute, second);
77}
78extern void to_tm(unsigned long tim, struct rtc_time * tm);
79
80static int
81rtc_ds1742_set_time(unsigned long t)
82{
83 struct rtc_time tm;
84 u8 year, month, day, hour, minute, second;
85 u8 cmos_year, cmos_month, cmos_day, cmos_hour, cmos_minute, cmos_second;
86 int cmos_century;
87 unsigned long flags;
88
89 spin_lock_irqsave(&rtc_lock, flags);
90 rtc_write(RTC_READ, RTC_CONTROL);
91 cmos_second = (u8)(rtc_read(RTC_SECONDS) & RTC_SECONDS_MASK);
92 cmos_minute = (u8)rtc_read(RTC_MINUTES);
93 cmos_hour = (u8)rtc_read(RTC_HOURS);
94 cmos_day = (u8)rtc_read(RTC_DATE);
95 cmos_month = (u8)rtc_read(RTC_MONTH);
96 cmos_year = (u8)rtc_read(RTC_YEAR);
97 cmos_century = rtc_read(RTC_CENTURY) & RTC_CENTURY_MASK;
98
99 rtc_write(RTC_WRITE, RTC_CONTROL);
100
101 /* convert */
102 to_tm(t, &tm);
103
104 /* check each field one by one */
105 year = BIN2BCD(tm.tm_year - EPOCH);
106 if (year != cmos_year) {
107 rtc_write(year,RTC_YEAR);
108 }
109
110 month = BIN2BCD(tm.tm_mon);
111 if (month != (cmos_month & 0x1f)) {
112 rtc_write((month & 0x1f) | (cmos_month & ~0x1f),RTC_MONTH);
113 }
114
115 day = BIN2BCD(tm.tm_mday);
116 if (day != cmos_day) {
117
118 rtc_write(day, RTC_DATE);
119 }
120
121 if (cmos_hour & 0x40) {
122 /* 12 hour format */
123 hour = 0x40;
124 if (tm.tm_hour > 12) {
125 hour |= 0x20 | (BIN2BCD(hour-12) & 0x1f);
126 } else {
127 hour |= BIN2BCD(tm.tm_hour);
128 }
129 } else {
130 /* 24 hour format */
131 hour = BIN2BCD(tm.tm_hour) & 0x3f;
132 }
133 if (hour != cmos_hour) rtc_write(hour, RTC_HOURS);
134
135 minute = BIN2BCD(tm.tm_min);
136 if (minute != cmos_minute) {
137 rtc_write(minute, RTC_MINUTES);
138 }
139
140 second = BIN2BCD(tm.tm_sec);
141 if (second != cmos_second) {
142 rtc_write(second & RTC_SECONDS_MASK,RTC_SECONDS);
143 }
144
145 /* RTC_CENTURY and RTC_CONTROL share same address... */
146 rtc_write(cmos_century, RTC_CONTROL);
147 spin_unlock_irqrestore(&rtc_lock, flags);
148
149 return 0;
150}
151
152void
153rtc_ds1742_init(unsigned long base)
154{
155 u8 cmos_second;
156
157 /* remember the base */
158 rtc_base = base;
159 db_assert((rtc_base & 0xe0000000) == KSEG1);
160
161 /* set the function pointers */
162 rtc_mips_get_time = rtc_ds1742_get_time;
163 rtc_mips_set_time = rtc_ds1742_set_time;
164
165 /* clear oscillator stop bit */
166 rtc_write(RTC_READ, RTC_CONTROL);
167 cmos_second = (u8)(rtc_read(RTC_SECONDS) & RTC_SECONDS_MASK);
168 rtc_write(RTC_WRITE, RTC_CONTROL);
169 rtc_write(cmos_second, RTC_SECONDS); /* clear msb */
170 rtc_write(0, RTC_CONTROL);
171}
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
index ecabe5b0848..fc523bda068 100644
--- a/arch/mips/jmr3927/rbhma3100/setup.c
+++ b/arch/mips/jmr3927/rbhma3100/setup.c
@@ -45,6 +45,7 @@
45#include <linux/param.h> /* for HZ */ 45#include <linux/param.h> /* for HZ */
46#include <linux/delay.h> 46#include <linux/delay.h>
47#include <linux/pm.h> 47#include <linux/pm.h>
48#include <linux/platform_device.h>
48#ifdef CONFIG_SERIAL_TXX9 49#ifdef CONFIG_SERIAL_TXX9
49#include <linux/tty.h> 50#include <linux/tty.h>
50#include <linux/serial.h> 51#include <linux/serial.h>
@@ -172,19 +173,10 @@ static cycle_t jmr3927_hpt_read(void)
172 return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr; 173 return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr;
173} 174}
174 175
175#define USE_RTC_DS1742
176#ifdef USE_RTC_DS1742
177extern void rtc_ds1742_init(unsigned long base);
178#endif
179static void __init jmr3927_time_init(void) 176static void __init jmr3927_time_init(void)
180{ 177{
181 clocksource_mips.read = jmr3927_hpt_read; 178 clocksource_mips.read = jmr3927_hpt_read;
182 mips_hpt_frequency = JMR3927_TIMER_CLK; 179 mips_hpt_frequency = JMR3927_TIMER_CLK;
183#ifdef USE_RTC_DS1742
184 if (jmr3927_have_nvram()) {
185 rtc_ds1742_init(JMR3927_IOC_NVRAMB_ADDR);
186 }
187#endif
188} 180}
189 181
190void __init plat_timer_setup(struct irqaction *irq) 182void __init plat_timer_setup(struct irqaction *irq)
@@ -540,3 +532,32 @@ void __init tx3927_setup(void)
540 printk("TX3927 D-Cache WriteBack (CWF) .\n"); 532 printk("TX3927 D-Cache WriteBack (CWF) .\n");
541 } 533 }
542} 534}
535
536/* This trick makes rtc-ds1742 driver usable as is. */
537unsigned long __swizzle_addr_b(unsigned long port)
538{
539 if ((port & 0xffff0000) != JMR3927_IOC_NVRAMB_ADDR)
540 return port;
541 port = (port & 0xffff0000) | (port & 0x7fff << 1);
542#ifdef __BIG_ENDIAN
543 return port;
544#else
545 return port | 1;
546#endif
547}
548EXPORT_SYMBOL(__swizzle_addr_b);
549
550static int __init jmr3927_rtc_init(void)
551{
552 struct resource res = {
553 .start = JMR3927_IOC_NVRAMB_ADDR - IO_BASE,
554 .end = JMR3927_IOC_NVRAMB_ADDR - IO_BASE + 0x800 - 1,
555 .flags = IORESOURCE_MEM,
556 };
557 struct platform_device *dev;
558 if (!jmr3927_have_nvram())
559 return -ENODEV;
560 dev = platform_device_register_simple("ds1742", -1, &res, 1);
561 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
562}
563device_initcall(jmr3927_rtc_init);
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index a3dad394acb..49246264cc7 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -65,5 +65,6 @@ obj-$(CONFIG_64BIT) += cpu-bugs64.o
65obj-$(CONFIG_I8253) += i8253.o 65obj-$(CONFIG_I8253) += i8253.o
66 66
67obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 67obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
68obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
68 69
69CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) 70CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
diff --git a/arch/mips/kernel/early_printk.c b/arch/mips/kernel/early_printk.c
new file mode 100644
index 00000000000..304efdc5682
--- /dev/null
+++ b/arch/mips/kernel/early_printk.c
@@ -0,0 +1,40 @@
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) 2002, 2003, 06, 07 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2007 MIPS Technologies, Inc.
8 * written by Ralf Baechle (ralf@linux-mips.org)
9 */
10#include <linux/console.h>
11#include <linux/init.h>
12
13extern void prom_putchar(char);
14
15static void early_console_write(struct console *con, const char *s, unsigned n)
16{
17 while (n-- && *s) {
18 if (*s == '\n')
19 prom_putchar('\r');
20 prom_putchar(*s);
21 s++;
22 }
23}
24
25static struct console early_console = {
26 .name = "early",
27 .write = early_console_write,
28 .flags = CON_PRINTBUFFER | CON_BOOT,
29 .index = -1
30};
31
32void __init setup_early_printk(void)
33{
34 register_console(&early_console);
35}
36
37void __init disable_early_printk(void)
38{
39 unregister_console(&early_console);
40}
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index fc4dd6c9dd8..30d433f14f9 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -166,34 +166,6 @@ out:
166 return error; 166 return error;
167} 167}
168 168
169asmlinkage long
170sysn32_waitid(int which, compat_pid_t pid,
171 siginfo_t __user *uinfo, int options,
172 struct compat_rusage __user *uru)
173{
174 struct rusage ru;
175 long ret;
176 mm_segment_t old_fs = get_fs();
177 int si_signo;
178
179 if (!access_ok(VERIFY_WRITE, uinfo, sizeof(*uinfo)))
180 return -EFAULT;
181
182 set_fs (KERNEL_DS);
183 ret = sys_waitid(which, pid, uinfo, options,
184 uru ? (struct rusage __user *) &ru : NULL);
185 set_fs (old_fs);
186
187 if (__get_user(si_signo, &uinfo->si_signo))
188 return -EFAULT;
189 if (ret < 0 || si_signo == 0)
190 return ret;
191
192 if (uru)
193 ret = put_compat_rusage(&ru, uru);
194 return ret;
195}
196
197#define RLIM_INFINITY32 0x7fffffff 169#define RLIM_INFINITY32 0x7fffffff
198#define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x) 170#define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x)
199 171
@@ -572,151 +544,6 @@ asmlinkage long sys32_sync_file_range(int fd, int __pad,
572 flags); 544 flags);
573} 545}
574 546
575/* Argument list sizes for sys_socketcall */
576#define AL(x) ((x) * sizeof(unsigned int))
577static unsigned char socketcall_nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
578 AL(3),AL(3),AL(4),AL(4),AL(4),AL(6),
579 AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)};
580#undef AL
581
582/*
583 * System call vectors.
584 *
585 * Argument checking cleaned up. Saved 20% in size.
586 * This function doesn't need to set the kernel lock because
587 * it is set by the callees.
588 */
589
590asmlinkage long sys32_socketcall(int call, unsigned int __user *args32)
591{
592 unsigned int a[6];
593 unsigned int a0,a1;
594 int err;
595
596 extern asmlinkage long sys_socket(int family, int type, int protocol);
597 extern asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen);
598 extern asmlinkage long sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen);
599 extern asmlinkage long sys_listen(int fd, int backlog);
600 extern asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int __user *upeer_addrlen);
601 extern asmlinkage long sys_getsockname(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len);
602 extern asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len);
603 extern asmlinkage long sys_socketpair(int family, int type, int protocol, int __user *usockvec);
604 extern asmlinkage long sys_send(int fd, void __user * buff, size_t len, unsigned flags);
605 extern asmlinkage long sys_sendto(int fd, void __user * buff, size_t len, unsigned flags,
606 struct sockaddr __user *addr, int addr_len);
607 extern asmlinkage long sys_recv(int fd, void __user * ubuf, size_t size, unsigned flags);
608 extern asmlinkage long sys_recvfrom(int fd, void __user * ubuf, size_t size, unsigned flags,
609 struct sockaddr __user *addr, int __user *addr_len);
610 extern asmlinkage long sys_shutdown(int fd, int how);
611 extern asmlinkage long sys_setsockopt(int fd, int level, int optname, char __user *optval, int optlen);
612 extern asmlinkage long sys_getsockopt(int fd, int level, int optname, char __user *optval, int __user *optlen);
613 extern asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags);
614 extern asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned int flags);
615
616
617 if(call<1||call>SYS_RECVMSG)
618 return -EINVAL;
619
620 /* copy_from_user should be SMP safe. */
621 if (copy_from_user(a, args32, socketcall_nargs[call]))
622 return -EFAULT;
623
624 a0=a[0];
625 a1=a[1];
626
627 switch(call)
628 {
629 case SYS_SOCKET:
630 err = sys_socket(a0,a1,a[2]);
631 break;
632 case SYS_BIND:
633 err = sys_bind(a0,(struct sockaddr __user *)A(a1), a[2]);
634 break;
635 case SYS_CONNECT:
636 err = sys_connect(a0, (struct sockaddr __user *)A(a1), a[2]);
637 break;
638 case SYS_LISTEN:
639 err = sys_listen(a0,a1);
640 break;
641 case SYS_ACCEPT:
642 err = sys_accept(a0,(struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
643 break;
644 case SYS_GETSOCKNAME:
645 err = sys_getsockname(a0,(struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
646 break;
647 case SYS_GETPEERNAME:
648 err = sys_getpeername(a0, (struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
649 break;
650 case SYS_SOCKETPAIR:
651 err = sys_socketpair(a0,a1, a[2], (int __user *)A(a[3]));
652 break;
653 case SYS_SEND:
654 err = sys_send(a0, (void __user *)A(a1), a[2], a[3]);
655 break;
656 case SYS_SENDTO:
657 err = sys_sendto(a0,(void __user *)A(a1), a[2], a[3],
658 (struct sockaddr __user *)A(a[4]), a[5]);
659 break;
660 case SYS_RECV:
661 err = sys_recv(a0, (void __user *)A(a1), a[2], a[3]);
662 break;
663 case SYS_RECVFROM:
664 err = sys_recvfrom(a0, (void __user *)A(a1), a[2], a[3],
665 (struct sockaddr __user *)A(a[4]), (int __user *)A(a[5]));
666 break;
667 case SYS_SHUTDOWN:
668 err = sys_shutdown(a0,a1);
669 break;
670 case SYS_SETSOCKOPT:
671 err = sys_setsockopt(a0, a1, a[2], (char __user *)A(a[3]), a[4]);
672 break;
673 case SYS_GETSOCKOPT:
674 err = sys_getsockopt(a0, a1, a[2], (char __user *)A(a[3]), (int __user *)A(a[4]));
675 break;
676 case SYS_SENDMSG:
677 err = sys_sendmsg(a0, (struct msghdr __user *) A(a1), a[2]);
678 break;
679 case SYS_RECVMSG:
680 err = sys_recvmsg(a0, (struct msghdr __user *) A(a1), a[2]);
681 break;
682 default:
683 err = -EINVAL;
684 break;
685 }
686 return err;
687}
688
689struct sigevent32 {
690 u32 sigev_value;
691 u32 sigev_signo;
692 u32 sigev_notify;
693 u32 payload[(64 / 4) - 3];
694};
695
696extern asmlinkage long
697sys_timer_create(clockid_t which_clock,
698 struct sigevent __user *timer_event_spec,
699 timer_t __user * created_timer_id);
700
701long
702sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *timer_id)
703{
704 struct sigevent __user *p = NULL;
705 if (se32) {
706 struct sigevent se;
707 p = compat_alloc_user_space(sizeof(struct sigevent));
708 memset(&se, 0, sizeof(struct sigevent));
709 if (get_user(se.sigev_value.sival_int, &se32->sigev_value) ||
710 __get_user(se.sigev_signo, &se32->sigev_signo) ||
711 __get_user(se.sigev_notify, &se32->sigev_notify) ||
712 __copy_from_user(&se._sigev_un._pad, &se32->payload,
713 sizeof(se32->payload)) ||
714 copy_to_user(p, &se, sizeof(se)))
715 return -EFAULT;
716 }
717 return sys_timer_create(clock, p, timer_id);
718}
719
720save_static_function(sys32_clone); 547save_static_function(sys32_clone);
721__attribute_used__ noinline static int 548__attribute_used__ noinline static int
722_sys32_clone(nabi_no_regargs struct pt_regs regs) 549_sys32_clone(nabi_no_regargs struct pt_regs regs)
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 2ceda4644a4..f17e31e3bff 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -340,7 +340,7 @@ EXPORT(sysn32_call_table)
340 PTR compat_sys_statfs64 340 PTR compat_sys_statfs64
341 PTR compat_sys_fstatfs64 341 PTR compat_sys_fstatfs64
342 PTR sys_sendfile64 342 PTR sys_sendfile64
343 PTR sys32_timer_create /* 6220 */ 343 PTR compat_sys_timer_create /* 6220 */
344 PTR compat_sys_timer_settime 344 PTR compat_sys_timer_settime
345 PTR compat_sys_timer_gettime 345 PTR compat_sys_timer_gettime
346 PTR sys_timer_getoverrun 346 PTR sys_timer_getoverrun
@@ -361,7 +361,7 @@ EXPORT(sysn32_call_table)
361 PTR compat_sys_mq_notify 361 PTR compat_sys_mq_notify
362 PTR compat_sys_mq_getsetattr 362 PTR compat_sys_mq_getsetattr
363 PTR sys_ni_syscall /* 6240, sys_vserver */ 363 PTR sys_ni_syscall /* 6240, sys_vserver */
364 PTR sysn32_waitid 364 PTR compat_sys_waitid
365 PTR sys_ni_syscall /* available, was setaltroot */ 365 PTR sys_ni_syscall /* available, was setaltroot */
366 PTR sys_add_key 366 PTR sys_add_key
367 PTR sys_request_key 367 PTR sys_request_key
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index bcc42489dc3..142c9b70c02 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -307,7 +307,7 @@ sys_call_table:
307 PTR compat_sys_statfs 307 PTR compat_sys_statfs
308 PTR compat_sys_fstatfs /* 4100 */ 308 PTR compat_sys_fstatfs /* 4100 */
309 PTR sys_ni_syscall /* sys_ioperm */ 309 PTR sys_ni_syscall /* sys_ioperm */
310 PTR sys32_socketcall 310 PTR compat_sys_socketcall
311 PTR sys_syslog 311 PTR sys_syslog
312 PTR compat_sys_setitimer 312 PTR compat_sys_setitimer
313 PTR compat_sys_getitimer /* 4105 */ 313 PTR compat_sys_getitimer /* 4105 */
@@ -462,7 +462,7 @@ sys_call_table:
462 PTR sys_fadvise64_64 462 PTR sys_fadvise64_64
463 PTR compat_sys_statfs64 /* 4255 */ 463 PTR compat_sys_statfs64 /* 4255 */
464 PTR compat_sys_fstatfs64 464 PTR compat_sys_fstatfs64
465 PTR sys32_timer_create 465 PTR compat_sys_timer_create
466 PTR compat_sys_timer_settime 466 PTR compat_sys_timer_settime
467 PTR compat_sys_timer_gettime 467 PTR compat_sys_timer_gettime
468 PTR sys_timer_getoverrun /* 4260 */ 468 PTR sys_timer_getoverrun /* 4260 */
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 11ab222a2e9..4975da0bfb6 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -525,6 +525,14 @@ void __init setup_arch(char **cmdline_p)
525{ 525{
526 cpu_probe(); 526 cpu_probe();
527 prom_init(); 527 prom_init();
528
529#ifdef CONFIG_EARLY_PRINTK
530 {
531 extern void setup_early_printk(void);
532
533 setup_early_printk();
534 }
535#endif
528 cpu_report(); 536 cpu_report();
529 537
530#if defined(CONFIG_VT) 538#if defined(CONFIG_VT)
diff --git a/arch/mips/lasat/lasat_board.c b/arch/mips/lasat/lasat_board.c
index d425120b028..fbe9a87bd0a 100644
--- a/arch/mips/lasat/lasat_board.c
+++ b/arch/mips/lasat/lasat_board.c
@@ -110,12 +110,13 @@ int lasat_init_board_info(void)
110 sizeof(struct lasat_eeprom_struct) - 4); 110 sizeof(struct lasat_eeprom_struct) - 4);
111 111
112 if (crc != lasat_board_info.li_eeprom_info.crc32) { 112 if (crc != lasat_board_info.li_eeprom_info.crc32) {
113 prom_printf("WARNING...\nWARNING...\nEEPROM CRC does not match calculated, attempting to soldier on...\n"); 113 printk(KERN_WARNING "WARNING...\nWARNING...\nEEPROM CRC does "
114 "not match calculated, attempting to soldier on...\n");
114 } 115 }
115 116
116 if (lasat_board_info.li_eeprom_info.version != LASAT_EEPROM_VERSION) 117 if (lasat_board_info.li_eeprom_info.version != LASAT_EEPROM_VERSION) {
117 { 118 printk(KERN_WARNING "WARNING...\nWARNING...\nEEPROM version "
118 prom_printf("WARNING...\nWARNING...\nEEPROM version %d, wanted version %d, attempting to soldier on...\n", 119 "%d, wanted version %d, attempting to soldier on...\n",
119 (unsigned int)lasat_board_info.li_eeprom_info.version, 120 (unsigned int)lasat_board_info.li_eeprom_info.version,
120 LASAT_EEPROM_VERSION); 121 LASAT_EEPROM_VERSION);
121 } 122 }
@@ -124,7 +125,9 @@ int lasat_init_board_info(void)
124 cfg1 = lasat_board_info.li_eeprom_info.cfg[1]; 125 cfg1 = lasat_board_info.li_eeprom_info.cfg[1];
125 126
126 if ( LASAT_W0_DSCTYPE(cfg0) != 1) { 127 if ( LASAT_W0_DSCTYPE(cfg0) != 1) {
127 prom_printf("WARNING...\nWARNING...\nInvalid configuration read from EEPROM, attempting to soldier on..."); 128 printk(KERN_WARNING "WARNING...\nWARNING...\n"
129 "Invalid configuration read from EEPROM, attempting to "
130 "soldier on...");
128 } 131 }
129 /* We have a valid configuration */ 132 /* We have a valid configuration */
130 133
diff --git a/arch/mips/lasat/prom.c b/arch/mips/lasat/prom.c
index d47692f73a2..812c6ac366b 100644
--- a/arch/mips/lasat/prom.c
+++ b/arch/mips/lasat/prom.c
@@ -23,10 +23,6 @@
23#define PROM_PUTC_ADDR PROM_JUMP_TABLE_ENTRY(1) 23#define PROM_PUTC_ADDR PROM_JUMP_TABLE_ENTRY(1)
24#define PROM_MONITOR_ADDR PROM_JUMP_TABLE_ENTRY(2) 24#define PROM_MONITOR_ADDR PROM_JUMP_TABLE_ENTRY(2)
25 25
26static void null_prom_printf(const char * fmt, ...)
27{
28}
29
30static void null_prom_display(const char *string, int pos, int clear) 26static void null_prom_display(const char *string, int pos, int clear)
31{ 27{
32} 28}
@@ -40,50 +36,29 @@ static void null_prom_putc(char c)
40} 36}
41 37
42/* these are functions provided by the bootloader */ 38/* these are functions provided by the bootloader */
43static void (* prom_putc)(char c) = null_prom_putc; 39static void (* __prom_putc)(char c) = null_prom_putc;
44void (* prom_printf)(const char * fmt, ...) = null_prom_printf; 40
41void prom_putchar(char c)
42{
43 __prom_putc(c);
44}
45
45void (* prom_display)(const char *string, int pos, int clear) = 46void (* prom_display)(const char *string, int pos, int clear) =
46 null_prom_display; 47 null_prom_display;
47void (* prom_monitor)(void) = null_prom_monitor; 48void (* prom_monitor)(void) = null_prom_monitor;
48 49
49unsigned int lasat_ndelay_divider; 50unsigned int lasat_ndelay_divider;
50 51
51#define PROM_PRINTFBUF_SIZE 256
52static char prom_printfbuf[PROM_PRINTFBUF_SIZE];
53
54static void real_prom_printf(const char * fmt, ...)
55{
56 va_list ap;
57 int len;
58 char *c = prom_printfbuf;
59 int i;
60
61 va_start(ap, fmt);
62 len = vsnprintf(prom_printfbuf, PROM_PRINTFBUF_SIZE, fmt, ap);
63 va_end(ap);
64
65 /* output overflowed the buffer */
66 if (len < 0 || len > PROM_PRINTFBUF_SIZE)
67 len = PROM_PRINTFBUF_SIZE;
68
69 for (i=0; i < len; i++) {
70 if (*c == '\n')
71 prom_putc('\r');
72 prom_putc(*c++);
73 }
74}
75
76static void setup_prom_vectors(void) 52static void setup_prom_vectors(void)
77{ 53{
78 u32 version = *(u32 *)(RESET_VECTOR + 0x90); 54 u32 version = *(u32 *)(RESET_VECTOR + 0x90);
79 55
80 if (version >= 307) { 56 if (version >= 307) {
81 prom_display = (void *)PROM_DISPLAY_ADDR; 57 prom_display = (void *)PROM_DISPLAY_ADDR;
82 prom_putc = (void *)PROM_PUTC_ADDR; 58 __prom_putc = (void *)PROM_PUTC_ADDR;
83 prom_printf = real_prom_printf;
84 prom_monitor = (void *)PROM_MONITOR_ADDR; 59 prom_monitor = (void *)PROM_MONITOR_ADDR;
85 } 60 }
86 prom_printf("prom vectors set up\n"); 61 printk("prom vectors set up\n");
87} 62}
88 63
89static struct at93c_defs at93c_defs[N_MACHTYPES] = { 64static struct at93c_defs at93c_defs[N_MACHTYPES] = {
@@ -101,11 +76,11 @@ void __init prom_init(void)
101 setup_prom_vectors(); 76 setup_prom_vectors();
102 77
103 if (current_cpu_data.cputype == CPU_R5000) { 78 if (current_cpu_data.cputype == CPU_R5000) {
104 prom_printf("LASAT 200 board\n"); 79 printk("LASAT 200 board\n");
105 mips_machtype = MACH_LASAT_200; 80 mips_machtype = MACH_LASAT_200;
106 lasat_ndelay_divider = LASAT_200_DIVIDER; 81 lasat_ndelay_divider = LASAT_200_DIVIDER;
107 } else { 82 } else {
108 prom_printf("LASAT 100 board\n"); 83 printk("LASAT 100 board\n");
109 mips_machtype = MACH_LASAT_100; 84 mips_machtype = MACH_LASAT_100;
110 lasat_ndelay_divider = LASAT_100_DIVIDER; 85 lasat_ndelay_divider = LASAT_100_DIVIDER;
111 } 86 }
diff --git a/arch/mips/lasat/prom.h b/arch/mips/lasat/prom.h
index 07be7bf1e4a..019d45fbd26 100644
--- a/arch/mips/lasat/prom.h
+++ b/arch/mips/lasat/prom.h
@@ -2,5 +2,4 @@
2#define PROM_H 2#define PROM_H
3extern void (* prom_display)(const char *string, int pos, int clear); 3extern void (* prom_display)(const char *string, int pos, int clear);
4extern void (* prom_monitor)(void); 4extern void (* prom_monitor)(void);
5extern void (* prom_printf)(const char * fmt, ...);
6#endif 5#endif
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
index 14c55168f1f..488007f1398 100644
--- a/arch/mips/lasat/setup.c
+++ b/arch/mips/lasat/setup.c
@@ -116,7 +116,6 @@ static void lasat_time_init(void)
116 116
117void __init plat_timer_setup(struct irqaction *irq) 117void __init plat_timer_setup(struct irqaction *irq)
118{ 118{
119 write_c0_compare( read_c0_count() + mips_hpt_frequency / HZ);
120 change_c0_status(ST0_IM, IE_IRQ0 | IE_IRQ5); 119 change_c0_status(ST0_IM, IE_IRQ0 | IE_IRQ5);
121} 120}
122 121
@@ -179,5 +178,5 @@ void __init plat_mem_setup(void)
179 /* Switch from prom exception handler to normal mode */ 178 /* Switch from prom exception handler to normal mode */
180 change_c0_status(ST0_BEV,0); 179 change_c0_status(ST0_BEV,0);
181 180
182 prom_printf("Lasat specific initialization complete\n"); 181 pr_info("Lasat specific initialization complete\n");
183} 182}
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index 52e0ec8bcb1..d7d3b14dcfb 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -2,8 +2,8 @@
2# Makefile for MIPS-specific library files.. 2# Makefile for MIPS-specific library files..
3# 3#
4 4
5lib-y += csum_partial.o memcpy.o memcpy-inatomic.o memset.o promlib.o \ 5lib-y += csum_partial.o memcpy.o memcpy-inatomic.o memset.o strlen_user.o \
6 strlen_user.o strncpy_user.o strnlen_user.o uncached.o 6 strncpy_user.o strnlen_user.o uncached.o
7 7
8obj-y += iomap.o 8obj-y += iomap.o
9obj-$(CONFIG_PCI) += iomap-pci.o 9obj-$(CONFIG_PCI) += iomap-pci.o
diff --git a/arch/mips/lib/promlib.c b/arch/mips/lib/promlib.c
deleted file mode 100644
index dddfe98b4de..00000000000
--- a/arch/mips/lib/promlib.c
+++ /dev/null
@@ -1,24 +0,0 @@
1#include <stdarg.h>
2#include <linux/kernel.h>
3
4extern void prom_putchar(char);
5
6void prom_printf(char *fmt, ...)
7{
8 va_list args;
9 char ppbuf[1024];
10 char *bptr;
11
12 va_start(args, fmt);
13 vsprintf(ppbuf, fmt, args);
14
15 bptr = ppbuf;
16
17 while (*bptr != 0) {
18 if (*bptr == '\n')
19 prom_putchar('\r');
20
21 prom_putchar(*bptr++);
22 }
23 va_end(args);
24}
diff --git a/arch/mips/mips-boards/generic/Makefile b/arch/mips/mips-boards/generic/Makefile
index 0a30f5dc9b7..aade36d7878 100644
--- a/arch/mips/mips-boards/generic/Makefile
+++ b/arch/mips/mips-boards/generic/Makefile
@@ -18,7 +18,9 @@
18# Makefile for the MIPS boards generic routines under Linux. 18# Makefile for the MIPS boards generic routines under Linux.
19# 19#
20 20
21obj-y := reset.o display.o init.o memory.o printf.o \ 21obj-y := reset.o display.o init.o memory.o \
22 cmdline.o time.o 22 cmdline.o time.o
23
24obj-$(CONFIG_EARLY_PRINTK) += console.o
23obj-$(CONFIG_PCI) += pci.o 25obj-$(CONFIG_PCI) += pci.o
24obj-$(CONFIG_KGDB) += gdb_hook.o 26obj-$(CONFIG_KGDB) += gdb_hook.o
diff --git a/arch/mips/mips-boards/generic/printf.c b/arch/mips/mips-boards/generic/console.c
index 1a711bd79b5..4d8ab99e415 100644
--- a/arch/mips/mips-boards/generic/printf.c
+++ b/arch/mips/mips-boards/generic/console.c
@@ -17,10 +17,9 @@
17 * 17 *
18 * Putting things on the screen/serial line using YAMONs facilities. 18 * Putting things on the screen/serial line using YAMONs facilities.
19 */ 19 */
20#include <linux/console.h>
20#include <linux/init.h> 21#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/serial_reg.h> 22#include <linux/serial_reg.h>
23#include <linux/spinlock.h>
24#include <asm/io.h> 23#include <asm/io.h>
25 24
26#ifdef CONFIG_MIPS_ATLAS 25#ifdef CONFIG_MIPS_ATLAS
@@ -67,12 +66,3 @@ int prom_putchar(char c)
67 66
68 return 1; 67 return 1;
69} 68}
70
71char prom_getchar(void)
72{
73 while (!(serial_in(UART_LSR) & UART_LSR_DR))
74 ;
75
76 return serial_in(UART_RX);
77}
78
diff --git a/arch/mips/mips-boards/generic/init.c b/arch/mips/mips-boards/generic/init.c
index 58a0fe88359..b1133760012 100644
--- a/arch/mips/mips-boards/generic/init.c
+++ b/arch/mips/mips-boards/generic/init.c
@@ -167,7 +167,7 @@ static void __init console_config(void)
167 flow = 'r'; 167 flow = 'r';
168 sprintf (console_string, " console=ttyS0,%d%c%c%c", baud, parity, bits, flow); 168 sprintf (console_string, " console=ttyS0,%d%c%c%c", baud, parity, bits, flow);
169 strcat (prom_getcmdline(), console_string); 169 strcat (prom_getcmdline(), console_string);
170 prom_printf("Config serial console:%s\n", console_string); 170 pr_info("Config serial console:%s\n", console_string);
171 } 171 }
172} 172}
173#endif 173#endif
@@ -210,8 +210,9 @@ void __init kgdb_config (void)
210 generic_getDebugChar = rs_getDebugChar; 210 generic_getDebugChar = rs_getDebugChar;
211 } 211 }
212 212
213 prom_printf("KGDB: Using serial line /dev/ttyS%d at %d for session, " 213 pr_info("KGDB: Using serial line /dev/ttyS%d at %d for "
214 "please connect your debugger\n", line ? 1 : 0, speed); 214 "session, please connect your debugger\n",
215 line ? 1 : 0, speed);
215 216
216 { 217 {
217 char *s; 218 char *s;
@@ -382,7 +383,7 @@ void __init prom_init(void)
382 board_nmi_handler_setup = mips_nmi_setup; 383 board_nmi_handler_setup = mips_nmi_setup;
383 board_ejtag_handler_setup = mips_ejtag_setup; 384 board_ejtag_handler_setup = mips_ejtag_setup;
384 385
385 prom_printf("\nLINUX started...\n"); 386 pr_info("\nLINUX started...\n");
386 prom_init_cmdline(); 387 prom_init_cmdline();
387 prom_meminit(); 388 prom_meminit();
388#ifdef CONFIG_SERIAL_8250_CONSOLE 389#ifdef CONFIG_SERIAL_8250_CONSOLE
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c
index ebf0e16c5a0..ae39953da2c 100644
--- a/arch/mips/mips-boards/generic/memory.c
+++ b/arch/mips/mips-boards/generic/memory.c
@@ -59,11 +59,12 @@ struct prom_pmemblock * __init prom_getmdesc(void)
59 /* otherwise look in the environment */ 59 /* otherwise look in the environment */
60 memsize_str = prom_getenv("memsize"); 60 memsize_str = prom_getenv("memsize");
61 if (!memsize_str) { 61 if (!memsize_str) {
62 prom_printf("memsize not set in boot prom, set to default (32Mb)\n"); 62 printk(KERN_WARNING
63 "memsize not set in boot prom, set to default (32Mb)\n");
63 physical_memsize = 0x02000000; 64 physical_memsize = 0x02000000;
64 } else { 65 } else {
65#ifdef DEBUG 66#ifdef DEBUG
66 prom_printf("prom_memsize = %s\n", memsize_str); 67 pr_debug("prom_memsize = %s\n", memsize_str);
67#endif 68#endif
68 physical_memsize = simple_strtol(memsize_str, NULL, 0); 69 physical_memsize = simple_strtol(memsize_str, NULL, 0);
69 } 70 }
@@ -141,12 +142,12 @@ void __init prom_meminit(void)
141 struct prom_pmemblock *p; 142 struct prom_pmemblock *p;
142 143
143#ifdef DEBUG 144#ifdef DEBUG
144 prom_printf("YAMON MEMORY DESCRIPTOR dump:\n"); 145 pr_debug("YAMON MEMORY DESCRIPTOR dump:\n");
145 p = prom_getmdesc(); 146 p = prom_getmdesc();
146 while (p->size) { 147 while (p->size) {
147 int i = 0; 148 int i = 0;
148 prom_printf("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n", 149 pr_debug("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n",
149 i, p, p->base, p->size, mtypes[p->type]); 150 i, p, p->base, p->size, mtypes[p->type]);
150 p++; 151 p++;
151 i++; 152 i++;
152 } 153 }
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index a3c3a1d462b..df2a2bd3aa5 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -295,7 +295,4 @@ void __init plat_timer_setup(struct irqaction *irq)
295 irq_desc[mips_cpu_timer_irq].status |= IRQ_PER_CPU; 295 irq_desc[mips_cpu_timer_irq].status |= IRQ_PER_CPU;
296 set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq); 296 set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq);
297#endif 297#endif
298
299 /* to generate the first timer interrupt */
300 write_c0_compare (read_c0_count() + mips_hpt_frequency/HZ);
301} 298}
diff --git a/arch/mips/mips-boards/sim/Makefile b/arch/mips/mips-boards/sim/Makefile
index a12e32aafde..6aeebc9122f 100644
--- a/arch/mips/mips-boards/sim/Makefile
+++ b/arch/mips/mips-boards/sim/Makefile
@@ -1,5 +1,7 @@
1# 1#
2# Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 2# Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3# Copyright (C) 2007 MIPS Technologies, Inc.
4# written by Ralf Baechle (ralf@linux-mips.org)
3# 5#
4# This program is free software; you can distribute it and/or modify it 6# This program is free software; you can distribute it and/or modify it
5# under the terms of the GNU General Public License (Version 2) as 7# under the terms of the GNU General Public License (Version 2) as
@@ -15,5 +17,7 @@
15# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 17# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16# 18#
17 19
18obj-y := sim_setup.o sim_mem.o sim_time.o sim_printf.o sim_int.o sim_cmdline.o 20obj-y := sim_setup.o sim_mem.o sim_time.o sim_int.o sim_cmdline.o
21
22obj-$(CONFIG_EARLY_PRINTK) += sim_console.o
19obj-$(CONFIG_SMP) += sim_smp.o 23obj-$(CONFIG_SMP) += sim_smp.o
diff --git a/arch/mips/mips-boards/sim/sim_printf.c b/arch/mips/mips-boards/sim/sim_console.c
index 3ee5a0b501a..de595a9ccb2 100644
--- a/arch/mips/mips-boards/sim/sim_printf.c
+++ b/arch/mips/mips-boards/sim/sim_console.c
@@ -1,7 +1,4 @@
1/* 1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it 2 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as 3 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation. 4 * published by the Free Software Foundation.
@@ -15,14 +12,14 @@
15 * with this program; if not, write to the Free Software Foundation, Inc., 12 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 13 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 * 14 *
18 * Putting things on the screen/serial line using YAMONs facilities. 15 * Carsten Langgaard, carstenl@mips.com
16 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
17 * Copyright (C) 2007 MIPS Technologies, Inc.
18 * written by Ralf Baechle
19 */ 19 */
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/serial_reg.h> 21#include <linux/serial_reg.h>
23#include <linux/spinlock.h>
24#include <asm/io.h> 22#include <asm/io.h>
25#include <asm/system.h>
26 23
27static inline unsigned int serial_in(int offset) 24static inline unsigned int serial_in(int offset)
28{ 25{
@@ -34,41 +31,10 @@ static inline void serial_out(int offset, int value)
34 outb(value, 0x3f8 + offset); 31 outb(value, 0x3f8 + offset);
35} 32}
36 33
37int putPromChar(char c) 34void __init prom_putchar(char c)
38{ 35{
39 while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0) 36 while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0)
40 ; 37 ;
41 38
42 serial_out(UART_TX, c); 39 serial_out(UART_TX, c);
43
44 return 1;
45}
46
47char getPromChar(void)
48{
49 while (!(serial_in(UART_LSR) & 1))
50 ;
51
52 return serial_in(UART_RX);
53}
54
55void prom_printf(char *fmt, ...)
56{
57 va_list args;
58 int l;
59 char *p, *buf_end;
60 char buf[1024];
61
62 va_start(args, fmt);
63 l = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf) */
64 va_end(args);
65
66 buf_end = buf + l;
67
68 for (p = buf; p < buf_end; p++) {
69 /* Crude cr/nl handling is better than none */
70 if (*p == '\n')
71 putPromChar('\r');
72 putPromChar(*p);
73 }
74} 40}
diff --git a/arch/mips/mips-boards/sim/sim_mem.c b/arch/mips/mips-boards/sim/sim_mem.c
index 46bc16f8b15..e408ef0bcd6 100644
--- a/arch/mips/mips-boards/sim/sim_mem.c
+++ b/arch/mips/mips-boards/sim/sim_mem.c
@@ -46,7 +46,7 @@ struct prom_pmemblock * __init prom_getmdesc(void)
46 unsigned int memsize; 46 unsigned int memsize;
47 47
48 memsize = 0x02000000; 48 memsize = 0x02000000;
49 prom_printf("Setting default memory size 0x%08x\n", memsize); 49 pr_info("Setting default memory size 0x%08x\n", memsize);
50 50
51 memset(mdesc, 0, sizeof(mdesc)); 51 memset(mdesc, 0, sizeof(mdesc));
52 52
diff --git a/arch/mips/mips-boards/sim/sim_setup.c b/arch/mips/mips-boards/sim/sim_setup.c
index ea2066c3a1f..b705f09e57c 100644
--- a/arch/mips/mips-boards/sim/sim_setup.c
+++ b/arch/mips/mips-boards/sim/sim_setup.c
@@ -55,7 +55,7 @@ void __init plat_mem_setup(void)
55 serial_init(); 55 serial_init();
56 56
57 board_time_init = sim_time_init; 57 board_time_init = sim_time_init;
58 prom_printf("Linux started...\n"); 58 pr_info("Linux started...\n");
59 59
60#ifdef CONFIG_MIPS_MT_SMP 60#ifdef CONFIG_MIPS_MT_SMP
61 sanitize_tlb_entries(); 61 sanitize_tlb_entries();
@@ -66,7 +66,7 @@ void prom_init(void)
66{ 66{
67 set_io_port_base(0xbfd00000); 67 set_io_port_base(0xbfd00000);
68 68
69 prom_printf("\nLINUX started...\n"); 69 pr_info("\nLINUX started...\n");
70 prom_init_cmdline(); 70 prom_init_cmdline();
71 prom_meminit(); 71 prom_meminit();
72} 72}
@@ -91,7 +91,7 @@ static void __init serial_init(void)
91 s.timeout = 4; 91 s.timeout = 4;
92 92
93 if (early_serial_setup(&s) != 0) { 93 if (early_serial_setup(&s) != 0) {
94 prom_printf(KERN_ERR "Serial setup failed!\n"); 94 printk(KERN_ERR "Serial setup failed!\n");
95 } 95 }
96 96
97#endif 97#endif
diff --git a/arch/mips/mips-boards/sim/sim_time.c b/arch/mips/mips-boards/sim/sim_time.c
index 30711d016fe..d3a21c74151 100644
--- a/arch/mips/mips-boards/sim/sim_time.c
+++ b/arch/mips/mips-boards/sim/sim_time.c
@@ -199,7 +199,4 @@ void __init plat_timer_setup(struct irqaction *irq)
199 irq_desc[mips_cpu_timer_irq].flags |= IRQ_PER_CPU; 199 irq_desc[mips_cpu_timer_irq].flags |= IRQ_PER_CPU;
200 set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq); 200 set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq);
201#endif 201#endif
202
203 /* to generate the first timer interrupt */
204 write_c0_compare(read_c0_count() + (mips_hpt_frequency/HZ));
205} 202}
diff --git a/arch/mips/mm/cerr-sb1.c b/arch/mips/mm/cerr-sb1.c
index e19fbb9ee47..11a916629d3 100644
--- a/arch/mips/mm/cerr-sb1.c
+++ b/arch/mips/mm/cerr-sb1.c
@@ -77,66 +77,66 @@ static uint32_t extract_dc(unsigned short addr, int data);
77static inline void breakout_errctl(unsigned int val) 77static inline void breakout_errctl(unsigned int val)
78{ 78{
79 if (val & CP0_ERRCTL_RECOVERABLE) 79 if (val & CP0_ERRCTL_RECOVERABLE)
80 prom_printf(" recoverable"); 80 printk(" recoverable");
81 if (val & CP0_ERRCTL_DCACHE) 81 if (val & CP0_ERRCTL_DCACHE)
82 prom_printf(" dcache"); 82 printk(" dcache");
83 if (val & CP0_ERRCTL_ICACHE) 83 if (val & CP0_ERRCTL_ICACHE)
84 prom_printf(" icache"); 84 printk(" icache");
85 if (val & CP0_ERRCTL_MULTIBUS) 85 if (val & CP0_ERRCTL_MULTIBUS)
86 prom_printf(" multiple-buserr"); 86 printk(" multiple-buserr");
87 prom_printf("\n"); 87 printk("\n");
88} 88}
89 89
90static inline void breakout_cerri(unsigned int val) 90static inline void breakout_cerri(unsigned int val)
91{ 91{
92 if (val & CP0_CERRI_TAG_PARITY) 92 if (val & CP0_CERRI_TAG_PARITY)
93 prom_printf(" tag-parity"); 93 printk(" tag-parity");
94 if (val & CP0_CERRI_DATA_PARITY) 94 if (val & CP0_CERRI_DATA_PARITY)
95 prom_printf(" data-parity"); 95 printk(" data-parity");
96 if (val & CP0_CERRI_EXTERNAL) 96 if (val & CP0_CERRI_EXTERNAL)
97 prom_printf(" external"); 97 printk(" external");
98 prom_printf("\n"); 98 printk("\n");
99} 99}
100 100
101static inline void breakout_cerrd(unsigned int val) 101static inline void breakout_cerrd(unsigned int val)
102{ 102{
103 switch (val & CP0_CERRD_CAUSES) { 103 switch (val & CP0_CERRD_CAUSES) {
104 case CP0_CERRD_LOAD: 104 case CP0_CERRD_LOAD:
105 prom_printf(" load,"); 105 printk(" load,");
106 break; 106 break;
107 case CP0_CERRD_STORE: 107 case CP0_CERRD_STORE:
108 prom_printf(" store,"); 108 printk(" store,");
109 break; 109 break;
110 case CP0_CERRD_FILLWB: 110 case CP0_CERRD_FILLWB:
111 prom_printf(" fill/wb,"); 111 printk(" fill/wb,");
112 break; 112 break;
113 case CP0_CERRD_COHERENCY: 113 case CP0_CERRD_COHERENCY:
114 prom_printf(" coherency,"); 114 printk(" coherency,");
115 break; 115 break;
116 case CP0_CERRD_DUPTAG: 116 case CP0_CERRD_DUPTAG:
117 prom_printf(" duptags,"); 117 printk(" duptags,");
118 break; 118 break;
119 default: 119 default:
120 prom_printf(" NO CAUSE,"); 120 printk(" NO CAUSE,");
121 break; 121 break;
122 } 122 }
123 if (!(val & CP0_CERRD_TYPES)) 123 if (!(val & CP0_CERRD_TYPES))
124 prom_printf(" NO TYPE"); 124 printk(" NO TYPE");
125 else { 125 else {
126 if (val & CP0_CERRD_MULTIPLE) 126 if (val & CP0_CERRD_MULTIPLE)
127 prom_printf(" multi-err"); 127 printk(" multi-err");
128 if (val & CP0_CERRD_TAG_STATE) 128 if (val & CP0_CERRD_TAG_STATE)
129 prom_printf(" tag-state"); 129 printk(" tag-state");
130 if (val & CP0_CERRD_TAG_ADDRESS) 130 if (val & CP0_CERRD_TAG_ADDRESS)
131 prom_printf(" tag-address"); 131 printk(" tag-address");
132 if (val & CP0_CERRD_DATA_SBE) 132 if (val & CP0_CERRD_DATA_SBE)
133 prom_printf(" data-SBE"); 133 printk(" data-SBE");
134 if (val & CP0_CERRD_DATA_DBE) 134 if (val & CP0_CERRD_DATA_DBE)
135 prom_printf(" data-DBE"); 135 printk(" data-DBE");
136 if (val & CP0_CERRD_EXTERNAL) 136 if (val & CP0_CERRD_EXTERNAL)
137 prom_printf(" external"); 137 printk(" external");
138 } 138 }
139 prom_printf("\n"); 139 printk("\n");
140} 140}
141 141
142#ifndef CONFIG_SIBYTE_BUS_WATCHER 142#ifndef CONFIG_SIBYTE_BUS_WATCHER
@@ -157,18 +157,18 @@ static void check_bus_watcher(void)
157 l2_tag = in64(IO_SPACE_BASE | A_L2_ECC_TAG); 157 l2_tag = in64(IO_SPACE_BASE | A_L2_ECC_TAG);
158#endif 158#endif
159 memio_err = csr_in32(IOADDR(A_BUS_MEM_IO_ERRORS)); 159 memio_err = csr_in32(IOADDR(A_BUS_MEM_IO_ERRORS));
160 prom_printf("Bus watcher error counters: %08x %08x\n", l2_err, memio_err); 160 printk("Bus watcher error counters: %08x %08x\n", l2_err, memio_err);
161 prom_printf("\nLast recorded signature:\n"); 161 printk("\nLast recorded signature:\n");
162 prom_printf("Request %02x from %d, answered by %d with Dcode %d\n", 162 printk("Request %02x from %d, answered by %d with Dcode %d\n",
163 (unsigned int)(G_SCD_BERR_TID(status) & 0x3f), 163 (unsigned int)(G_SCD_BERR_TID(status) & 0x3f),
164 (int)(G_SCD_BERR_TID(status) >> 6), 164 (int)(G_SCD_BERR_TID(status) >> 6),
165 (int)G_SCD_BERR_RID(status), 165 (int)G_SCD_BERR_RID(status),
166 (int)G_SCD_BERR_DCODE(status)); 166 (int)G_SCD_BERR_DCODE(status));
167#ifdef DUMP_L2_ECC_TAG_ON_ERROR 167#ifdef DUMP_L2_ECC_TAG_ON_ERROR
168 prom_printf("Last L2 tag w/ bad ECC: %016llx\n", l2_tag); 168 printk("Last L2 tag w/ bad ECC: %016llx\n", l2_tag);
169#endif 169#endif
170 } else { 170 } else {
171 prom_printf("Bus watcher indicates no error\n"); 171 printk("Bus watcher indicates no error\n");
172 } 172 }
173} 173}
174#else 174#else
@@ -187,11 +187,11 @@ asmlinkage void sb1_cache_error(void)
187#else 187#else
188 csr_out32(M_SCD_TRACE_CFG_FREEZE, IO_SPACE_BASE | A_SCD_TRACE_CFG); 188 csr_out32(M_SCD_TRACE_CFG_FREEZE, IO_SPACE_BASE | A_SCD_TRACE_CFG);
189#endif 189#endif
190 prom_printf("Trace buffer frozen\n"); 190 printk("Trace buffer frozen\n");
191#endif 191#endif
192 192
193 prom_printf("Cache error exception on CPU %x:\n", 193 printk("Cache error exception on CPU %x:\n",
194 (read_c0_prid() >> 25) & 0x7); 194 (read_c0_prid() >> 25) & 0x7);
195 195
196 __asm__ __volatile__ ( 196 __asm__ __volatile__ (
197 " .set push\n\t" 197 " .set push\n\t"
@@ -209,43 +209,43 @@ asmlinkage void sb1_cache_error(void)
209 "=r" (dpahi), "=r" (dpalo), "=r" (eepc)); 209 "=r" (dpahi), "=r" (dpalo), "=r" (eepc));
210 210
211 cerr_dpa = (((uint64_t)dpahi) << 32) | dpalo; 211 cerr_dpa = (((uint64_t)dpahi) << 32) | dpalo;
212 prom_printf(" c0_errorepc == %08x\n", eepc); 212 printk(" c0_errorepc == %08x\n", eepc);
213 prom_printf(" c0_errctl == %08x", errctl); 213 printk(" c0_errctl == %08x", errctl);
214 breakout_errctl(errctl); 214 breakout_errctl(errctl);
215 if (errctl & CP0_ERRCTL_ICACHE) { 215 if (errctl & CP0_ERRCTL_ICACHE) {
216 prom_printf(" c0_cerr_i == %08x", cerr_i); 216 printk(" c0_cerr_i == %08x", cerr_i);
217 breakout_cerri(cerr_i); 217 breakout_cerri(cerr_i);
218 if (CP0_CERRI_IDX_VALID(cerr_i)) { 218 if (CP0_CERRI_IDX_VALID(cerr_i)) {
219 /* Check index of EPC, allowing for delay slot */ 219 /* Check index of EPC, allowing for delay slot */
220 if (((eepc & SB1_CACHE_INDEX_MASK) != (cerr_i & SB1_CACHE_INDEX_MASK)) && 220 if (((eepc & SB1_CACHE_INDEX_MASK) != (cerr_i & SB1_CACHE_INDEX_MASK)) &&
221 ((eepc & SB1_CACHE_INDEX_MASK) != ((cerr_i & SB1_CACHE_INDEX_MASK) - 4))) 221 ((eepc & SB1_CACHE_INDEX_MASK) != ((cerr_i & SB1_CACHE_INDEX_MASK) - 4)))
222 prom_printf(" cerr_i idx doesn't match eepc\n"); 222 printk(" cerr_i idx doesn't match eepc\n");
223 else { 223 else {
224 res = extract_ic(cerr_i & SB1_CACHE_INDEX_MASK, 224 res = extract_ic(cerr_i & SB1_CACHE_INDEX_MASK,
225 (cerr_i & CP0_CERRI_DATA) != 0); 225 (cerr_i & CP0_CERRI_DATA) != 0);
226 if (!(res & cerr_i)) 226 if (!(res & cerr_i))
227 prom_printf("...didn't see indicated icache problem\n"); 227 printk("...didn't see indicated icache problem\n");
228 } 228 }
229 } 229 }
230 } 230 }
231 if (errctl & CP0_ERRCTL_DCACHE) { 231 if (errctl & CP0_ERRCTL_DCACHE) {
232 prom_printf(" c0_cerr_d == %08x", cerr_d); 232 printk(" c0_cerr_d == %08x", cerr_d);
233 breakout_cerrd(cerr_d); 233 breakout_cerrd(cerr_d);
234 if (CP0_CERRD_DPA_VALID(cerr_d)) { 234 if (CP0_CERRD_DPA_VALID(cerr_d)) {
235 prom_printf(" c0_cerr_dpa == %010llx\n", cerr_dpa); 235 printk(" c0_cerr_dpa == %010llx\n", cerr_dpa);
236 if (!CP0_CERRD_IDX_VALID(cerr_d)) { 236 if (!CP0_CERRD_IDX_VALID(cerr_d)) {
237 res = extract_dc(cerr_dpa & SB1_CACHE_INDEX_MASK, 237 res = extract_dc(cerr_dpa & SB1_CACHE_INDEX_MASK,
238 (cerr_d & CP0_CERRD_DATA) != 0); 238 (cerr_d & CP0_CERRD_DATA) != 0);
239 if (!(res & cerr_d)) 239 if (!(res & cerr_d))
240 prom_printf("...didn't see indicated dcache problem\n"); 240 printk("...didn't see indicated dcache problem\n");
241 } else { 241 } else {
242 if ((cerr_dpa & SB1_CACHE_INDEX_MASK) != (cerr_d & SB1_CACHE_INDEX_MASK)) 242 if ((cerr_dpa & SB1_CACHE_INDEX_MASK) != (cerr_d & SB1_CACHE_INDEX_MASK))
243 prom_printf(" cerr_d idx doesn't match cerr_dpa\n"); 243 printk(" cerr_d idx doesn't match cerr_dpa\n");
244 else { 244 else {
245 res = extract_dc(cerr_d & SB1_CACHE_INDEX_MASK, 245 res = extract_dc(cerr_d & SB1_CACHE_INDEX_MASK,
246 (cerr_d & CP0_CERRD_DATA) != 0); 246 (cerr_d & CP0_CERRD_DATA) != 0);
247 if (!(res & cerr_d)) 247 if (!(res & cerr_d))
248 prom_printf("...didn't see indicated problem\n"); 248 printk("...didn't see indicated problem\n");
249 } 249 }
250 } 250 }
251 } 251 }
@@ -334,7 +334,7 @@ static uint32_t extract_ic(unsigned short addr, int data)
334 uint8_t lru; 334 uint8_t lru;
335 int res = 0; 335 int res = 0;
336 336
337 prom_printf("Icache index 0x%04x ", addr); 337 printk("Icache index 0x%04x ", addr);
338 for (way = 0; way < 4; way++) { 338 for (way = 0; way < 4; way++) {
339 /* Index-load-tag-I */ 339 /* Index-load-tag-I */
340 __asm__ __volatile__ ( 340 __asm__ __volatile__ (
@@ -354,7 +354,7 @@ static uint32_t extract_ic(unsigned short addr, int data)
354 taglo = ((unsigned long long)taglohi << 32) | taglolo; 354 taglo = ((unsigned long long)taglohi << 32) | taglolo;
355 if (way == 0) { 355 if (way == 0) {
356 lru = (taghi >> 14) & 0xff; 356 lru = (taghi >> 14) & 0xff;
357 prom_printf("[Bank %d Set 0x%02x] LRU > %d %d %d %d > MRU\n", 357 printk("[Bank %d Set 0x%02x] LRU > %d %d %d %d > MRU\n",
358 ((addr >> 5) & 0x3), /* bank */ 358 ((addr >> 5) & 0x3), /* bank */
359 ((addr >> 7) & 0x3f), /* index */ 359 ((addr >> 7) & 0x3f), /* index */
360 (lru & 0x3), 360 (lru & 0x3),
@@ -369,19 +369,19 @@ static uint32_t extract_ic(unsigned short addr, int data)
369 if (valid) { 369 if (valid) {
370 tlo_tmp = taglo & 0xfff3ff; 370 tlo_tmp = taglo & 0xfff3ff;
371 if (((taglo >> 10) & 1) ^ range_parity(tlo_tmp, 23, 0)) { 371 if (((taglo >> 10) & 1) ^ range_parity(tlo_tmp, 23, 0)) {
372 prom_printf(" ** bad parity in VTag0/G/ASID\n"); 372 printk(" ** bad parity in VTag0/G/ASID\n");
373 res |= CP0_CERRI_TAG_PARITY; 373 res |= CP0_CERRI_TAG_PARITY;
374 } 374 }
375 if (((taglo >> 11) & 1) ^ range_parity(taglo, 63, 24)) { 375 if (((taglo >> 11) & 1) ^ range_parity(taglo, 63, 24)) {
376 prom_printf(" ** bad parity in R/VTag1\n"); 376 printk(" ** bad parity in R/VTag1\n");
377 res |= CP0_CERRI_TAG_PARITY; 377 res |= CP0_CERRI_TAG_PARITY;
378 } 378 }
379 } 379 }
380 if (valid ^ ((taghi >> 27) & 1)) { 380 if (valid ^ ((taghi >> 27) & 1)) {
381 prom_printf(" ** bad parity for valid bit\n"); 381 printk(" ** bad parity for valid bit\n");
382 res |= CP0_CERRI_TAG_PARITY; 382 res |= CP0_CERRI_TAG_PARITY;
383 } 383 }
384 prom_printf(" %d [VA %016llx] [Vld? %d] raw tags: %08X-%016llX\n", 384 printk(" %d [VA %016llx] [Vld? %d] raw tags: %08X-%016llX\n",
385 way, va, valid, taghi, taglo); 385 way, va, valid, taghi, taglo);
386 386
387 if (data) { 387 if (data) {
@@ -407,21 +407,21 @@ static uint32_t extract_ic(unsigned short addr, int data)
407 : "r" ((way << 13) | addr | (offset << 3))); 407 : "r" ((way << 13) | addr | (offset << 3)));
408 predecode = (datahi >> 8) & 0xff; 408 predecode = (datahi >> 8) & 0xff;
409 if (((datahi >> 16) & 1) != (uint32_t)range_parity(predecode, 7, 0)) { 409 if (((datahi >> 16) & 1) != (uint32_t)range_parity(predecode, 7, 0)) {
410 prom_printf(" ** bad parity in predecode\n"); 410 printk(" ** bad parity in predecode\n");
411 res |= CP0_CERRI_DATA_PARITY; 411 res |= CP0_CERRI_DATA_PARITY;
412 } 412 }
413 /* XXXKW should/could check predecode bits themselves */ 413 /* XXXKW should/could check predecode bits themselves */
414 if (((datahi >> 4) & 0xf) ^ inst_parity(insta)) { 414 if (((datahi >> 4) & 0xf) ^ inst_parity(insta)) {
415 prom_printf(" ** bad parity in instruction a\n"); 415 printk(" ** bad parity in instruction a\n");
416 res |= CP0_CERRI_DATA_PARITY; 416 res |= CP0_CERRI_DATA_PARITY;
417 } 417 }
418 if ((datahi & 0xf) ^ inst_parity(instb)) { 418 if ((datahi & 0xf) ^ inst_parity(instb)) {
419 prom_printf(" ** bad parity in instruction b\n"); 419 printk(" ** bad parity in instruction b\n");
420 res |= CP0_CERRI_DATA_PARITY; 420 res |= CP0_CERRI_DATA_PARITY;
421 } 421 }
422 prom_printf(" %05X-%08X%08X", datahi, insta, instb); 422 printk(" %05X-%08X%08X", datahi, insta, instb);
423 } 423 }
424 prom_printf("\n"); 424 printk("\n");
425 } 425 }
426 } 426 }
427 return res; 427 return res;
@@ -489,7 +489,7 @@ static uint32_t extract_dc(unsigned short addr, int data)
489 uint8_t ecc, lru; 489 uint8_t ecc, lru;
490 int res = 0; 490 int res = 0;
491 491
492 prom_printf("Dcache index 0x%04x ", addr); 492 printk("Dcache index 0x%04x ", addr);
493 for (way = 0; way < 4; way++) { 493 for (way = 0; way < 4; way++) {
494 __asm__ __volatile__ ( 494 __asm__ __volatile__ (
495 " .set push\n\t" 495 " .set push\n\t"
@@ -509,7 +509,7 @@ static uint32_t extract_dc(unsigned short addr, int data)
509 pa = (taglo & 0xFFFFFFE000ULL) | addr; 509 pa = (taglo & 0xFFFFFFE000ULL) | addr;
510 if (way == 0) { 510 if (way == 0) {
511 lru = (taghi >> 14) & 0xff; 511 lru = (taghi >> 14) & 0xff;
512 prom_printf("[Bank %d Set 0x%02x] LRU > %d %d %d %d > MRU\n", 512 printk("[Bank %d Set 0x%02x] LRU > %d %d %d %d > MRU\n",
513 ((addr >> 11) & 0x2) | ((addr >> 5) & 1), /* bank */ 513 ((addr >> 11) & 0x2) | ((addr >> 5) & 1), /* bank */
514 ((addr >> 6) & 0x3f), /* index */ 514 ((addr >> 6) & 0x3f), /* index */
515 (lru & 0x3), 515 (lru & 0x3),
@@ -519,15 +519,15 @@ static uint32_t extract_dc(unsigned short addr, int data)
519 } 519 }
520 state = (taghi >> 25) & 0x1f; 520 state = (taghi >> 25) & 0x1f;
521 valid = DC_TAG_VALID(state); 521 valid = DC_TAG_VALID(state);
522 prom_printf(" %d [PA %010llx] [state %s (%02x)] raw tags: %08X-%016llX\n", 522 printk(" %d [PA %010llx] [state %s (%02x)] raw tags: %08X-%016llX\n",
523 way, pa, dc_state_str(state), state, taghi, taglo); 523 way, pa, dc_state_str(state), state, taghi, taglo);
524 if (valid) { 524 if (valid) {
525 if (((taglo >> 11) & 1) ^ range_parity(taglo, 39, 26)) { 525 if (((taglo >> 11) & 1) ^ range_parity(taglo, 39, 26)) {
526 prom_printf(" ** bad parity in PTag1\n"); 526 printk(" ** bad parity in PTag1\n");
527 res |= CP0_CERRD_TAG_ADDRESS; 527 res |= CP0_CERRD_TAG_ADDRESS;
528 } 528 }
529 if (((taglo >> 10) & 1) ^ range_parity(taglo, 25, 13)) { 529 if (((taglo >> 10) & 1) ^ range_parity(taglo, 25, 13)) {
530 prom_printf(" ** bad parity in PTag0\n"); 530 printk(" ** bad parity in PTag0\n");
531 res |= CP0_CERRD_TAG_ADDRESS; 531 res |= CP0_CERRD_TAG_ADDRESS;
532 } 532 }
533 } else { 533 } else {
@@ -567,13 +567,13 @@ static uint32_t extract_dc(unsigned short addr, int data)
567 } 567 }
568 res |= (bits == 1) ? CP0_CERRD_DATA_SBE : CP0_CERRD_DATA_DBE; 568 res |= (bits == 1) ? CP0_CERRD_DATA_SBE : CP0_CERRD_DATA_DBE;
569 } 569 }
570 prom_printf(" %02X-%016llX", datahi, datalo); 570 printk(" %02X-%016llX", datahi, datalo);
571 } 571 }
572 prom_printf("\n"); 572 printk("\n");
573 if (bad_ecc) 573 if (bad_ecc)
574 prom_printf(" dwords w/ bad ECC: %d %d %d %d\n", 574 printk(" dwords w/ bad ECC: %d %d %d %d\n",
575 !!(bad_ecc & 8), !!(bad_ecc & 4), 575 !!(bad_ecc & 8), !!(bad_ecc & 4),
576 !!(bad_ecc & 2), !!(bad_ecc & 1)); 576 !!(bad_ecc & 2), !!(bad_ecc & 1));
577 } 577 }
578 } 578 }
579 return res; 579 return res;
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index a72093ad105..f503d02e403 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -295,7 +295,7 @@ void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
295 295
296 /* Make sure that gcc doesn't leave the empty loop body. */ 296 /* Make sure that gcc doesn't leave the empty loop body. */
297 for (i = 0; i < nelems; i++, sg++) { 297 for (i = 0; i < nelems; i++, sg++) {
298 if (!plat_device_is_coherent(dev)) 298 if (cpu_is_noncoherent_r10000(dev))
299 __dma_sync((unsigned long)page_address(sg->page), 299 __dma_sync((unsigned long)page_address(sg->page),
300 sg->length, direction); 300 sg->length, direction);
301 plat_unmap_dma_mem(sg->dma_address); 301 plat_unmap_dma_mem(sg->dma_address);
diff --git a/arch/mips/momentum/jaguar_atx/ja-console.c b/arch/mips/momentum/jaguar_atx/ja-console.c
index 2292d0ec47f..2c30b4f5624 100644
--- a/arch/mips/momentum/jaguar_atx/ja-console.c
+++ b/arch/mips/momentum/jaguar_atx/ja-console.c
@@ -74,11 +74,6 @@ void prom_putchar(char c)
74 uart->iu_thr = c; 74 uart->iu_thr = c;
75} 75}
76 76
77char __init prom_getchar(void)
78{
79 return 0;
80}
81
82static void inline ja_console_probe(void) 77static void inline ja_console_probe(void)
83{ 78{
84 struct uart_port up; 79 struct uart_port up;
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index 455d76ad06d..9d08608aaa5 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -223,10 +223,12 @@ static inline int n_counters(void)
223 switch (current_cpu_data.cputype) { 223 switch (current_cpu_data.cputype) {
224 case CPU_R10000: 224 case CPU_R10000:
225 counters = 2; 225 counters = 2;
226 break;
226 227
227 case CPU_R12000: 228 case CPU_R12000:
228 case CPU_R14000: 229 case CPU_R14000:
229 counters = 4; 230 counters = 4;
231 break;
230 232
231 default: 233 default:
232 counters = __n_counters(); 234 counters = __n_counters();
diff --git a/arch/mips/pci/fixup-jmr3927.c b/arch/mips/pci/fixup-jmr3927.c
index f8696081c5b..6e72d213f4c 100644
--- a/arch/mips/pci/fixup-jmr3927.c
+++ b/arch/mips/pci/fixup-jmr3927.c
@@ -38,6 +38,10 @@ int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
38{ 38{
39 unsigned char irq = pin; 39 unsigned char irq = pin;
40 40
41 /* SMSC SLC90E66 IDE uses irq 14, 15 (default) */
42 if (dev->vendor == PCI_VENDOR_ID_EFAR &&
43 dev->device == PCI_DEVICE_ID_EFAR_SLC90E66_1)
44 return irq;
41 /* IRQ rotation (PICMG) */ 45 /* IRQ rotation (PICMG) */
42 irq--; /* 0-3 */ 46 irq--; /* 0-3 */
43 if (dev->bus->parent == NULL && 47 if (dev->bus->parent == NULL &&
@@ -93,13 +97,3 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
93{ 97{
94 return 0; 98 return 0;
95} 99}
96
97int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
98{
99 /* SMSC SLC90E66 IDE uses irq 14, 15 (default) */
100 if (!(dev->vendor == PCI_VENDOR_ID_EFAR &&
101 dev->device == PCI_DEVICE_ID_EFAR_SLC90E66_1))
102 return pci_get_irq(dev, pin);
103
104 dev->irq = irq;
105}
diff --git a/arch/mips/pci/fixup-sni.c b/arch/mips/pci/fixup-sni.c
index 0c9a4732d45..36e5fb1b378 100644
--- a/arch/mips/pci/fixup-sni.c
+++ b/arch/mips/pci/fixup-sni.c
@@ -14,6 +14,8 @@
14#include <asm/mipsregs.h> 14#include <asm/mipsregs.h>
15#include <asm/sni.h> 15#include <asm/sni.h>
16 16
17#include <irq.h>
18
17/* 19/*
18 * PCIMT Shortcuts ... 20 * PCIMT Shortcuts ...
19 */ 21 */
diff --git a/arch/mips/pci/ops-au1000.c b/arch/mips/pci/ops-au1000.c
index 8ae46481fcb..7932dfe5eb9 100644
--- a/arch/mips/pci/ops-au1000.c
+++ b/arch/mips/pci/ops-au1000.c
@@ -172,7 +172,11 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
172 error = -1; 172 error = -1;
173 DBG("Au1x Master Abort\n"); 173 DBG("Au1x Master Abort\n");
174 } else if ((status >> 28) & 0xf) { 174 } else if ((status >> 28) & 0xf) {
175 DBG("PCI ERR detected: status %x\n", status); 175 DBG("PCI ERR detected: device %d, status %x\n", device, ((status >> 28) & 0xf));
176
177 /* clear errors */
178 au_writel(status & 0xf000ffff, Au1500_PCI_STATCMD);
179
176 *data = 0xffffffff; 180 *data = 0xffffffff;
177 error = -1; 181 error = -1;
178 } 182 }
diff --git a/arch/mips/philips/pnx8550/common/prom.c b/arch/mips/philips/pnx8550/common/prom.c
index 8aeed6c2b8c..2f567452e7a 100644
--- a/arch/mips/philips/pnx8550/common/prom.c
+++ b/arch/mips/philips/pnx8550/common/prom.c
@@ -112,7 +112,7 @@ void __init prom_free_prom_memory(void)
112 112
113extern int pnx8550_console_port; 113extern int pnx8550_console_port;
114 114
115/* used by prom_printf */ 115/* used by early printk */
116void prom_putchar(char c) 116void prom_putchar(char c)
117{ 117{
118 if (pnx8550_console_port != -1) { 118 if (pnx8550_console_port != -1) {
diff --git a/arch/mips/philips/pnx8550/common/setup.c b/arch/mips/philips/pnx8550/common/setup.c
index e62123ca9b6..5bd73747768 100644
--- a/arch/mips/philips/pnx8550/common/setup.c
+++ b/arch/mips/philips/pnx8550/common/setup.c
@@ -41,8 +41,6 @@
41#include <uart.h> 41#include <uart.h>
42#include <nand.h> 42#include <nand.h>
43 43
44extern void prom_printf(char *fmt, ...);
45
46extern void __init board_setup(void); 44extern void __init board_setup(void);
47extern void pnx8550_machine_restart(char *); 45extern void pnx8550_machine_restart(char *);
48extern void pnx8550_machine_halt(void); 46extern void pnx8550_machine_halt(void);
@@ -51,7 +49,6 @@ extern struct resource ioport_resource;
51extern struct resource iomem_resource; 49extern struct resource iomem_resource;
52extern void pnx8550_time_init(void); 50extern void pnx8550_time_init(void);
53extern void rs_kgdb_hook(int tty_no); 51extern void rs_kgdb_hook(int tty_no);
54extern void prom_printf(char *fmt, ...);
55extern char *prom_getcmdline(void); 52extern char *prom_getcmdline(void);
56 53
57struct resource standard_io_resources[] = { 54struct resource standard_io_resources[] = {
@@ -141,7 +138,7 @@ void __init plat_mem_setup(void)
141 argptr += strlen("console=ttyS"); 138 argptr += strlen("console=ttyS");
142 pnx8550_console_port = *argptr == '0' ? 0 : 1; 139 pnx8550_console_port = *argptr == '0' ? 0 : 1;
143 140
144 /* We must initialize the UART (console) before prom_printf */ 141 /* We must initialize the UART (console) before early printk */
145 /* Set LCR to 8-bit and BAUD to 38400 (no 5) */ 142 /* Set LCR to 8-bit and BAUD to 38400 (no 5) */
146 ip3106_lcr(UART_BASE, pnx8550_console_port) = 143 ip3106_lcr(UART_BASE, pnx8550_console_port) =
147 PNX8XXX_UART_LCR_8BIT; 144 PNX8XXX_UART_LCR_8BIT;
@@ -155,8 +152,8 @@ void __init plat_mem_setup(void)
155 argptr += strlen("kgdb=ttyS"); 152 argptr += strlen("kgdb=ttyS");
156 line = *argptr == '0' ? 0 : 1; 153 line = *argptr == '0' ? 0 : 1;
157 rs_kgdb_hook(line); 154 rs_kgdb_hook(line);
158 prom_printf("KGDB: Using ttyS%i for session, " 155 pr_info("KGDB: Using ttyS%i for session, "
159 "please connect your debugger\n", line ? 1 : 0); 156 "please connect your debugger\n", line ? 1 : 0);
160 } 157 }
161#endif 158#endif
162 return; 159 return;
diff --git a/arch/mips/pmc-sierra/yosemite/py-console.c b/arch/mips/pmc-sierra/yosemite/py-console.c
index 757e605693f..b7f1d9c4a8a 100644
--- a/arch/mips/pmc-sierra/yosemite/py-console.c
+++ b/arch/mips/pmc-sierra/yosemite/py-console.c
@@ -107,8 +107,3 @@ void prom_putchar(char c)
107 while ((readb_outer_space(lsr) & 0x20) == 0); 107 while ((readb_outer_space(lsr) & 0x20) == 0);
108 writeb_outer_space(thr, c); 108 writeb_outer_space(thr, c);
109} 109}
110
111char __init prom_getchar(void)
112{
113 return 0;
114}
diff --git a/arch/mips/sgi-ip27/ip27-console.c b/arch/mips/sgi-ip27/ip27-console.c
index 14211e38237..3ba830651c5 100644
--- a/arch/mips/sgi-ip27/ip27-console.c
+++ b/arch/mips/sgi-ip27/ip27-console.c
@@ -6,12 +6,6 @@
6 * Copyright (C) 2001, 2002 Ralf Baechle 6 * Copyright (C) 2001, 2002 Ralf Baechle
7 */ 7 */
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/console.h>
10#include <linux/kdev_t.h>
11#include <linux/major.h>
12#include <linux/termios.h>
13#include <linux/sched.h>
14#include <linux/tty.h>
15 9
16#include <asm/page.h> 10#include <asm/page.h>
17#include <asm/semaphore.h> 11#include <asm/semaphore.h>
@@ -38,37 +32,10 @@ static inline struct ioc3_uartregs *console_uart(void)
38 return &ioc3->sregs.uarta; 32 return &ioc3->sregs.uarta;
39} 33}
40 34
41void prom_putchar(char c) 35void __init prom_putchar(char c)
42{ 36{
43 struct ioc3_uartregs *uart = console_uart(); 37 struct ioc3_uartregs *uart = console_uart();
44 38
45 while ((uart->iu_lsr & 0x20) == 0); 39 while ((uart->iu_lsr & 0x20) == 0);
46 uart->iu_thr = c; 40 uart->iu_thr = c;
47} 41}
48
49static void ioc3_console_write(struct console *con, const char *s, unsigned n)
50{
51 while (n-- && *s) {
52 if (*s == '\n')
53 prom_putchar('\r');
54 prom_putchar(*s);
55 s++;
56 }
57}
58
59static struct console ioc3_console = {
60 .name = "ioc3",
61 .write = ioc3_console_write,
62 .flags = CON_PRINTBUFFER | CON_BOOT,
63 .index = -1
64};
65
66__init void ip27_setup_console(void)
67{
68 register_console(&ioc3_console);
69}
70
71void __init disable_early_printk(void)
72{
73 unregister_console(&ioc3_console);
74}
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig
index ec7a2cffacf..67dac6204b6 100644
--- a/arch/mips/sibyte/Kconfig
+++ b/arch/mips/sibyte/Kconfig
@@ -116,6 +116,7 @@ config SB1_CERR_STALL
116config SIBYTE_CFE 116config SIBYTE_CFE
117 bool "Booting from CFE" 117 bool "Booting from CFE"
118 depends on SIBYTE_SB1xxx_SOC 118 depends on SIBYTE_SB1xxx_SOC
119 select SYS_HAS_EARLY_PRINTK
119 help 120 help
120 Make use of the CFE API for enumerating available memory, 121 Make use of the CFE API for enumerating available memory,
121 controlling secondary CPUs, and possibly console output. 122 controlling secondary CPUs, and possibly console output.
@@ -131,6 +132,7 @@ config SIBYTE_CFE_CONSOLE
131config SIBYTE_STANDALONE 132config SIBYTE_STANDALONE
132 bool 133 bool
133 depends on SIBYTE_SB1xxx_SOC && !SIBYTE_CFE 134 depends on SIBYTE_SB1xxx_SOC && !SIBYTE_CFE
135 select SYS_HAS_EARLY_PRINTK
134 default y 136 default y
135 137
136config SIBYTE_STANDALONE_RAM_SIZE 138config SIBYTE_STANDALONE_RAM_SIZE
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index 1dc5d05d896..20af0f1bb7b 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -420,7 +420,7 @@ void __init arch_init_irq(void)
420#ifdef CONFIG_GDB_CONSOLE 420#ifdef CONFIG_GDB_CONSOLE
421 register_gdb_console(); 421 register_gdb_console();
422#endif 422#endif
423 prom_printf("Waiting for GDB on UART port %d\n", kgdb_port); 423 printk("Waiting for GDB on UART port %d\n", kgdb_port);
424 set_debug_traps(); 424 set_debug_traps();
425 breakpoint(); 425 breakpoint();
426 } 426 }
diff --git a/arch/mips/sibyte/bcm1480/setup.c b/arch/mips/sibyte/bcm1480/setup.c
index 8236d0c4854..bdaac34ae70 100644
--- a/arch/mips/sibyte/bcm1480/setup.c
+++ b/arch/mips/sibyte/bcm1480/setup.c
@@ -69,7 +69,7 @@ static inline int sys_rev_decode(void)
69 break; 69 break;
70 70
71 default: 71 default:
72 prom_printf("Unknown part type %x\n", part_type); 72 printk("Unknown part type %x\n", part_type);
73 ret = 1; 73 ret = 1;
74 break; 74 break;
75 } 75 }
@@ -102,7 +102,7 @@ static inline int setup_bcm1x80_bcm1x55(void)
102 pass_str = "B0 (pass2)"; 102 pass_str = "B0 (pass2)";
103 break; 103 break;
104 default: 104 default:
105 prom_printf("Unknown %s rev %x\n", soc_str, soc_pass); 105 printk("Unknown %s rev %x\n", soc_str, soc_pass);
106 periph_rev = 1; 106 periph_rev = 1;
107 pass_str = "Unknown Revision"; 107 pass_str = "Unknown Revision";
108 break; 108 break;
@@ -122,14 +122,14 @@ void bcm1480_setup(void)
122 soc_pass = G_SYS_REVISION(sys_rev); 122 soc_pass = G_SYS_REVISION(sys_rev);
123 123
124 if (sys_rev_decode()) { 124 if (sys_rev_decode()) {
125 prom_printf("Restart after failure to identify SiByte chip\n"); 125 printk("Restart after failure to identify SiByte chip\n");
126 machine_restart(NULL); 126 machine_restart(NULL);
127 } 127 }
128 128
129 plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG))); 129 plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));
130 zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25); 130 zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25);
131 131
132 prom_printf("Broadcom SiByte %s %s @ %d MHz (SB-1A rev %d)\n", 132 printk("Broadcom SiByte %s %s @ %d MHz (SB-1A rev %d)\n",
133 soc_str, pass_str, zbbus_mhz * 2, sb1_pass); 133 soc_str, pass_str, zbbus_mhz * 2, sb1_pass);
134 prom_printf("Board type: %s\n", get_system_type()); 134 printk("Board type: %s\n", get_system_type());
135} 135}
diff --git a/arch/mips/sibyte/cfe/setup.c b/arch/mips/sibyte/cfe/setup.c
index 9e6099e6962..ae4a92c3e52 100644
--- a/arch/mips/sibyte/cfe/setup.c
+++ b/arch/mips/sibyte/cfe/setup.c
@@ -221,10 +221,10 @@ static int __init initrd_setup(char *str)
221 goto fail; 221 goto fail;
222 } 222 }
223 initrd_end = initrd_start + initrd_size; 223 initrd_end = initrd_start + initrd_size;
224 prom_printf("Found initrd of %lx@%lx\n", initrd_size, initrd_start); 224 printk("Found initrd of %lx@%lx\n", initrd_size, initrd_start);
225 return 1; 225 return 1;
226 fail: 226 fail:
227 prom_printf("Bad initrd argument. Disabling initrd\n"); 227 printk("Bad initrd argument. Disabling initrd\n");
228 initrd_start = 0; 228 initrd_start = 0;
229 initrd_end = 0; 229 initrd_end = 0;
230 return 1; 230 return 1;
@@ -281,7 +281,7 @@ void __init prom_init(void)
281 } 281 }
282 if (cfe_eptseal != CFE_EPTSEAL) { 282 if (cfe_eptseal != CFE_EPTSEAL) {
283 /* too early for panic to do any good */ 283 /* too early for panic to do any good */
284 prom_printf("CFE's entrypoint seal doesn't match. Spinning."); 284 printk("CFE's entrypoint seal doesn't match. Spinning.");
285 while (1) ; 285 while (1) ;
286 } 286 }
287 cfe_init(cfe_handle, cfe_ept); 287 cfe_init(cfe_handle, cfe_ept);
@@ -303,7 +303,7 @@ void __init prom_init(void)
303 } else { 303 } else {
304 /* The loader should have set the command line */ 304 /* The loader should have set the command line */
305 /* too early for panic to do any good */ 305 /* too early for panic to do any good */
306 prom_printf("LINUX_CMDLINE not defined in cfe."); 306 printk("LINUX_CMDLINE not defined in cfe.");
307 while (1) ; 307 while (1) ;
308 } 308 }
309 } 309 }
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c
index d0ee1d5b822..1cb042eab72 100644
--- a/arch/mips/sibyte/sb1250/setup.c
+++ b/arch/mips/sibyte/sb1250/setup.c
@@ -67,7 +67,7 @@ static int __init sys_rev_decode(void)
67 ret = setup_bcm112x(); 67 ret = setup_bcm112x();
68 break; 68 break;
69 default: 69 default:
70 prom_printf("Unknown SOC type %x\n", soc_type); 70 printk("Unknown SOC type %x\n", soc_type);
71 ret = 1; 71 ret = 1;
72 break; 72 break;
73 } 73 }
@@ -112,7 +112,7 @@ static int __init setup_bcm1250(void)
112 pass_str = "A0-A6"; 112 pass_str = "A0-A6";
113 war_pass = K_SYS_REVISION_BCM1250_PASS2; 113 war_pass = K_SYS_REVISION_BCM1250_PASS2;
114 } else { 114 } else {
115 prom_printf("Unknown BCM1250 rev %x\n", soc_pass); 115 printk("Unknown BCM1250 rev %x\n", soc_pass);
116 ret = 1; 116 ret = 1;
117 } 117 }
118 break; 118 break;
@@ -140,7 +140,7 @@ static int __init setup_bcm112x(void)
140 pass_str = "A2"; 140 pass_str = "A2";
141 break; 141 break;
142 default: 142 default:
143 prom_printf("Unknown %s rev %x\n", soc_str, soc_pass); 143 printk("Unknown %s rev %x\n", soc_str, soc_pass);
144 ret = 1; 144 ret = 1;
145 } 145 }
146 return ret; 146 return ret;
@@ -158,21 +158,21 @@ void __init sb1250_setup(void)
158 soc_pass = G_SYS_REVISION(sys_rev); 158 soc_pass = G_SYS_REVISION(sys_rev);
159 159
160 if (sys_rev_decode()) { 160 if (sys_rev_decode()) {
161 prom_printf("Restart after failure to identify SiByte chip\n"); 161 printk("Restart after failure to identify SiByte chip\n");
162 machine_restart(NULL); 162 machine_restart(NULL);
163 } 163 }
164 164
165 plldiv = G_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG))); 165 plldiv = G_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));
166 zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25); 166 zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25);
167 167
168 prom_printf("Broadcom SiByte %s %s @ %d MHz (SB1 rev %d)\n", 168 printk("Broadcom SiByte %s %s @ %d MHz (SB1 rev %d)\n",
169 soc_str, pass_str, zbbus_mhz * 2, sb1_pass); 169 soc_str, pass_str, zbbus_mhz * 2, sb1_pass);
170 prom_printf("Board type: %s\n", get_system_type()); 170 printk("Board type: %s\n", get_system_type());
171 171
172 switch (war_pass) { 172 switch (war_pass) {
173 case K_SYS_REVISION_BCM1250_PASS1: 173 case K_SYS_REVISION_BCM1250_PASS1:
174#ifndef CONFIG_SB1_PASS_1_WORKAROUNDS 174#ifndef CONFIG_SB1_PASS_1_WORKAROUNDS
175 prom_printf("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, " 175 printk("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, "
176 "and the kernel doesn't have the proper " 176 "and the kernel doesn't have the proper "
177 "workarounds compiled in. @@@@\n"); 177 "workarounds compiled in. @@@@\n");
178 bad_config = 1; 178 bad_config = 1;
@@ -182,27 +182,27 @@ void __init sb1250_setup(void)
182 /* Pass 2 - easiest as default for now - so many numbers */ 182 /* Pass 2 - easiest as default for now - so many numbers */
183#if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || \ 183#if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || \
184 !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) 184 !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS)
185 prom_printf("@@@@ This is a BCM1250 A3-A10 board, and the " 185 printk("@@@@ This is a BCM1250 A3-A10 board, and the "
186 "kernel doesn't have the proper workarounds " 186 "kernel doesn't have the proper workarounds "
187 "compiled in. @@@@\n"); 187 "compiled in. @@@@\n");
188 bad_config = 1; 188 bad_config = 1;
189#endif 189#endif
190#ifdef CONFIG_CPU_HAS_PREFETCH 190#ifdef CONFIG_CPU_HAS_PREFETCH
191 prom_printf("@@@@ Prefetches may be enabled in this kernel, " 191 printk("@@@@ Prefetches may be enabled in this kernel, "
192 "but are buggy on this board. @@@@\n"); 192 "but are buggy on this board. @@@@\n");
193 bad_config = 1; 193 bad_config = 1;
194#endif 194#endif
195 break; 195 break;
196 case K_SYS_REVISION_BCM1250_PASS2_2: 196 case K_SYS_REVISION_BCM1250_PASS2_2:
197#ifndef CONFIG_SB1_PASS_2_WORKAROUNDS 197#ifndef CONFIG_SB1_PASS_2_WORKAROUNDS
198 prom_printf("@@@@ This is a BCM1250 B1/B2. board, and the " 198 printk("@@@@ This is a BCM1250 B1/B2. board, and the "
199 "kernel doesn't have the proper workarounds " 199 "kernel doesn't have the proper workarounds "
200 "compiled in. @@@@\n"); 200 "compiled in. @@@@\n");
201 bad_config = 1; 201 bad_config = 1;
202#endif 202#endif
203#if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || \ 203#if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || \
204 !defined(CONFIG_CPU_HAS_PREFETCH) 204 !defined(CONFIG_CPU_HAS_PREFETCH)
205 prom_printf("@@@@ This is a BCM1250 B1/B2, but the kernel is " 205 printk("@@@@ This is a BCM1250 B1/B2, but the kernel is "
206 "conservatively configured for an 'A' stepping. " 206 "conservatively configured for an 'A' stepping. "
207 "@@@@\n"); 207 "@@@@\n");
208#endif 208#endif
@@ -211,7 +211,7 @@ void __init sb1250_setup(void)
211 break; 211 break;
212 } 212 }
213 if (bad_config) { 213 if (bad_config) {
214 prom_printf("Invalid configuration for this chip.\n"); 214 printk("Invalid configuration for this chip.\n");
215 machine_restart(NULL); 215 machine_restart(NULL);
216 } 216 }
217} 217}
diff --git a/arch/mips/sni/sniprom.c b/arch/mips/sni/sniprom.c
index 6a44bbf0b73..643366eb854 100644
--- a/arch/mips/sni/sniprom.c
+++ b/arch/mips/sni/sniprom.c
@@ -9,6 +9,8 @@
9 * Copyright (C) 2005-2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de) 9 * Copyright (C) 2005-2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
10 */ 10 */
11 11
12#define DEBUG
13
12#include <linux/kernel.h> 14#include <linux/kernel.h>
13#include <linux/init.h> 15#include <linux/init.h>
14#include <linux/string.h> 16#include <linux/string.h>
@@ -32,14 +34,13 @@
32#define PROM_ENTRY(x) (PROM_VEC + (x)) 34#define PROM_ENTRY(x) (PROM_VEC + (x))
33 35
34 36
35#define DEBUG
36#ifdef DEBUG
37#define DBG_PRINTF(x...) prom_printf(x)
38#else
39#define DBG_PRINTF(x...)
40#endif
41
42static int *(*__prom_putchar)(int) = (int *(*)(int))PROM_ENTRY(PROM_PUTCHAR); 37static int *(*__prom_putchar)(int) = (int *(*)(int))PROM_ENTRY(PROM_PUTCHAR);
38
39void prom_putchar(char c)
40{
41 __prom_putchar(c);
42}
43
43static char *(*__prom_getenv)(char *) = (char *(*)(char *))PROM_ENTRY(PROM_GETENV); 44static char *(*__prom_getenv)(char *) = (char *(*)(char *))PROM_ENTRY(PROM_GETENV);
44static void (*__prom_get_memconf)(void *) = (void (*)(void *))PROM_ENTRY(PROM_GET_MEMCONF); 45static void (*__prom_get_memconf)(void *) = (void (*)(void *))PROM_ENTRY(PROM_GET_MEMCONF);
45 46
@@ -48,26 +49,6 @@ char *prom_getenv (char *s)
48 return __prom_getenv(s); 49 return __prom_getenv(s);
49} 50}
50 51
51void prom_printf(char *fmt, ...)
52{
53 va_list args;
54 char ppbuf[1024];
55 char *bptr;
56
57 va_start(args, fmt);
58 vsprintf(ppbuf, fmt, args);
59
60 bptr = ppbuf;
61
62 while (*bptr != 0) {
63 if (*bptr == '\n')
64 __prom_putchar('\r');
65
66 __prom_putchar(*bptr++);
67 }
68 va_end(args);
69}
70
71void __init prom_free_prom_memory(void) 52void __init prom_free_prom_memory(void)
72{ 53{
73} 54}
@@ -94,15 +75,15 @@ static void sni_idprom_dump(void)
94{ 75{
95 int i; 76 int i;
96 77
97 prom_printf("SNI IDProm dump:\n"); 78 pr_debug("SNI IDProm dump:\n");
98 for (i = 0; i < 256; i++) { 79 for (i = 0; i < 256; i++) {
99 if (i%16 == 0) 80 if (i%16 == 0)
100 prom_printf("%04x ", i); 81 pr_debug("%04x ", i);
101 82
102 prom_printf("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i)); 83 printk("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i));
103 84
104 if (i % 16 == 15) 85 if (i % 16 == 15)
105 prom_printf("\n"); 86 printk("\n");
106 } 87 }
107} 88}
108#endif 89#endif
@@ -121,12 +102,12 @@ static void sni_mem_init(void )
121 /* MemSIZE from prom in 16MByte chunks */ 102 /* MemSIZE from prom in 16MByte chunks */
122 memsize = *((unsigned char *) SNI_IDPROM_MEMSIZE) * 16; 103 memsize = *((unsigned char *) SNI_IDPROM_MEMSIZE) * 16;
123 104
124 DBG_PRINTF("IDProm memsize: %lu MByte\n", memsize); 105 pr_debug("IDProm memsize: %lu MByte\n", memsize);
125 106
126 /* get memory bank layout from prom */ 107 /* get memory bank layout from prom */
127 __prom_get_memconf(&memconf); 108 __prom_get_memconf(&memconf);
128 109
129 DBG_PRINTF("prom_get_mem_conf memory configuration:\n"); 110 pr_debug("prom_get_mem_conf memory configuration:\n");
130 for (i = 0;i < 8 && memconf[i].size; i++) { 111 for (i = 0;i < 8 && memconf[i].size; i++) {
131 if (sni_brd_type == SNI_BRD_PCI_TOWER || 112 if (sni_brd_type == SNI_BRD_PCI_TOWER ||
132 sni_brd_type == SNI_BRD_PCI_TOWER_CPLUS) { 113 sni_brd_type == SNI_BRD_PCI_TOWER_CPLUS) {
@@ -135,7 +116,7 @@ static void sni_mem_init(void )
135 memconf[i].base -= 0x20000000; 116 memconf[i].base -= 0x20000000;
136 } 117 }
137 } 118 }
138 DBG_PRINTF("Bank%d: %08x @ %08x\n", i, 119 pr_debug("Bank%d: %08x @ %08x\n", i,
139 memconf[i].size, memconf[i].base); 120 memconf[i].size, memconf[i].base);
140 add_memory_region(memconf[i].base, memconf[i].size, BOOT_MEM_RAM); 121 add_memory_region(memconf[i].base, memconf[i].size, BOOT_MEM_RAM);
141 } 122 }
@@ -248,7 +229,7 @@ void __init prom_init(void)
248 systype = "RM300-Exx"; 229 systype = "RM300-Exx";
249 break; 230 break;
250 } 231 }
251 DBG_PRINTF("Found SNI brdtype %02x name %s\n", sni_brd_type,systype); 232 pr_debug("Found SNI brdtype %02x name %s\n", sni_brd_type,systype);
252 233
253#ifdef DEBUG 234#ifdef DEBUG
254 sni_idprom_dump(); 235 sni_idprom_dump();
diff --git a/arch/mips/tx4927/common/tx4927_setup.c b/arch/mips/tx4927/common/tx4927_setup.c
index 941c441729b..c8e49feb345 100644
--- a/arch/mips/tx4927/common/tx4927_setup.c
+++ b/arch/mips/tx4927/common/tx4927_setup.c
@@ -81,18 +81,8 @@ void __init tx4927_time_init(void)
81 81
82void __init plat_timer_setup(struct irqaction *irq) 82void __init plat_timer_setup(struct irqaction *irq)
83{ 83{
84 u32 count;
85 u32 c1;
86 u32 c2;
87
88 setup_irq(TX4927_IRQ_CPU_TIMER, irq); 84 setup_irq(TX4927_IRQ_CPU_TIMER, irq);
89 85
90 /* to generate the first timer interrupt */
91 c1 = read_c0_count();
92 count = c1 + (mips_hpt_frequency / HZ);
93 write_c0_compare(count);
94 c2 = read_c0_count();
95
96#ifdef CONFIG_TOSHIBA_RBTX4927 86#ifdef CONFIG_TOSHIBA_RBTX4927
97 { 87 {
98 extern void toshiba_rbtx4927_timer_setup(struct irqaction 88 extern void toshiba_rbtx4927_timer_setup(struct irqaction
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
index dcce88f403c..5cc30c10e74 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
@@ -132,9 +132,6 @@ JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthB
132#include <asm/wbflush.h> 132#include <asm/wbflush.h>
133#include <linux/bootmem.h> 133#include <linux/bootmem.h>
134#include <linux/blkdev.h> 134#include <linux/blkdev.h>
135#ifdef CONFIG_RTC_DS1742
136#include <linux/ds1742rtc.h>
137#endif
138#ifdef CONFIG_TOSHIBA_FPCIB0 135#ifdef CONFIG_TOSHIBA_FPCIB0
139#include <asm/tx4927/smsc_fdc37m81x.h> 136#include <asm/tx4927/smsc_fdc37m81x.h>
140#endif 137#endif
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
index 7316a78fdd6..0f7576dfd14 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -53,6 +53,7 @@
53#include <linux/pci.h> 53#include <linux/pci.h>
54#include <linux/timex.h> 54#include <linux/timex.h>
55#include <linux/pm.h> 55#include <linux/pm.h>
56#include <linux/platform_device.h>
56 57
57#include <asm/bootinfo.h> 58#include <asm/bootinfo.h>
58#include <asm/page.h> 59#include <asm/page.h>
@@ -64,9 +65,6 @@
64#include <asm/time.h> 65#include <asm/time.h>
65#include <linux/bootmem.h> 66#include <linux/bootmem.h>
66#include <linux/blkdev.h> 67#include <linux/blkdev.h>
67#ifdef CONFIG_RTC_DS1742
68#include <linux/ds1742rtc.h>
69#endif
70#ifdef CONFIG_TOSHIBA_FPCIB0 68#ifdef CONFIG_TOSHIBA_FPCIB0
71#include <asm/tx4927/smsc_fdc37m81x.h> 69#include <asm/tx4927/smsc_fdc37m81x.h>
72#endif 70#endif
@@ -1020,69 +1018,12 @@ void __init toshiba_rbtx4927_setup(void)
1020 "+\n"); 1018 "+\n");
1021} 1019}
1022 1020
1023#ifdef CONFIG_RTC_DS1742
1024extern unsigned long rtc_ds1742_get_time(void);
1025extern int rtc_ds1742_set_time(unsigned long);
1026extern void rtc_ds1742_wait(void);
1027#endif
1028
1029void __init 1021void __init
1030toshiba_rbtx4927_time_init(void) 1022toshiba_rbtx4927_time_init(void)
1031{ 1023{
1032 u32 c1;
1033 u32 c2;
1034
1035 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n"); 1024 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n");
1036 1025
1037#ifdef CONFIG_RTC_DS1742 1026 mips_hpt_frequency = tx4927_cpu_clock / 2;
1038
1039 rtc_mips_get_time = rtc_ds1742_get_time;
1040 rtc_mips_set_time = rtc_ds1742_set_time;
1041
1042 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
1043 ":rtc_ds1742_init()-\n");
1044 rtc_ds1742_init(0xbc010000);
1045 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
1046 ":rtc_ds1742_init()+\n");
1047
1048 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
1049 ":Calibrate mips_hpt_frequency-\n");
1050 rtc_ds1742_wait();
1051
1052 /* get the count */
1053 c1 = read_c0_count();
1054
1055 /* wait for the seconds to change again */
1056 rtc_ds1742_wait();
1057
1058 /* get the count again */
1059 c2 = read_c0_count();
1060
1061 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
1062 ":Calibrate mips_hpt_frequency+\n");
1063 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
1064 ":c1=%12u\n", c1);
1065 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
1066 ":c2=%12u\n", c2);
1067
1068 /* this diff is as close as we are going to get to counter ticks per sec */
1069 mips_hpt_frequency = abs(c2 - c1);
1070 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
1071 ":f1=%12u\n", mips_hpt_frequency);
1072
1073 /* round to 1/10th of a MHz */
1074 mips_hpt_frequency /= (100 * 1000);
1075 mips_hpt_frequency *= (100 * 1000);
1076 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
1077 ":f2=%12u\n", mips_hpt_frequency);
1078
1079 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_INFO,
1080 ":mips_hpt_frequency=%uHz (%uMHz)\n",
1081 mips_hpt_frequency,
1082 mips_hpt_frequency / 1000000);
1083#else
1084 mips_hpt_frequency = 100000000;
1085#endif
1086 1027
1087 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n"); 1028 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n");
1088 1029
@@ -1095,3 +1036,16 @@ void __init toshiba_rbtx4927_timer_setup(struct irqaction *irq)
1095 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP, 1036 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP,
1096 "+\n"); 1037 "+\n");
1097} 1038}
1039
1040static int __init toshiba_rbtx4927_rtc_init(void)
1041{
1042 struct resource res = {
1043 .start = 0x1c010000,
1044 .end = 0x1c010000 + 0x800 - 1,
1045 .flags = IORESOURCE_MEM,
1046 };
1047 struct platform_device *dev =
1048 platform_device_register_simple("ds1742", -1, &res, 1);
1049 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
1050}
1051device_initcall(toshiba_rbtx4927_rtc_init);
diff --git a/arch/mips/tx4938/common/setup.c b/arch/mips/tx4938/common/setup.c
index dc87d92bb08..142abf453e4 100644
--- a/arch/mips/tx4938/common/setup.c
+++ b/arch/mips/tx4938/common/setup.c
@@ -55,14 +55,5 @@ tx4938_time_init(void)
55 55
56void __init plat_timer_setup(struct irqaction *irq) 56void __init plat_timer_setup(struct irqaction *irq)
57{ 57{
58 u32 count;
59 u32 c1;
60 u32 c2;
61
62 setup_irq(TX4938_IRQ_CPU_TIMER, irq); 58 setup_irq(TX4938_IRQ_CPU_TIMER, irq);
63
64 c1 = read_c0_count();
65 count = c1 + (mips_hpt_frequency / HZ);
66 write_c0_compare(count);
67 c2 = read_c0_count();
68} 59}