timekeeping: Update clocksource with stop_machine
[deliverable/linux.git] / arch / mips / sibyte / swarm / setup.c
CommitLineData
1da177e4 1/*
f137e463 2 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Broadcom Corporation
1da177e4
LT
3 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20/*
21 * Setup code for the SWARM board
22 */
23
1da177e4
LT
24#include <linux/spinlock.h>
25#include <linux/mm.h>
26#include <linux/bootmem.h>
27#include <linux/blkdev.h>
28#include <linux/init.h>
29#include <linux/kernel.h>
894673ee 30#include <linux/screen_info.h>
1da177e4
LT
31#include <linux/initrd.h>
32
33#include <asm/irq.h>
34#include <asm/io.h>
35#include <asm/bootinfo.h>
36#include <asm/mipsregs.h>
37#include <asm/reboot.h>
38#include <asm/time.h>
39#include <asm/traps.h>
40#include <asm/sibyte/sb1250.h>
f137e463
AI
41#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
42#include <asm/sibyte/bcm1480_regs.h>
43#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
1da177e4 44#include <asm/sibyte/sb1250_regs.h>
f137e463 45#else
03dbd2e0 46#error invalid SiByte board configuration
f137e463 47#endif
1da177e4
LT
48#include <asm/sibyte/sb1250_genbus.h>
49#include <asm/sibyte/board.h>
50
f137e463
AI
51#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
52extern void bcm1480_setup(void);
53#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
1da177e4 54extern void sb1250_setup(void);
f137e463 55#else
03dbd2e0 56#error invalid SiByte board configuration
f137e463 57#endif
1da177e4
LT
58
59extern int xicor_probe(void);
60extern int xicor_set_time(unsigned long);
61extern unsigned long xicor_get_time(void);
62
63extern int m41t81_probe(void);
64extern int m41t81_set_time(unsigned long);
65extern unsigned long m41t81_get_time(void);
66
67const char *get_system_type(void)
68{
69 return "SiByte " SIBYTE_BOARD_NAME;
70}
71
1da177e4
LT
72int swarm_be_handler(struct pt_regs *regs, int is_fixup)
73{
74 if (!is_fixup && (regs->cp0_cause & 4)) {
75 /* Data bus error - print PA */
6aaf7786 76 printk("DBE physical address: %010Lx\n",
1da177e4 77 __read_64bit_c0_register($26, 1));
1da177e4
LT
78 }
79 return (is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL);
80}
81
4b550488
RB
82enum swarm_rtc_type {
83 RTC_NONE,
84 RTC_XICOR,
85 RTC_M4LT81
86};
87
88enum swarm_rtc_type swarm_rtc_type;
89
90unsigned long read_persistent_clock(void)
91{
92 switch (swarm_rtc_type) {
93 case RTC_XICOR:
94 return xicor_get_time();
95
96 case RTC_M4LT81:
97 return m41t81_get_time();
98
99 case RTC_NONE:
100 default:
101 return mktime(2000, 1, 1, 0, 0, 0);
102 }
103}
104
105int rtc_mips_set_time(unsigned long sec)
106{
107 switch (swarm_rtc_type) {
108 case RTC_XICOR:
109 return xicor_set_time(sec);
110
111 case RTC_M4LT81:
112 return m41t81_set_time(sec);
113
114 case RTC_NONE:
115 default:
116 return -1;
117 }
118}
119
2925aba4 120void __init plat_mem_setup(void)
1da177e4 121{
f137e463
AI
122#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
123 bcm1480_setup();
124#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
1da177e4 125 sb1250_setup();
f137e463 126#else
03dbd2e0 127#error invalid SiByte board configuration
f137e463 128#endif
1da177e4
LT
129
130 panic_timeout = 5; /* For debug. */
131
1da177e4
LT
132 board_be_handler = swarm_be_handler;
133
4b550488
RB
134 if (xicor_probe())
135 swarm_rtc_type = RTC_XICOR;
136 if (m41t81_probe())
137 swarm_rtc_type = RTC_M4LT81;
1da177e4 138
1da177e4
LT
139#ifdef CONFIG_VT
140 screen_info = (struct screen_info) {
141 0, 0, /* orig-x, orig-y */
142 0, /* unused */
143 52, /* orig_video_page */
144 3, /* orig_video_mode */
145 80, /* orig_video_cols */
146 4626, 3, 9, /* unused, ega_bx, unused */
147 25, /* orig_video_lines */
148 0x22, /* orig_video_isVGA */
149 16 /* orig_video_points */
150 };
151 /* XXXKW for CFE, get lines/cols from environment */
152#endif
1da177e4
LT
153}
154
1da177e4
LT
155#ifdef LEDS_PHYS
156
157#ifdef CONFIG_SIBYTE_CARMEL
158/* XXXKW need to detect Monterey/LittleSur/etc */
159#undef LEDS_PHYS
160#define LEDS_PHYS MLEDS_PHYS
161#endif
162
1da177e4
LT
163void setleds(char *str)
164{
8fb303c7 165 void *reg;
1da177e4 166 int i;
8fb303c7 167
1da177e4 168 for (i = 0; i < 4; i++) {
8fb303c7
RB
169 reg = IOADDR(LEDS_PHYS) + 0x20 + ((3 - i) << 3);
170
171 if (!str[i])
172 writeb(' ', reg);
173 else
174 writeb(str[i], reg);
1da177e4
LT
175 }
176}
8fb303c7
RB
177
178#endif /* LEDS_PHYS */
This page took 0.430522 seconds and 5 git commands to generate.