2005-04-17 02:20:36 +04:00
|
|
|
/*
|
2005-10-20 10:56:38 +04:00
|
|
|
* Copyright (C) 2000, 2001, 2002, 2003, 2004 Broadcom Corporation
|
2005-04-17 02:20:36 +04:00
|
|
|
* Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Setup code for the SWARM board
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/bootmem.h>
|
|
|
|
#include <linux/blkdev.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel.h>
|
2006-07-10 15:44:13 +04:00
|
|
|
#include <linux/screen_info.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <linux/initrd.h>
|
|
|
|
|
|
|
|
#include <asm/irq.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/bootinfo.h>
|
|
|
|
#include <asm/mipsregs.h>
|
|
|
|
#include <asm/reboot.h>
|
|
|
|
#include <asm/time.h>
|
|
|
|
#include <asm/traps.h>
|
|
|
|
#include <asm/sibyte/sb1250.h>
|
2005-10-20 10:56:38 +04:00
|
|
|
#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
|
|
|
|
#include <asm/sibyte/bcm1480_regs.h>
|
|
|
|
#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <asm/sibyte/sb1250_regs.h>
|
2005-10-20 10:56:38 +04:00
|
|
|
#else
|
2006-11-30 16:45:32 +03:00
|
|
|
#error invalid SiByte board configuration
|
2005-10-20 10:56:38 +04:00
|
|
|
#endif
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <asm/sibyte/sb1250_genbus.h>
|
|
|
|
#include <asm/sibyte/board.h>
|
|
|
|
|
2005-10-20 10:56:38 +04:00
|
|
|
#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
|
|
|
|
extern void bcm1480_setup(void);
|
|
|
|
#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
|
2005-04-17 02:20:36 +04:00
|
|
|
extern void sb1250_setup(void);
|
2005-10-20 10:56:38 +04:00
|
|
|
#else
|
2006-11-30 16:45:32 +03:00
|
|
|
#error invalid SiByte board configuration
|
2005-10-20 10:56:38 +04:00
|
|
|
#endif
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
extern int xicor_probe(void);
|
|
|
|
extern int xicor_set_time(unsigned long);
|
|
|
|
extern unsigned long xicor_get_time(void);
|
|
|
|
|
|
|
|
extern int m41t81_probe(void);
|
|
|
|
extern int m41t81_set_time(unsigned long);
|
|
|
|
extern unsigned long m41t81_get_time(void);
|
|
|
|
|
|
|
|
const char *get_system_type(void)
|
|
|
|
{
|
|
|
|
return "SiByte " SIBYTE_BOARD_NAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
int swarm_be_handler(struct pt_regs *regs, int is_fixup)
|
|
|
|
{
|
|
|
|
if (!is_fixup && (regs->cp0_cause & 4)) {
|
|
|
|
/* Data bus error - print PA */
|
2005-10-01 16:14:58 +04:00
|
|
|
printk("DBE physical address: %010Lx\n",
|
2005-04-17 02:20:36 +04:00
|
|
|
__read_64bit_c0_register($26, 1));
|
|
|
|
}
|
|
|
|
return (is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL);
|
|
|
|
}
|
|
|
|
|
2007-10-12 02:46:08 +04:00
|
|
|
enum swarm_rtc_type {
|
|
|
|
RTC_NONE,
|
|
|
|
RTC_XICOR,
|
2010-11-02 22:38:53 +03:00
|
|
|
RTC_M41T81,
|
2007-10-12 02:46:08 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum swarm_rtc_type swarm_rtc_type;
|
|
|
|
|
2009-08-14 17:47:31 +04:00
|
|
|
void read_persistent_clock(struct timespec *ts)
|
2007-10-12 02:46:08 +04:00
|
|
|
{
|
2009-08-14 17:47:31 +04:00
|
|
|
unsigned long sec;
|
|
|
|
|
2007-10-12 02:46:08 +04:00
|
|
|
switch (swarm_rtc_type) {
|
|
|
|
case RTC_XICOR:
|
2009-08-14 17:47:31 +04:00
|
|
|
sec = xicor_get_time();
|
|
|
|
break;
|
2007-10-12 02:46:08 +04:00
|
|
|
|
2010-11-02 22:38:53 +03:00
|
|
|
case RTC_M41T81:
|
2009-08-14 17:47:31 +04:00
|
|
|
sec = m41t81_get_time();
|
|
|
|
break;
|
2007-10-12 02:46:08 +04:00
|
|
|
|
|
|
|
case RTC_NONE:
|
|
|
|
default:
|
2009-08-14 17:47:31 +04:00
|
|
|
sec = mktime(2000, 1, 1, 0, 0, 0);
|
|
|
|
break;
|
2007-10-12 02:46:08 +04:00
|
|
|
}
|
2009-08-14 17:47:31 +04:00
|
|
|
ts->tv_sec = sec;
|
2009-09-24 00:35:09 +04:00
|
|
|
ts->tv_nsec = 0;
|
2007-10-12 02:46:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int rtc_mips_set_time(unsigned long sec)
|
|
|
|
{
|
|
|
|
switch (swarm_rtc_type) {
|
|
|
|
case RTC_XICOR:
|
|
|
|
return xicor_set_time(sec);
|
|
|
|
|
2010-11-02 22:38:53 +03:00
|
|
|
case RTC_M41T81:
|
2007-10-12 02:46:08 +04:00
|
|
|
return m41t81_set_time(sec);
|
|
|
|
|
|
|
|
case RTC_NONE:
|
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-18 04:32:22 +04:00
|
|
|
void __init plat_mem_setup(void)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2005-10-20 10:56:38 +04:00
|
|
|
#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
|
|
|
|
bcm1480_setup();
|
|
|
|
#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
|
2005-04-17 02:20:36 +04:00
|
|
|
sb1250_setup();
|
2005-10-20 10:56:38 +04:00
|
|
|
#else
|
2006-11-30 16:45:32 +03:00
|
|
|
#error invalid SiByte board configuration
|
2005-10-20 10:56:38 +04:00
|
|
|
#endif
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
panic_timeout = 5; /* For debug. */
|
|
|
|
|
|
|
|
board_be_handler = swarm_be_handler;
|
|
|
|
|
2007-10-12 02:46:08 +04:00
|
|
|
if (xicor_probe())
|
|
|
|
swarm_rtc_type = RTC_XICOR;
|
|
|
|
if (m41t81_probe())
|
2010-11-02 22:38:53 +03:00
|
|
|
swarm_rtc_type = RTC_M41T81;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#ifdef CONFIG_VT
|
|
|
|
screen_info = (struct screen_info) {
|
2010-04-22 00:36:47 +04:00
|
|
|
.orig_video_page = 52,
|
|
|
|
.orig_video_mode = 3,
|
|
|
|
.orig_video_cols = 80,
|
|
|
|
.flags = 12,
|
|
|
|
.orig_video_ega_bx = 3,
|
|
|
|
.orig_video_lines = 25,
|
|
|
|
.orig_video_isVGA = 0x22,
|
|
|
|
.orig_video_points = 16,
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
/* XXXKW for CFE, get lines/cols from environment */
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef LEDS_PHYS
|
|
|
|
|
|
|
|
#ifdef CONFIG_SIBYTE_CARMEL
|
|
|
|
/* XXXKW need to detect Monterey/LittleSur/etc */
|
|
|
|
#undef LEDS_PHYS
|
|
|
|
#define LEDS_PHYS MLEDS_PHYS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void setleds(char *str)
|
|
|
|
{
|
2007-03-24 17:26:13 +03:00
|
|
|
void *reg;
|
2005-04-17 02:20:36 +04:00
|
|
|
int i;
|
2007-03-24 17:26:13 +03:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
for (i = 0; i < 4; i++) {
|
2007-03-24 17:26:13 +03:00
|
|
|
reg = IOADDR(LEDS_PHYS) + 0x20 + ((3 - i) << 3);
|
|
|
|
|
|
|
|
if (!str[i])
|
|
|
|
writeb(' ', reg);
|
|
|
|
else
|
|
|
|
writeb(str[i], reg);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
}
|
2007-03-24 17:26:13 +03:00
|
|
|
|
|
|
|
#endif /* LEDS_PHYS */
|