aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/Kconfig4
-rw-r--r--arch/mips/sni/Makefile2
-rw-r--r--arch/mips/sni/a20r.c31
-rw-r--r--arch/mips/sni/ds1216.c81
-rw-r--r--arch/mips/sni/pcimt.c26
-rw-r--r--arch/mips/sni/pcit.c26
-rw-r--r--arch/mips/sni/rm200.c32
-rw-r--r--arch/mips/sni/sniprom.c5
-rw-r--r--include/asm-mips/sni.h3
9 files changed, 95 insertions, 115 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2076d472ea99..24661d60bc8f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -918,8 +918,8 @@ config BOOT_ELF32
918 918
919config MIPS_L1_CACHE_SHIFT 919config MIPS_L1_CACHE_SHIFT
920 int 920 int
921 default "4" if MACH_DECSTATION || SNI_RM 921 default "4" if MACH_DECSTATION
922 default "7" if SGI_IP27 922 default "7" if SGI_IP27 || SNI_RM
923 default "4" if PMC_MSP4200_EVAL 923 default "4" if PMC_MSP4200_EVAL
924 default "5" 924 default "5"
925 925
diff --git a/arch/mips/sni/Makefile b/arch/mips/sni/Makefile
index e5777b7e2bc9..471418e4f446 100644
--- a/arch/mips/sni/Makefile
+++ b/arch/mips/sni/Makefile
@@ -2,5 +2,5 @@
2# Makefile for the SNI specific part of the kernel 2# Makefile for the SNI specific part of the kernel
3# 3#
4 4
5obj-y += irq.o reset.o setup.o ds1216.o a20r.o rm200.o pcimt.o pcit.o time.o 5obj-y += irq.o reset.o setup.o a20r.o rm200.o pcimt.o pcit.o time.o
6obj-$(CONFIG_CPU_BIG_ENDIAN) += sniprom.o 6obj-$(CONFIG_CPU_BIG_ENDIAN) += sniprom.o
diff --git a/arch/mips/sni/a20r.c b/arch/mips/sni/a20r.c
index 31ab80f1befa..6850a29defcd 100644
--- a/arch/mips/sni/a20r.c
+++ b/arch/mips/sni/a20r.c
@@ -15,7 +15,6 @@
15 15
16#include <asm/sni.h> 16#include <asm/sni.h>
17#include <asm/time.h> 17#include <asm/time.h>
18#include <asm/ds1216.h>
19 18
20#define PORT(_base,_irq) \ 19#define PORT(_base,_irq) \
21 { \ 20 { \
@@ -40,20 +39,34 @@ static struct platform_device a20r_serial8250_device = {
40 }, 39 },
41}; 40};
42 41
42static struct resource a20r_ds1216_rsrc[] = {
43 {
44 .start = 0x1c081ffc,
45 .end = 0x1c081fff,
46 .flags = IORESOURCE_MEM
47 }
48};
49
50static struct platform_device a20r_ds1216_device = {
51 .name = "rtc-ds1216",
52 .num_resources = ARRAY_SIZE(a20r_ds1216_rsrc),
53 .resource = a20r_ds1216_rsrc
54};
55
43static struct resource snirm_82596_rsrc[] = { 56static struct resource snirm_82596_rsrc[] = {
44 { 57 {
45 .start = 0xb8000000, 58 .start = 0x18000000,
46 .end = 0xb8000004, 59 .end = 0x18000004,
47 .flags = IORESOURCE_MEM 60 .flags = IORESOURCE_MEM
48 }, 61 },
49 { 62 {
50 .start = 0xb8010000, 63 .start = 0x18010000,
51 .end = 0xb8010004, 64 .end = 0x18010004,
52 .flags = IORESOURCE_MEM 65 .flags = IORESOURCE_MEM
53 }, 66 },
54 { 67 {
55 .start = 0xbff00000, 68 .start = 0x1ff00000,
56 .end = 0xbff00020, 69 .end = 0x1ff00020,
57 .flags = IORESOURCE_MEM 70 .flags = IORESOURCE_MEM
58 }, 71 },
59 { 72 {
@@ -205,8 +218,7 @@ void __init sni_a20r_irq_init(void)
205 218
206void sni_a20r_init(void) 219void sni_a20r_init(void)
207{ 220{
208 ds1216_base = (volatile unsigned char *) SNI_DS1216_A20R_BASE; 221 /* FIXME, remove if not needed */
209 rtc_mips_get_time = ds1216_get_cmos_time;
210} 222}
211 223
212static int __init snirm_a20r_setup_devinit(void) 224static int __init snirm_a20r_setup_devinit(void)
@@ -218,6 +230,7 @@ static int __init snirm_a20r_setup_devinit(void)
218 platform_device_register(&snirm_53c710_pdev); 230 platform_device_register(&snirm_53c710_pdev);
219 platform_device_register(&sc26xx_pdev); 231 platform_device_register(&sc26xx_pdev);
220 platform_device_register(&a20r_serial8250_device); 232 platform_device_register(&a20r_serial8250_device);
233 platform_device_register(&a20r_ds1216_device);
221 break; 234 break;
222 } 235 }
223 236
diff --git a/arch/mips/sni/ds1216.c b/arch/mips/sni/ds1216.c
deleted file mode 100644
index 1d92732c14f1..000000000000
--- a/arch/mips/sni/ds1216.c
+++ /dev/null
@@ -1,81 +0,0 @@
1
2#include <linux/bcd.h>
3#include <linux/time.h>
4
5#include <asm/ds1216.h>
6
7volatile unsigned char *ds1216_base;
8
9/*
10 * Read the 64 bit we'd like to have - It a series
11 * of 64 bits showing up in the LSB of the base register.
12 *
13 */
14static unsigned char *ds1216_read(void)
15{
16 static unsigned char rdbuf[8];
17 unsigned char c;
18 int i, j;
19
20 for (i = 0; i < 8; i++) {
21 c = 0x0;
22 for (j = 0; j < 8; j++) {
23 c |= (*ds1216_base & 0x1) << j;
24 }
25 rdbuf[i] = c;
26 }
27
28 return rdbuf;
29}
30
31static void ds1216_switch_ds_to_clock(void)
32{
33 unsigned char magic[] = {
34 0xc5, 0x3a, 0xa3, 0x5c, 0xc5, 0x3a, 0xa3, 0x5c
35 };
36 int i,j,c;
37
38 /* Reset magic pointer */
39 c = *ds1216_base;
40
41 /* Write 64 bit magic to DS1216 */
42 for (i = 0; i < 8; i++) {
43 c = magic[i];
44 for (j = 0; j < 8; j++) {
45 *ds1216_base = c;
46 c = c >> 1;
47 }
48 }
49}
50
51unsigned long ds1216_get_cmos_time(void)
52{
53 unsigned char *rdbuf;
54 unsigned int year, month, date, hour, min, sec;
55
56 ds1216_switch_ds_to_clock();
57 rdbuf = ds1216_read();
58
59 sec = BCD2BIN(DS1216_SEC(rdbuf));
60 min = BCD2BIN(DS1216_MIN(rdbuf));
61 hour = BCD2BIN(DS1216_HOUR(rdbuf));
62 date = BCD2BIN(DS1216_DATE(rdbuf));
63 month = BCD2BIN(DS1216_MONTH(rdbuf));
64 year = BCD2BIN(DS1216_YEAR(rdbuf));
65
66 if (DS1216_1224(rdbuf) && DS1216_AMPM(rdbuf))
67 hour+=12;
68
69 if (year < 70)
70 year += 2000;
71 else
72 year += 1900;
73
74 return mktime(year, month, date, hour, min, sec);
75}
76
77int ds1216_set_rtc_mmss(unsigned long nowtime)
78{
79 printk("ds1216_set_rtc_mmss called but not implemented\n");
80 return -1;
81}
diff --git a/arch/mips/sni/pcimt.c b/arch/mips/sni/pcimt.c
index 97b234361b4d..44b1ae62aa4a 100644
--- a/arch/mips/sni/pcimt.c
+++ b/arch/mips/sni/pcimt.c
@@ -14,7 +14,6 @@
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/serial_8250.h> 15#include <linux/serial_8250.h>
16 16
17#include <asm/mc146818-time.h>
18#include <asm/sni.h> 17#include <asm/sni.h>
19#include <asm/time.h> 18#include <asm/time.h>
20#include <asm/i8259.h> 19#include <asm/i8259.h>
@@ -90,6 +89,26 @@ static struct platform_device pcimt_serial8250_device = {
90 }, 89 },
91}; 90};
92 91
92static struct resource pcimt_cmos_rsrc[] = {
93 {
94 .start = 0x70,
95 .end = 0x71,
96 .flags = IORESOURCE_IO
97 },
98 {
99 .start = 8,
100 .end = 8,
101 .flags = IORESOURCE_IRQ
102 }
103};
104
105static struct platform_device pcimt_cmos_device = {
106 .name = "rtc_cmos",
107 .num_resources = ARRAY_SIZE(pcimt_cmos_rsrc),
108 .resource = pcimt_cmos_rsrc
109};
110
111
93static struct resource sni_io_resource = { 112static struct resource sni_io_resource = {
94 .start = 0x00000000UL, 113 .start = 0x00000000UL,
95 .end = 0x03bfffffUL, 114 .end = 0x03bfffffUL,
@@ -290,12 +309,10 @@ void __init sni_pcimt_irq_init(void)
290 change_c0_status(ST0_IM, IE_IRQ1|IE_IRQ3); 309 change_c0_status(ST0_IM, IE_IRQ1|IE_IRQ3);
291} 310}
292 311
293void sni_pcimt_init(void) 312void __init sni_pcimt_init(void)
294{ 313{
295 sni_pcimt_detect(); 314 sni_pcimt_detect();
296 sni_pcimt_sc_init(); 315 sni_pcimt_sc_init();
297 rtc_mips_get_time = mc146818_get_cmos_time;
298 rtc_mips_set_time = mc146818_set_rtc_mmss;
299 board_time_init = sni_cpu_time_init; 316 board_time_init = sni_cpu_time_init;
300 ioport_resource.end = sni_io_resource.end; 317 ioport_resource.end = sni_io_resource.end;
301#ifdef CONFIG_PCI 318#ifdef CONFIG_PCI
@@ -312,6 +329,7 @@ static int __init snirm_pcimt_setup_devinit(void)
312 case SNI_BRD_PCI_DESKTOP: 329 case SNI_BRD_PCI_DESKTOP:
313 case SNI_BRD_PCI_MTOWER_CPLUS: 330 case SNI_BRD_PCI_MTOWER_CPLUS:
314 platform_device_register(&pcimt_serial8250_device); 331 platform_device_register(&pcimt_serial8250_device);
332 platform_device_register(&pcimt_cmos_device);
315 break; 333 break;
316 } 334 }
317 335
diff --git a/arch/mips/sni/pcit.c b/arch/mips/sni/pcit.c
index 00d151f4d121..2480c478dcbd 100644
--- a/arch/mips/sni/pcit.c
+++ b/arch/mips/sni/pcit.c
@@ -13,7 +13,6 @@
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15 15
16#include <asm/mc146818-time.h>
17#include <asm/sni.h> 16#include <asm/sni.h>
18#include <asm/time.h> 17#include <asm/time.h>
19#include <asm/irq_cpu.h> 18#include <asm/irq_cpu.h>
@@ -58,6 +57,25 @@ static struct platform_device pcit_cplus_serial8250_device = {
58 }, 57 },
59}; 58};
60 59
60static struct resource pcit_cmos_rsrc[] = {
61 {
62 .start = 0x70,
63 .end = 0x71,
64 .flags = IORESOURCE_IO
65 },
66 {
67 .start = 8,
68 .end = 8,
69 .flags = IORESOURCE_IRQ
70 }
71};
72
73static struct platform_device pcit_cmos_device = {
74 .name = "rtc_cmos",
75 .num_resources = ARRAY_SIZE(pcit_cmos_rsrc),
76 .resource = pcit_cmos_rsrc
77};
78
61static struct resource sni_io_resource = { 79static struct resource sni_io_resource = {
62 .start = 0x00000000UL, 80 .start = 0x00000000UL,
63 .end = 0x03bfffffUL, 81 .end = 0x03bfffffUL,
@@ -243,10 +261,8 @@ void __init sni_pcit_cplus_irq_init(void)
243 setup_irq (MIPS_CPU_IRQ_BASE + 3, &sni_isa_irq); 261 setup_irq (MIPS_CPU_IRQ_BASE + 3, &sni_isa_irq);
244} 262}
245 263
246void sni_pcit_init(void) 264void __init sni_pcit_init(void)
247{ 265{
248 rtc_mips_get_time = mc146818_get_cmos_time;
249 rtc_mips_set_time = mc146818_set_rtc_mmss;
250 board_time_init = sni_cpu_time_init; 266 board_time_init = sni_cpu_time_init;
251 ioport_resource.end = sni_io_resource.end; 267 ioport_resource.end = sni_io_resource.end;
252#ifdef CONFIG_PCI 268#ifdef CONFIG_PCI
@@ -261,10 +277,12 @@ static int __init snirm_pcit_setup_devinit(void)
261 switch (sni_brd_type) { 277 switch (sni_brd_type) {
262 case SNI_BRD_PCI_TOWER: 278 case SNI_BRD_PCI_TOWER:
263 platform_device_register(&pcit_serial8250_device); 279 platform_device_register(&pcit_serial8250_device);
280 platform_device_register(&pcit_cmos_device);
264 break; 281 break;
265 282
266 case SNI_BRD_PCI_TOWER_CPLUS: 283 case SNI_BRD_PCI_TOWER_CPLUS:
267 platform_device_register(&pcit_cplus_serial8250_device); 284 platform_device_register(&pcit_cplus_serial8250_device);
285 platform_device_register(&pcit_cmos_device);
268 break; 286 break;
269 } 287 }
270 return 0; 288 return 0;
diff --git a/arch/mips/sni/rm200.c b/arch/mips/sni/rm200.c
index b82ff129f5ea..4bfda020fdc7 100644
--- a/arch/mips/sni/rm200.c
+++ b/arch/mips/sni/rm200.c
@@ -15,7 +15,6 @@
15 15
16#include <asm/sni.h> 16#include <asm/sni.h>
17#include <asm/time.h> 17#include <asm/time.h>
18#include <asm/ds1216.h>
19#include <asm/irq_cpu.h> 18#include <asm/irq_cpu.h>
20 19
21#define PORT(_base,_irq) \ 20#define PORT(_base,_irq) \
@@ -41,20 +40,34 @@ static struct platform_device rm200_serial8250_device = {
41 }, 40 },
42}; 41};
43 42
43static struct resource rm200_ds1216_rsrc[] = {
44 {
45 .start = 0x1cd41ffc,
46 .end = 0x1cd41fff,
47 .flags = IORESOURCE_MEM
48 }
49};
50
51static struct platform_device rm200_ds1216_device = {
52 .name = "rtc-ds1216",
53 .num_resources = ARRAY_SIZE(rm200_ds1216_rsrc),
54 .resource = rm200_ds1216_rsrc
55};
56
44static struct resource snirm_82596_rm200_rsrc[] = { 57static struct resource snirm_82596_rm200_rsrc[] = {
45 { 58 {
46 .start = 0xb8000000, 59 .start = 0x18000000,
47 .end = 0xb80fffff, 60 .end = 0x180fffff,
48 .flags = IORESOURCE_MEM 61 .flags = IORESOURCE_MEM
49 }, 62 },
50 { 63 {
51 .start = 0xbb000000, 64 .start = 0x1b000000,
52 .end = 0xbb000004, 65 .end = 0x1b000004,
53 .flags = IORESOURCE_MEM 66 .flags = IORESOURCE_MEM
54 }, 67 },
55 { 68 {
56 .start = 0xbff00000, 69 .start = 0x1ff00000,
57 .end = 0xbff00020, 70 .end = 0x1ff00020,
58 .flags = IORESOURCE_MEM 71 .flags = IORESOURCE_MEM
59 }, 72 },
60 { 73 {
@@ -96,6 +109,7 @@ static int __init snirm_setup_devinit(void)
96{ 109{
97 if (sni_brd_type == SNI_BRD_RM200) { 110 if (sni_brd_type == SNI_BRD_RM200) {
98 platform_device_register(&rm200_serial8250_device); 111 platform_device_register(&rm200_serial8250_device);
112 platform_device_register(&rm200_ds1216_device);
99 platform_device_register(&snirm_82596_rm200_pdev); 113 platform_device_register(&snirm_82596_rm200_pdev);
100 platform_device_register(&snirm_53c710_rm200_pdev); 114 platform_device_register(&snirm_53c710_rm200_pdev);
101 } 115 }
@@ -176,11 +190,9 @@ void __init sni_rm200_irq_init(void)
176 setup_irq (SNI_RM200_INT_START + 0, &sni_isa_irq); 190 setup_irq (SNI_RM200_INT_START + 0, &sni_isa_irq);
177} 191}
178 192
179void sni_rm200_init(void) 193void __init sni_rm200_init(void)
180{ 194{
181 set_io_port_base(SNI_PORT_BASE + 0x02000000); 195 set_io_port_base(SNI_PORT_BASE + 0x02000000);
182 ioport_resource.end += 0x02000000; 196 ioport_resource.end += 0x02000000;
183 ds1216_base = (volatile unsigned char *) SNI_DS1216_RM200_BASE;
184 rtc_mips_get_time = ds1216_get_cmos_time;
185 board_time_init = sni_cpu_time_init; 197 board_time_init = sni_cpu_time_init;
186} 198}
diff --git a/arch/mips/sni/sniprom.c b/arch/mips/sni/sniprom.c
index 643366eb854a..00a03a6e8f58 100644
--- a/arch/mips/sni/sniprom.c
+++ b/arch/mips/sni/sniprom.c
@@ -146,7 +146,10 @@ static void __init sni_console_setup(void)
146 } 146 }
147 if (baud) 147 if (baud)
148 strcpy(options, baud); 148 strcpy(options, baud);
149 add_preferred_console("ttyS", port, baud ? options : NULL); 149 if (strncmp (cdev, "tty552", 6) == 0)
150 add_preferred_console("ttyS", port, baud ? options : NULL);
151 else
152 add_preferred_console("ttySC", port, baud ? options : NULL);
150 } 153 }
151} 154}
152 155
diff --git a/include/asm-mips/sni.h b/include/asm-mips/sni.h
index f257509b914f..ddaf36a1e389 100644
--- a/include/asm-mips/sni.h
+++ b/include/asm-mips/sni.h
@@ -146,9 +146,6 @@ extern unsigned int sni_brd_type;
146#define SNI_A20R_IRQ_BASE MIPS_CPU_IRQ_BASE 146#define SNI_A20R_IRQ_BASE MIPS_CPU_IRQ_BASE
147#define SNI_A20R_IRQ_TIMER (SNI_A20R_IRQ_BASE+5) 147#define SNI_A20R_IRQ_TIMER (SNI_A20R_IRQ_BASE+5)
148 148
149#define SNI_DS1216_A20R_BASE 0xbc081ffc
150#define SNI_DS1216_RM200_BASE 0xbcd41ffc
151
152#define SNI_PCIT_INT_REG 0xbfff000c 149#define SNI_PCIT_INT_REG 0xbfff000c
153 150
154#define SNI_PCIT_INT_START 24 151#define SNI_PCIT_INT_START 24