blk: rq_data_dir() should not return a boolean
[cris-mirror.git] / arch / mips / sibyte / swarm / setup.c
blob494fb0a475acd41a202cb71f711764abd71c7ad2
1 /*
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>
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>
30 #include <linux/screen_info.h>
31 #include <linux/initrd.h>
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>
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>
45 #else
46 #error invalid SiByte board configuration
47 #endif
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);
55 #else
56 #error invalid SiByte board configuration
57 #endif
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 int swarm_be_handler(struct pt_regs *regs, int is_fixup)
74 if (!is_fixup && (regs->cp0_cause & 4)) {
75 /* Data bus error - print PA */
76 printk("DBE physical address: %010Lx\n",
77 __read_64bit_c0_register($26, 1));
79 return is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL;
82 enum swarm_rtc_type {
83 RTC_NONE,
84 RTC_XICOR,
85 RTC_M41T81,
88 enum swarm_rtc_type swarm_rtc_type;
90 void read_persistent_clock(struct timespec *ts)
92 unsigned long sec;
94 switch (swarm_rtc_type) {
95 case RTC_XICOR:
96 sec = xicor_get_time();
97 break;
99 case RTC_M41T81:
100 sec = m41t81_get_time();
101 break;
103 case RTC_NONE:
104 default:
105 sec = mktime(2000, 1, 1, 0, 0, 0);
106 break;
108 ts->tv_sec = sec;
109 ts->tv_nsec = 0;
112 int rtc_mips_set_time(unsigned long sec)
114 switch (swarm_rtc_type) {
115 case RTC_XICOR:
116 return xicor_set_time(sec);
118 case RTC_M41T81:
119 return m41t81_set_time(sec);
121 case RTC_NONE:
122 default:
123 return -1;
127 void __init plat_mem_setup(void)
129 #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
130 bcm1480_setup();
131 #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
132 sb1250_setup();
133 #else
134 #error invalid SiByte board configuration
135 #endif
137 board_be_handler = swarm_be_handler;
139 if (xicor_probe())
140 swarm_rtc_type = RTC_XICOR;
141 if (m41t81_probe())
142 swarm_rtc_type = RTC_M41T81;
144 #ifdef CONFIG_VT
145 screen_info = (struct screen_info) {
146 .orig_video_page = 52,
147 .orig_video_mode = 3,
148 .orig_video_cols = 80,
149 .flags = 12,
150 .orig_video_ega_bx = 3,
151 .orig_video_lines = 25,
152 .orig_video_isVGA = 0x22,
153 .orig_video_points = 16,
155 /* XXXKW for CFE, get lines/cols from environment */
156 #endif
159 #ifdef LEDS_PHYS
161 #ifdef CONFIG_SIBYTE_CARMEL
162 /* XXXKW need to detect Monterey/LittleSur/etc */
163 #undef LEDS_PHYS
164 #define LEDS_PHYS MLEDS_PHYS
165 #endif
167 void setleds(char *str)
169 void *reg;
170 int i;
172 for (i = 0; i < 4; i++) {
173 reg = IOADDR(LEDS_PHYS) + 0x20 + ((3 - i) << 3);
175 if (!str[i])
176 writeb(' ', reg);
177 else
178 writeb(str[i], reg);
182 #endif /* LEDS_PHYS */