Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Andrew Isaacson | f137e46 | 2005-10-19 23:56:38 -0700 | [diff] [blame] | 2 | * Copyright (C) 2000, 2001, 2002, 2003, 2004 Broadcom Corporation |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> |
Andrew Isaacson | f137e46 | 2005-10-19 23:56:38 -0700 | [diff] [blame] | 42 | #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) |
| 43 | #include <asm/sibyte/bcm1480_regs.h> |
| 44 | #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #include <asm/sibyte/sb1250_regs.h> |
Andrew Isaacson | f137e46 | 2005-10-19 23:56:38 -0700 | [diff] [blame] | 46 | #else |
| 47 | #error invalid SiByte board configuation |
| 48 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #include <asm/sibyte/sb1250_genbus.h> |
| 50 | #include <asm/sibyte/board.h> |
| 51 | |
Andrew Isaacson | f137e46 | 2005-10-19 23:56:38 -0700 | [diff] [blame] | 52 | #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) |
| 53 | extern void bcm1480_setup(void); |
| 54 | #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | extern void sb1250_setup(void); |
Andrew Isaacson | f137e46 | 2005-10-19 23:56:38 -0700 | [diff] [blame] | 56 | #else |
| 57 | #error invalid SiByte board configuation |
| 58 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | |
| 60 | extern int xicor_probe(void); |
| 61 | extern int xicor_set_time(unsigned long); |
| 62 | extern unsigned long xicor_get_time(void); |
| 63 | |
| 64 | extern int m41t81_probe(void); |
| 65 | extern int m41t81_set_time(unsigned long); |
| 66 | extern unsigned long m41t81_get_time(void); |
| 67 | |
| 68 | const char *get_system_type(void) |
| 69 | { |
| 70 | return "SiByte " SIBYTE_BOARD_NAME; |
| 71 | } |
| 72 | |
| 73 | void __init swarm_timer_setup(struct irqaction *irq) |
| 74 | { |
| 75 | /* |
| 76 | * we don't set up irqaction, because we will deliver timer |
| 77 | * interrupts through low-level (direct) meachanism. |
| 78 | */ |
| 79 | |
| 80 | /* We only need to setup the generic timer */ |
Andrew Isaacson | f137e46 | 2005-10-19 23:56:38 -0700 | [diff] [blame] | 81 | #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) |
| 82 | bcm1480_time_init(); |
| 83 | #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) |
| 84 | sb1250_time_init(); |
| 85 | #else |
| 86 | #error invalid SiByte board configuation |
| 87 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | int swarm_be_handler(struct pt_regs *regs, int is_fixup) |
| 91 | { |
| 92 | if (!is_fixup && (regs->cp0_cause & 4)) { |
| 93 | /* Data bus error - print PA */ |
Ralf Baechle | 6aaf778 | 2005-10-01 13:14:58 +0100 | [diff] [blame] | 94 | printk("DBE physical address: %010Lx\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | __read_64bit_c0_register($26, 1)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | } |
| 97 | return (is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL); |
| 98 | } |
| 99 | |
Ralf Baechle | c83cfc9 | 2005-06-21 13:56:30 +0000 | [diff] [blame] | 100 | void __init plat_setup(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | { |
Andrew Isaacson | f137e46 | 2005-10-19 23:56:38 -0700 | [diff] [blame] | 102 | #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) |
| 103 | bcm1480_setup(); |
| 104 | #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | sb1250_setup(); |
Andrew Isaacson | f137e46 | 2005-10-19 23:56:38 -0700 | [diff] [blame] | 106 | #else |
| 107 | #error invalid SiByte board configuation |
| 108 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | |
| 110 | panic_timeout = 5; /* For debug. */ |
| 111 | |
| 112 | board_timer_setup = swarm_timer_setup; |
| 113 | board_be_handler = swarm_be_handler; |
| 114 | |
| 115 | if (xicor_probe()) { |
| 116 | printk("swarm setup: Xicor 1241 RTC detected.\n"); |
| 117 | rtc_get_time = xicor_get_time; |
| 118 | rtc_set_time = xicor_set_time; |
| 119 | } |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 120 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | if (m41t81_probe()) { |
| 122 | printk("swarm setup: M41T81 RTC detected.\n"); |
| 123 | rtc_get_time = m41t81_get_time; |
| 124 | rtc_set_time = m41t81_set_time; |
| 125 | } |
| 126 | |
| 127 | printk("This kernel optimized for " |
| 128 | #ifdef CONFIG_SIMULATION |
| 129 | "simulation" |
| 130 | #else |
| 131 | "board" |
| 132 | #endif |
| 133 | " runs " |
| 134 | #ifdef CONFIG_SIBYTE_CFE |
| 135 | "with" |
| 136 | #else |
| 137 | "without" |
| 138 | #endif |
| 139 | " CFE\n"); |
| 140 | |
| 141 | #ifdef CONFIG_VT |
| 142 | screen_info = (struct screen_info) { |
| 143 | 0, 0, /* orig-x, orig-y */ |
| 144 | 0, /* unused */ |
| 145 | 52, /* orig_video_page */ |
| 146 | 3, /* orig_video_mode */ |
| 147 | 80, /* orig_video_cols */ |
| 148 | 4626, 3, 9, /* unused, ega_bx, unused */ |
| 149 | 25, /* orig_video_lines */ |
| 150 | 0x22, /* orig_video_isVGA */ |
| 151 | 16 /* orig_video_points */ |
| 152 | }; |
| 153 | /* XXXKW for CFE, get lines/cols from environment */ |
| 154 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | } |
| 156 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | #ifdef LEDS_PHYS |
| 158 | |
| 159 | #ifdef CONFIG_SIBYTE_CARMEL |
| 160 | /* XXXKW need to detect Monterey/LittleSur/etc */ |
| 161 | #undef LEDS_PHYS |
| 162 | #define LEDS_PHYS MLEDS_PHYS |
| 163 | #endif |
| 164 | |
| 165 | #define setled(index, c) \ |
| 166 | ((unsigned char *)(IOADDR(LEDS_PHYS)+0x20))[(3-(index))<<3] = (c) |
| 167 | void setleds(char *str) |
| 168 | { |
| 169 | int i; |
| 170 | for (i = 0; i < 4; i++) { |
| 171 | if (!str[i]) { |
| 172 | setled(i, ' '); |
| 173 | } else { |
| 174 | setled(i, str[i]); |
| 175 | } |
| 176 | } |
| 177 | } |
| 178 | #endif |