blob: 2187e63c6d88e97b8c77806a6dfa6066a97240a1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <linux/init.h>
26#include <linux/sched.h>
27#include <linux/pci.h>
28#include <linux/interrupt.h>
29#include <linux/tty.h>
30#include <linux/serial.h>
31#include <linux/serial_core.h>
32
33#include <asm/time.h>
34#include <asm/cpu.h>
35#include <asm/bootinfo.h>
36#include <asm/irq.h>
37#include <asm/serial.h>
38#include <asm/lasat/lasat.h>
39#include <asm/lasat/serial.h>
40
41#ifdef CONFIG_PICVUE
42#include <linux/notifier.h>
43#endif
44
45#include "ds1603.h"
46#include <asm/lasat/ds1603.h>
47#include <asm/lasat/picvue.h>
48#include <asm/lasat/eeprom.h>
49
50#include "prom.h"
51
52int lasat_command_line = 0;
53void lasatint_init(void);
54
55extern void lasat_reboot_setup(void);
56extern void pcisetup(void);
57extern void edhac_init(void *, void *, void *);
58extern void addrflt_init(void);
59
60struct lasat_misc lasat_misc_info[N_MACHTYPES] = {
61 {(void *)KSEG1ADDR(0x1c840000), (void *)KSEG1ADDR(0x1c800000), 2},
62 {(void *)KSEG1ADDR(0x11080000), (void *)KSEG1ADDR(0x11000000), 6}
63};
64
65struct lasat_misc *lasat_misc = NULL;
66
67#ifdef CONFIG_DS1603
68static struct ds_defs ds_defs[N_MACHTYPES] = {
69 { (void *)DS1603_REG_100, (void *)DS1603_REG_100,
70 DS1603_RST_100, DS1603_CLK_100, DS1603_DATA_100,
71 DS1603_DATA_SHIFT_100, 0, 0 },
72 { (void *)DS1603_REG_200, (void *)DS1603_DATA_REG_200,
73 DS1603_RST_200, DS1603_CLK_200, DS1603_DATA_200,
74 DS1603_DATA_READ_SHIFT_200, 1, 2000 }
75};
76#endif
77
78#ifdef CONFIG_PICVUE
79#include "picvue.h"
80static struct pvc_defs pvc_defs[N_MACHTYPES] = {
81 { (void *)PVC_REG_100, PVC_DATA_SHIFT_100, PVC_DATA_M_100,
82 PVC_E_100, PVC_RW_100, PVC_RS_100 },
83 { (void *)PVC_REG_200, PVC_DATA_SHIFT_200, PVC_DATA_M_200,
84 PVC_E_200, PVC_RW_200, PVC_RS_200 }
85};
86#endif
87
88static int lasat_panic_display(struct notifier_block *this,
89 unsigned long event, void *ptr)
90{
91#ifdef CONFIG_PICVUE
92 unsigned char *string = ptr;
93 if (string == NULL)
94 string = "Kernel Panic";
95 pvc_dump_string(string);
96#endif
97 return NOTIFY_DONE;
98}
99
100static int lasat_panic_prom_monitor(struct notifier_block *this,
101 unsigned long event, void *ptr)
102{
103 prom_monitor();
104 return NOTIFY_DONE;
105}
106
Ralf Baechle42a3b4f2005-09-03 15:56:17 -0700107static struct notifier_block lasat_panic_block[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108{
109 { lasat_panic_display, NULL, INT_MAX },
110 { lasat_panic_prom_monitor, NULL, INT_MIN }
111};
112
113static void lasat_time_init(void)
114{
115 mips_hpt_frequency = lasat_board_info.li_cpu_hz / 2;
116}
117
118static void lasat_timer_setup(struct irqaction *irq)
119{
120
121 write_c0_compare(
Ralf Baechle42a3b4f2005-09-03 15:56:17 -0700122 read_c0_count() +
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 mips_hpt_frequency / HZ);
124 change_c0_status(ST0_IM, IE_IRQ0 | IE_IRQ5);
125}
126
127#define DYNAMIC_SERIAL_INIT
128#ifdef DYNAMIC_SERIAL_INIT
129void __init serial_init(void)
130{
131#ifdef CONFIG_SERIAL_8250
132 struct uart_port s;
133
134 memset(&s, 0, sizeof(s));
135
Russell King59a675b2006-02-05 10:52:29 +0000136 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
Russell King9b4a1612006-02-05 10:48:10 +0000137 s.iotype = UPIO_MEM;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138
139 if (mips_machtype == MACH_LASAT_100) {
140 s.uartclk = LASAT_BASE_BAUD_100 * 16;
141 s.irq = LASATINT_UART_100;
142 s.regshift = LASAT_UART_REGS_SHIFT_100;
143 s.membase = (char *)KSEG1ADDR(LASAT_UART_REGS_BASE_100);
144 } else {
145 s.uartclk = LASAT_BASE_BAUD_200 * 16;
146 s.irq = LASATINT_UART_200;
147 s.regshift = LASAT_UART_REGS_SHIFT_200;
148 s.membase = (char *)KSEG1ADDR(LASAT_UART_REGS_BASE_200);
149 }
150
151 if (early_serial_setup(&s) != 0)
152 printk(KERN_ERR "Serial setup failed!\n");
153#endif
154}
155#endif
156
Ralf Baechle2925aba2006-06-18 01:32:22 +0100157void __init plat_mem_setup(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158{
159 int i;
160 lasat_misc = &lasat_misc_info[mips_machtype];
161#ifdef CONFIG_PICVUE
162 picvue = &pvc_defs[mips_machtype];
163#endif
164
165 /* Set up panic notifier */
166 for (i = 0; i < sizeof(lasat_panic_block) / sizeof(struct notifier_block); i++)
Alan Sterne041c682006-03-27 01:16:30 -0800167 atomic_notifier_chain_register(&panic_notifier_list,
168 &lasat_panic_block[i]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169
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];
Yoichi Yuasad23ee8f2006-03-27 01:16:33 -0800177 rtc_mips_get_time = ds1603_read;
178 rtc_mips_set_time = ds1603_set;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179#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");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188}