aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lasat/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/lasat/setup.c')
-rw-r--r--arch/mips/lasat/setup.c192
1 files changed, 192 insertions, 0 deletions
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
new file mode 100644
index 000000000000..e371ed5cbe34
--- /dev/null
+++ b/arch/mips/lasat/setup.c
@@ -0,0 +1,192 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999 MIPS Technologies, Inc. All rights reserved.
4 *
5 * Thomas Horsten <thh@lasat.com>
6 * Copyright (C) 2000 LASAT Networks A/S.
7 *
8 * Brian Murphy <brian@murphy.dk>
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Lasat specific setup.
24 */
25#include <linux/config.h>
26#include <linux/init.h>
27#include <linux/sched.h>
28#include <linux/pci.h>
29#include <linux/interrupt.h>
30#include <linux/tty.h>
31#include <linux/serial.h>
32#include <linux/serial_core.h>
33
34#include <asm/time.h>
35#include <asm/cpu.h>
36#include <asm/bootinfo.h>
37#include <asm/irq.h>
38#include <asm/serial.h>
39#include <asm/lasat/lasat.h>
40#include <asm/lasat/serial.h>
41
42#ifdef CONFIG_PICVUE
43#include <linux/notifier.h>
44#endif
45
46#include "ds1603.h"
47#include <asm/lasat/ds1603.h>
48#include <asm/lasat/picvue.h>
49#include <asm/lasat/eeprom.h>
50
51#include "prom.h"
52
53int lasat_command_line = 0;
54void lasatint_init(void);
55
56extern void lasat_reboot_setup(void);
57extern void pcisetup(void);
58extern void edhac_init(void *, void *, void *);
59extern void addrflt_init(void);
60
61struct lasat_misc lasat_misc_info[N_MACHTYPES] = {
62 {(void *)KSEG1ADDR(0x1c840000), (void *)KSEG1ADDR(0x1c800000), 2},
63 {(void *)KSEG1ADDR(0x11080000), (void *)KSEG1ADDR(0x11000000), 6}
64};
65
66struct lasat_misc *lasat_misc = NULL;
67
68#ifdef CONFIG_DS1603
69static struct ds_defs ds_defs[N_MACHTYPES] = {
70 { (void *)DS1603_REG_100, (void *)DS1603_REG_100,
71 DS1603_RST_100, DS1603_CLK_100, DS1603_DATA_100,
72 DS1603_DATA_SHIFT_100, 0, 0 },
73 { (void *)DS1603_REG_200, (void *)DS1603_DATA_REG_200,
74 DS1603_RST_200, DS1603_CLK_200, DS1603_DATA_200,
75 DS1603_DATA_READ_SHIFT_200, 1, 2000 }
76};
77#endif
78
79#ifdef CONFIG_PICVUE
80#include "picvue.h"
81static struct pvc_defs pvc_defs[N_MACHTYPES] = {
82 { (void *)PVC_REG_100, PVC_DATA_SHIFT_100, PVC_DATA_M_100,
83 PVC_E_100, PVC_RW_100, PVC_RS_100 },
84 { (void *)PVC_REG_200, PVC_DATA_SHIFT_200, PVC_DATA_M_200,
85 PVC_E_200, PVC_RW_200, PVC_RS_200 }
86};
87#endif
88
89static int lasat_panic_display(struct notifier_block *this,
90 unsigned long event, void *ptr)
91{
92#ifdef CONFIG_PICVUE
93 unsigned char *string = ptr;
94 if (string == NULL)
95 string = "Kernel Panic";
96 pvc_dump_string(string);
97#endif
98 return NOTIFY_DONE;
99}
100
101static int lasat_panic_prom_monitor(struct notifier_block *this,
102 unsigned long event, void *ptr)
103{
104 prom_monitor();
105 return NOTIFY_DONE;
106}
107
108static struct notifier_block lasat_panic_block[] =
109{
110 { lasat_panic_display, NULL, INT_MAX },
111 { lasat_panic_prom_monitor, NULL, INT_MIN }
112};
113
114static void lasat_time_init(void)
115{
116 mips_hpt_frequency = lasat_board_info.li_cpu_hz / 2;
117}
118
119static void lasat_timer_setup(struct irqaction *irq)
120{
121
122 write_c0_compare(
123 read_c0_count() +
124 mips_hpt_frequency / HZ);
125 change_c0_status(ST0_IM, IE_IRQ0 | IE_IRQ5);
126}
127
128#define DYNAMIC_SERIAL_INIT
129#ifdef DYNAMIC_SERIAL_INIT
130void __init serial_init(void)
131{
132#ifdef CONFIG_SERIAL_8250
133 struct uart_port s;
134
135 memset(&s, 0, sizeof(s));
136
137 s.flags = STD_COM_FLAGS;
138 s.iotype = SERIAL_IO_MEM;
139
140 if (mips_machtype == MACH_LASAT_100) {
141 s.uartclk = LASAT_BASE_BAUD_100 * 16;
142 s.irq = LASATINT_UART_100;
143 s.regshift = LASAT_UART_REGS_SHIFT_100;
144 s.membase = (char *)KSEG1ADDR(LASAT_UART_REGS_BASE_100);
145 } else {
146 s.uartclk = LASAT_BASE_BAUD_200 * 16;
147 s.irq = LASATINT_UART_200;
148 s.regshift = LASAT_UART_REGS_SHIFT_200;
149 s.membase = (char *)KSEG1ADDR(LASAT_UART_REGS_BASE_200);
150 }
151
152 if (early_serial_setup(&s) != 0)
153 printk(KERN_ERR "Serial setup failed!\n");
154#endif
155}
156#endif
157
158static int __init lasat_setup(void)
159{
160 int i;
161 lasat_misc = &lasat_misc_info[mips_machtype];
162#ifdef CONFIG_PICVUE
163 picvue = &pvc_defs[mips_machtype];
164#endif
165
166 /* Set up panic notifier */
167 for (i = 0; i < sizeof(lasat_panic_block) / sizeof(struct notifier_block); i++)
168 notifier_chain_register(&panic_notifier_list, &lasat_panic_block[i]);
169
170 lasat_reboot_setup();
171
172 board_time_init = lasat_time_init;
173 board_timer_setup = lasat_timer_setup;
174
175#ifdef CONFIG_DS1603
176 ds1603 = &ds_defs[mips_machtype];
177 rtc_get_time = ds1603_read;
178 rtc_set_time = ds1603_set;
179#endif
180
181#ifdef DYNAMIC_SERIAL_INIT
182 serial_init();
183#endif
184 /* Switch from prom exception handler to normal mode */
185 change_c0_status(ST0_BEV,0);
186
187 prom_printf("Lasat specific initialization complete\n");
188
189 return 0;
190}
191
192early_initcall(lasat_setup);