2 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Broadcom Corporation
3 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
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.
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.
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.
21 * Setup code for the SWARM board
24 #include <linux/spinlock.h>
26 #include <linux/bootmem.h>
27 #include <linux/blkdev.h>
28 #include <linux/init.h>
29 #include <linux/kernel.h>
30 #include <linux/screen_info.h>
31 #include <linux/initrd.h>
35 #include <asm/bootinfo.h>
36 #include <asm/mipsregs.h>
37 #include <asm/reboot.h>
39 #include <asm/traps.h>
40 #include <asm/sibyte/sb1250.h>
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)
44 #include <asm/sibyte/sb1250_regs.h>
46 #error invalid SiByte board configuration
48 #include <asm/sibyte/sb1250_genbus.h>
49 #include <asm/sibyte/board.h>
51 #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
52 extern void bcm1480_setup(void);
53 #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
54 extern void sb1250_setup(void);
56 #error invalid SiByte board configuration
59 extern int xicor_probe(void);
60 extern int xicor_set_time(unsigned long);
61 extern unsigned long xicor_get_time(void);
63 extern int m41t81_probe(void);
64 extern int m41t81_set_time(unsigned long);
65 extern unsigned long m41t81_get_time(void);
67 const char *get_system_type(void)
69 return "SiByte " SIBYTE_BOARD_NAME;
72 void __init plat_time_init(void)
74 #if defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
80 void __init plat_timer_setup(struct irqaction *irq)
83 * we don't set up irqaction, because we will deliver timer
84 * interrupts through low-level (direct) meachanism.
87 /* We only need to setup the generic timer */
88 #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
90 #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
93 #error invalid SiByte board configuration
97 int swarm_be_handler(struct pt_regs *regs, int is_fixup)
99 if (!is_fixup && (regs->cp0_cause & 4)) {
100 /* Data bus error - print PA */
101 printk("DBE physical address: %010Lx\n",
102 __read_64bit_c0_register($26, 1));
104 return (is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL);
107 enum swarm_rtc_type {
113 enum swarm_rtc_type swarm_rtc_type;
115 unsigned long read_persistent_clock(void)
117 switch (swarm_rtc_type) {
119 return xicor_get_time();
122 return m41t81_get_time();
126 return mktime(2000, 1, 1, 0, 0, 0);
130 int rtc_mips_set_time(unsigned long sec)
132 switch (swarm_rtc_type) {
134 return xicor_set_time(sec);
137 return m41t81_set_time(sec);
145 void __init plat_mem_setup(void)
147 #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
149 #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
152 #error invalid SiByte board configuration
155 panic_timeout = 5; /* For debug. */
157 board_be_handler = swarm_be_handler;
160 swarm_rtc_type = RTC_XICOR;
162 swarm_rtc_type = RTC_M4LT81;
164 printk("This kernel optimized for "
165 #ifdef CONFIG_SIMULATION
171 #ifdef CONFIG_SIBYTE_CFE
179 screen_info = (struct screen_info) {
180 0, 0, /* orig-x, orig-y */
182 52, /* orig_video_page */
183 3, /* orig_video_mode */
184 80, /* orig_video_cols */
185 4626, 3, 9, /* unused, ega_bx, unused */
186 25, /* orig_video_lines */
187 0x22, /* orig_video_isVGA */
188 16 /* orig_video_points */
190 /* XXXKW for CFE, get lines/cols from environment */
196 #ifdef CONFIG_SIBYTE_CARMEL
197 /* XXXKW need to detect Monterey/LittleSur/etc */
199 #define LEDS_PHYS MLEDS_PHYS
202 void setleds(char *str)
207 for (i = 0; i < 4; i++) {
208 reg = IOADDR(LEDS_PHYS) + 0x20 + ((3 - i) << 3);
217 #endif /* LEDS_PHYS */