blob: f8963de1bbf43e00dda12b0bdefe8bf05f4ae315 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
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
24#include <linux/config.h>
25#include <linux/spinlock.h>
26#include <linux/mm.h>
27#include <linux/bootmem.h>
28#include <linux/blkdev.h>
29#include <linux/init.h>
30#include <linux/kernel.h>
31#include <linux/tty.h>
32#include <linux/initrd.h>
33
34#include <asm/irq.h>
35#include <asm/io.h>
36#include <asm/bootinfo.h>
37#include <asm/mipsregs.h>
38#include <asm/reboot.h>
39#include <asm/time.h>
40#include <asm/traps.h>
41#include <asm/sibyte/sb1250.h>
42#include <asm/sibyte/sb1250_regs.h>
43#include <asm/sibyte/sb1250_genbus.h>
44#include <asm/sibyte/board.h>
45
46extern void sb1250_setup(void);
47
48extern int xicor_probe(void);
49extern int xicor_set_time(unsigned long);
50extern unsigned long xicor_get_time(void);
51
52extern int m41t81_probe(void);
53extern int m41t81_set_time(unsigned long);
54extern unsigned long m41t81_get_time(void);
55
56const char *get_system_type(void)
57{
58 return "SiByte " SIBYTE_BOARD_NAME;
59}
60
61void __init swarm_timer_setup(struct irqaction *irq)
62{
63 /*
64 * we don't set up irqaction, because we will deliver timer
65 * interrupts through low-level (direct) meachanism.
66 */
67
68 /* We only need to setup the generic timer */
69 sb1250_time_init();
70}
71
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 */
Ralf Baechle6aaf7782005-10-01 13:14:58 +010076 printk("DBE physical address: %010Lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 __read_64bit_c0_register($26, 1));
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 }
79 return (is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL);
80}
81
Ralf Baechlec83cfc92005-06-21 13:56:30 +000082void __init plat_setup(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070083{
84 sb1250_setup();
85
86 panic_timeout = 5; /* For debug. */
87
88 board_timer_setup = swarm_timer_setup;
89 board_be_handler = swarm_be_handler;
90
91 if (xicor_probe()) {
92 printk("swarm setup: Xicor 1241 RTC detected.\n");
93 rtc_get_time = xicor_get_time;
94 rtc_set_time = xicor_set_time;
95 }
Ralf Baechle42a3b4f2005-09-03 15:56:17 -070096
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 if (m41t81_probe()) {
98 printk("swarm setup: M41T81 RTC detected.\n");
99 rtc_get_time = m41t81_get_time;
100 rtc_set_time = m41t81_set_time;
101 }
102
103 printk("This kernel optimized for "
104#ifdef CONFIG_SIMULATION
105 "simulation"
106#else
107 "board"
108#endif
109 " runs "
110#ifdef CONFIG_SIBYTE_CFE
111 "with"
112#else
113 "without"
114#endif
115 " CFE\n");
116
117#ifdef CONFIG_VT
118 screen_info = (struct screen_info) {
119 0, 0, /* orig-x, orig-y */
120 0, /* unused */
121 52, /* orig_video_page */
122 3, /* orig_video_mode */
123 80, /* orig_video_cols */
124 4626, 3, 9, /* unused, ega_bx, unused */
125 25, /* orig_video_lines */
126 0x22, /* orig_video_isVGA */
127 16 /* orig_video_points */
128 };
129 /* XXXKW for CFE, get lines/cols from environment */
130#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131}
132
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133#ifdef LEDS_PHYS
134
135#ifdef CONFIG_SIBYTE_CARMEL
136/* XXXKW need to detect Monterey/LittleSur/etc */
137#undef LEDS_PHYS
138#define LEDS_PHYS MLEDS_PHYS
139#endif
140
141#define setled(index, c) \
142 ((unsigned char *)(IOADDR(LEDS_PHYS)+0x20))[(3-(index))<<3] = (c)
143void setleds(char *str)
144{
145 int i;
146 for (i = 0; i < 4; i++) {
147 if (!str[i]) {
148 setled(i, ' ');
149 } else {
150 setled(i, str[i]);
151 }
152 }
153}
154#endif