1/*
2 * Copyright (C) 2000, 2001 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17 */
18
19/*
20 * Setup code for the SWARM board
21 */
22
23#include <linux/spinlock.h>
24#include <linux/mm.h>
25#include <linux/bootmem.h>
26#include <linux/blk.h>
27#include <linux/init.h>
28#include <linux/ide.h>
29#include <linux/console.h>
30
31#include <asm/irq.h>
32#include <asm/io.h>
33#include <asm/bootinfo.h>
34#include <asm/reboot.h>
35#include <asm/time.h>
36#include <asm/sibyte/sb1250.h>
37#include <asm/sibyte/sb1250_regs.h>
38#include <asm/sibyte/sb1250_genbus.h>
39#include <asm/sibyte/64bit.h>
40#include <asm/sibyte/board.h>
41
42extern struct rtc_ops *rtc_ops;
43extern struct rtc_ops swarm_rtc_ops;
44
45#ifdef CONFIG_BLK_DEV_IDE
46extern struct ide_ops std_ide_ops;
47#ifdef CONFIG_BLK_DEV_IDE_SIBYTE
48extern struct ide_ops sibyte_ide_ops;
49#endif
50#endif
51
52#ifdef CONFIG_L3DEMO
53extern void *l3info;
54#endif
55
56const char *get_system_type(void)
57{
58	return "SiByte " SIBYTE_BOARD_NAME;
59}
60
61
62void __init bus_error_init(void)
63{
64}
65
66void __init swarm_timer_setup(struct irqaction *irq)
67{
68        /*
69         * we don't set up irqaction, because we will deliver timer
70         * interrupts through low-level (direct) meachanism.
71         */
72
73        /* We only need to setup the generic timer */
74        sb1250_time_init();
75}
76
77extern int xicor_set_time(unsigned long);
78extern unsigned long xicor_get_time(void);
79extern void sb1250_setup(void);
80
81void __init swarm_setup(void)
82{
83	extern int panic_timeout;
84
85	sb1250_setup();
86
87	panic_timeout = 5;  /* For debug.  */
88
89        board_timer_setup = swarm_timer_setup;
90
91        rtc_get_time = xicor_get_time;
92        rtc_set_time = xicor_set_time;
93
94#ifdef CONFIG_L3DEMO
95	if (l3info != NULL) {
96		printk("\n");
97	}
98#endif
99	printk("This kernel optimized for "
100#ifdef CONFIG_SIMULATION
101	       "simulation"
102#else
103	       "board"
104#endif
105	       " runs "
106#ifdef CONFIG_SIBYTE_CFE
107	       "with"
108#else
109	       "without"
110#endif
111	       " CFE\n");
112
113#ifdef CONFIG_BLK_DEV_IDE
114#ifdef CONFIG_BLK_DEV_IDE_SIBYTE
115	ide_ops = &sibyte_ide_ops;
116#else
117	ide_ops = &std_ide_ops;
118#endif
119#endif
120
121#ifdef CONFIG_VT
122#ifdef CONFIG_DUMMY_CONSOLE
123	conswitchp = &dummy_con;
124#endif
125	screen_info = (struct screen_info) {
126		0, 0,           /* orig-x, orig-y */
127		0,              /* unused */
128		52,             /* orig_video_page */
129		3,              /* orig_video_mode */
130		80,             /* orig_video_cols */
131		4626, 3, 9,     /* unused, ega_bx, unused */
132		25,             /* orig_video_lines */
133		0x22,           /* orig_video_isVGA */
134		16              /* orig_video_points */
135       };
136       /* XXXKW for CFE, get lines/cols from environment */
137#endif
138}
139
140#ifdef LEDS_PHYS
141
142#ifdef CONFIG_SIBYTE_CARMEL
143/* XXXKW need to detect Monterey/LittleSur/etc */
144#undef LEDS_PHYS
145#define LEDS_PHYS MLEDS_PHYS
146#endif
147
148#define setled(index, c) \
149  ((unsigned char *)(LEDS_PHYS|IO_SPACE_BASE|0x20))[(3-(index))<<3] = (c)
150void setleds(char *str)
151{
152	int i;
153	for (i = 0; i < 4; i++) {
154		if (!str[i]) {
155			setled(i, ' ');
156		} else {
157			setled(i, str[i]);
158		}
159	}
160}
161#endif
162