Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 46 | extern void sb1250_setup(void); |
| 47 | |
| 48 | extern int xicor_probe(void); |
| 49 | extern int xicor_set_time(unsigned long); |
| 50 | extern unsigned long xicor_get_time(void); |
| 51 | |
| 52 | extern int m41t81_probe(void); |
| 53 | extern int m41t81_set_time(unsigned long); |
| 54 | extern unsigned long m41t81_get_time(void); |
| 55 | |
| 56 | const char *get_system_type(void) |
| 57 | { |
| 58 | return "SiByte " SIBYTE_BOARD_NAME; |
| 59 | } |
| 60 | |
| 61 | void __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 | |
| 72 | int 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 Baechle | 6aaf778 | 2005-10-01 13:14:58 +0100 | [diff] [blame] | 76 | printk("DBE physical address: %010Lx\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | __read_64bit_c0_register($26, 1)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | } |
| 79 | return (is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL); |
| 80 | } |
| 81 | |
Ralf Baechle | c83cfc9 | 2005-06-21 13:56:30 +0000 | [diff] [blame] | 82 | void __init plat_setup(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | { |
| 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 Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 96 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | } |
| 132 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | #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) |
| 143 | void 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 |