1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31#include <linux/config.h>
32#include <linux/init.h>
33#include <linux/sched.h>
34#include <linux/pci.h>
35#include <linux/ide.h>
36
37#include <linux/interrupt.h>
38#include <asm/time.h>
39
40#include <asm/cpu.h>
41#include <asm/bootinfo.h>
42#include <asm/irq.h>
43#include <asm/lasat/lasat.h>
44
45#include <linux/serial.h>
46#include <asm/serial.h>
47#include <asm/lasat/serial.h>
48
49#if CONFIG_PICVUE
50#include <linux/notifier.h>
51#endif
52
53#include "ds1603.h"
54#include "at93c.h"
55#include <asm/lasat/ds1603.h>
56#include <asm/lasat/picvue.h>
57#include <asm/lasat/eeprom.h>
58
59#include "prom.h"
60
61int lasat_command_line = 0;
62void lasatint_init(void);
63
64#ifdef CONFIG_BLK_DEV_IDE
65extern struct ide_ops std_ide_ops;
66extern struct ide_ops *ide_ops;
67#endif
68
69extern char arcs_cmdline[CL_SIZE];
70
71extern void lasat_reboot_setup(void);
72extern void pcisetup(void);
73extern void edhac_init(void *, void *, void *);
74extern void addrflt_init(void);
75
76struct lasat_misc lasat_misc_info[N_MACHTYPES] = {
77 {(void *)KSEG1ADDR(0x1c840000), (void *)KSEG1ADDR(0x1c800000), 2},
78 {(void *)KSEG1ADDR(0x11080000), (void *)KSEG1ADDR(0x11000000), 6}
79};
80
81struct lasat_misc *lasat_misc = NULL;
82
83#ifdef CONFIG_DS1603
84static struct ds_defs ds_defs[N_MACHTYPES] = {
85 { (void *)DS1603_REG_100, (void *)DS1603_REG_100,
86 DS1603_RST_100, DS1603_CLK_100, DS1603_DATA_100,
87 DS1603_DATA_SHIFT_100, 0, 0 },
88 { (void *)DS1603_REG_200, (void *)DS1603_DATA_REG_200,
89 DS1603_RST_200, DS1603_CLK_200, DS1603_DATA_200,
90 DS1603_DATA_READ_SHIFT_200, 1, 2000 }
91};
92#endif
93
94#ifdef CONFIG_PICVUE
95#include "picvue.h"
96static struct pvc_defs pvc_defs[N_MACHTYPES] = {
97 { (void *)PVC_REG_100, PVC_DATA_SHIFT_100, PVC_DATA_M_100,
98 PVC_E_100, PVC_RW_100, PVC_RS_100 },
99 { (void *)PVC_REG_200, PVC_DATA_SHIFT_200, PVC_DATA_M_200,
100 PVC_E_200, PVC_RW_200, PVC_RS_200 }
101};
102#endif
103
104static int lasat_panic_display(struct notifier_block *this,
105 unsigned long event, void *ptr)
106{
107#ifdef CONFIG_PICVUE
108 unsigned char *string = ptr;
109 if (string == NULL)
110 string = "Kernel Panic";
111 pvc_dump_string(string);
112#endif
113 return NOTIFY_DONE;
114}
115
116static int lasat_panic_prom_monitor(struct notifier_block *this,
117 unsigned long event, void *ptr)
118{
119 prom_monitor();
120 return NOTIFY_DONE;
121}
122
123static struct notifier_block lasat_panic_block[] =
124{
125 { lasat_panic_display, NULL, INT_MAX },
126 { lasat_panic_prom_monitor, NULL, INT_MIN }
127};
128
129#ifdef CONFIG_BLK_DEV_IDE
130static int lasat_ide_default_irq(ide_ioreg_t base) {
131 return 0;
132}
133
134static ide_ioreg_t lasat_ide_default_io_base(int index) {
135 return 0;
136}
137#endif
138
139static void lasat_time_init(void)
140{
141 mips_hpt_frequency = lasat_board_info.li_cpu_hz / 2;
142}
143
144static void lasat_timer_setup(struct irqaction *irq)
145{
146
147 write_c0_compare(
148 read_c0_count() +
149 mips_hpt_frequency / HZ);
150 change_c0_status(ST0_IM, IE_IRQ0 | IE_IRQ5);
151}
152
153#define MIPS_CPU_TIMER_IRQ 7
154asmlinkage void lasat_timer_interrupt(struct pt_regs *regs)
155{
156 ll_timer_interrupt(MIPS_CPU_TIMER_IRQ, regs);
157}
158
159void __init serial_init(void)
160{
161#ifdef CONFIG_SERIAL
162 struct serial_struct s;
163
164 memset(&s, 0, sizeof(s));
165
166 s.flags = STD_COM_FLAGS;
167 s.io_type = SERIAL_IO_MEM;
168
169 if (mips_machtype == MACH_LASAT_100) {
170 s.baud_base = LASAT_BASE_BAUD_100;
171 s.irq = LASATINT_UART_100;
172 s.iomem_reg_shift = LASAT_UART_REGS_SHIFT_100;
173 s.iomem_base = (u8 *)KSEG1ADDR(LASAT_UART_REGS_BASE_100);
174 } else {
175 s.baud_base = LASAT_BASE_BAUD_200;
176 s.irq = LASATINT_UART_200;
177 s.iomem_reg_shift = LASAT_UART_REGS_SHIFT_200;
178 s.iomem_base = (u8 *)KSEG1ADDR(LASAT_UART_REGS_BASE_200);
179 }
180
181 if (early_serial_setup(&s) != 0)
182 printk(KERN_ERR "Serial setup failed!\n");
183#endif
184}
185
186void __init lasat_setup(void)
187{
188 int i;
189 lasat_misc = &lasat_misc_info[mips_machtype];
190#ifdef CONFIG_PICVUE
191 picvue = &pvc_defs[mips_machtype];
192#endif
193
194
195 for (i = 0; i < sizeof(lasat_panic_block) / sizeof(struct notifier_block); i++)
196 notifier_chain_register(&panic_notifier_list, &lasat_panic_block[i]);
197
198#ifdef CONFIG_BLK_DEV_IDE
199 ide_ops = &std_ide_ops;
200 ide_ops->ide_default_irq = &lasat_ide_default_irq;
201 ide_ops->ide_default_io_base = &lasat_ide_default_io_base;
202#endif
203
204 lasat_reboot_setup();
205
206 board_time_init = lasat_time_init;
207 board_timer_setup = lasat_timer_setup;
208
209#ifdef CONFIG_DS1603
210 ds1603 = &ds_defs[mips_machtype];
211 rtc_get_time = ds1603_read;
212 rtc_set_time = ds1603_set;
213#endif
214
215 serial_init();
216
217
218 change_c0_status(ST0_BEV,0);
219
220 prom_printf("Lasat specific initialization complete\n");
221}
222
223
224