[MIPS] Use generic NTP code for all MIPS platforms
[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
a904f747
RB
72void __init swarm_time_init(void)
73{
b75d4c1d 74#if defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
a904f747
RB
75 /* Setup HPT */
76 sb1250_hpt_setup();
b75d4c1d 77#endif
a904f747
RB
78}
79
54d0a216 80void __init plat_timer_setup(struct irqaction *irq)
1da177e4
LT
81{
82 /*
83 * we don't set up irqaction, because we will deliver timer
84 * interrupts through low-level (direct) meachanism.
85 */
86
87 /* We only need to setup the generic timer */
f137e463
AI
88#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
89 bcm1480_time_init();
90#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
91 sb1250_time_init();
92#else
03dbd2e0 93#error invalid SiByte board configuration
f137e463 94#endif
1da177e4
LT
95}
96
97int swarm_be_handler(struct pt_regs *regs, int is_fixup)
98{
99 if (!is_fixup && (regs->cp0_cause & 4)) {
100 /* Data bus error - print PA */
6aaf7786 101 printk("DBE physical address: %010Lx\n",
1da177e4 102 __read_64bit_c0_register($26, 1));
1da177e4
LT
103 }
104 return (is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL);
105}
106
2925aba4 107void __init plat_mem_setup(void)
1da177e4 108{
f137e463
AI
109#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
110 bcm1480_setup();
111#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
1da177e4 112 sb1250_setup();
f137e463 113#else
03dbd2e0 114#error invalid SiByte board configuration
f137e463 115#endif
1da177e4
LT
116
117 panic_timeout = 5; /* For debug. */
118
a904f747 119 board_time_init = swarm_time_init;
1da177e4
LT
120 board_be_handler = swarm_be_handler;
121
122 if (xicor_probe()) {
123 printk("swarm setup: Xicor 1241 RTC detected.\n");
d23ee8fe
YY
124 rtc_mips_get_time = xicor_get_time;
125 rtc_mips_set_time = xicor_set_time;
1da177e4 126 }
42a3b4f2 127
1da177e4
LT
128 if (m41t81_probe()) {
129 printk("swarm setup: M41T81 RTC detected.\n");
d23ee8fe
YY
130 rtc_mips_get_time = m41t81_get_time;
131 rtc_mips_set_time = m41t81_set_time;
1da177e4
LT
132 }
133
134 printk("This kernel optimized for "
135#ifdef CONFIG_SIMULATION
136 "simulation"
137#else
138 "board"
139#endif
140 " runs "
141#ifdef CONFIG_SIBYTE_CFE
142 "with"
143#else
144 "without"
145#endif
146 " CFE\n");
147
148#ifdef CONFIG_VT
149 screen_info = (struct screen_info) {
150 0, 0, /* orig-x, orig-y */
151 0, /* unused */
152 52, /* orig_video_page */
153 3, /* orig_video_mode */
154 80, /* orig_video_cols */
155 4626, 3, 9, /* unused, ega_bx, unused */
156 25, /* orig_video_lines */
157 0x22, /* orig_video_isVGA */
158 16 /* orig_video_points */
159 };
160 /* XXXKW for CFE, get lines/cols from environment */
161#endif
1da177e4
LT
162}
163
1da177e4
LT
164#ifdef LEDS_PHYS
165
166#ifdef CONFIG_SIBYTE_CARMEL
167/* XXXKW need to detect Monterey/LittleSur/etc */
168#undef LEDS_PHYS
169#define LEDS_PHYS MLEDS_PHYS
170#endif
171
1da177e4
LT
172void setleds(char *str)
173{
8fb303c7 174 void *reg;
1da177e4 175 int i;
8fb303c7 176
1da177e4 177 for (i = 0; i < 4; i++) {
8fb303c7
RB
178 reg = IOADDR(LEDS_PHYS) + 0x20 + ((3 - i) << 3);
179
180 if (!str[i])
181 writeb(' ', reg);
182 else
183 writeb(str[i], reg);
1da177e4
LT
184 }
185}
8fb303c7
RB
186
187#endif /* LEDS_PHYS */
This page took 0.273491 seconds and 5 git commands to generate.