| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #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> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | #include <asm/lasat/lasat.h> | 
 | 38 | #include <asm/lasat/serial.h> | 
 | 39 |  | 
 | 40 | #ifdef CONFIG_PICVUE | 
 | 41 | #include <linux/notifier.h> | 
 | 42 | #endif | 
 | 43 |  | 
 | 44 | #include "ds1603.h" | 
 | 45 | #include <asm/lasat/ds1603.h> | 
 | 46 | #include <asm/lasat/picvue.h> | 
 | 47 | #include <asm/lasat/eeprom.h> | 
 | 48 |  | 
 | 49 | #include "prom.h" | 
 | 50 |  | 
 | 51 | int lasat_command_line = 0; | 
 | 52 | void lasatint_init(void); | 
 | 53 |  | 
 | 54 | extern void lasat_reboot_setup(void); | 
 | 55 | extern void pcisetup(void); | 
 | 56 | extern void edhac_init(void *, void *, void *); | 
 | 57 | extern void addrflt_init(void); | 
 | 58 |  | 
 | 59 | struct lasat_misc lasat_misc_info[N_MACHTYPES] = { | 
 | 60 | 	{(void *)KSEG1ADDR(0x1c840000), (void *)KSEG1ADDR(0x1c800000), 2}, | 
 | 61 | 	{(void *)KSEG1ADDR(0x11080000), (void *)KSEG1ADDR(0x11000000), 6} | 
 | 62 | }; | 
 | 63 |  | 
 | 64 | struct lasat_misc *lasat_misc = NULL; | 
 | 65 |  | 
 | 66 | #ifdef CONFIG_DS1603 | 
 | 67 | static struct ds_defs ds_defs[N_MACHTYPES] = { | 
 | 68 | 	{ (void *)DS1603_REG_100, (void *)DS1603_REG_100, | 
 | 69 | 		DS1603_RST_100, DS1603_CLK_100, DS1603_DATA_100, | 
 | 70 | 		DS1603_DATA_SHIFT_100, 0, 0 }, | 
 | 71 | 	{ (void *)DS1603_REG_200, (void *)DS1603_DATA_REG_200, | 
 | 72 | 		DS1603_RST_200, DS1603_CLK_200, DS1603_DATA_200, | 
 | 73 | 		DS1603_DATA_READ_SHIFT_200, 1, 2000 } | 
 | 74 | }; | 
 | 75 | #endif | 
 | 76 |  | 
 | 77 | #ifdef CONFIG_PICVUE | 
 | 78 | #include "picvue.h" | 
 | 79 | static struct pvc_defs pvc_defs[N_MACHTYPES] = { | 
 | 80 | 	{ (void *)PVC_REG_100, PVC_DATA_SHIFT_100, PVC_DATA_M_100, | 
 | 81 | 		PVC_E_100, PVC_RW_100, PVC_RS_100 }, | 
 | 82 | 	{ (void *)PVC_REG_200, PVC_DATA_SHIFT_200, PVC_DATA_M_200, | 
 | 83 | 		PVC_E_200, PVC_RW_200, PVC_RS_200 } | 
 | 84 | }; | 
 | 85 | #endif | 
 | 86 |  | 
 | 87 | static int lasat_panic_display(struct notifier_block *this, | 
 | 88 | 			     unsigned long event, void *ptr) | 
 | 89 | { | 
 | 90 | #ifdef CONFIG_PICVUE | 
 | 91 | 	unsigned char *string = ptr; | 
 | 92 | 	if (string == NULL) | 
 | 93 | 		string = "Kernel Panic"; | 
 | 94 | 	pvc_dump_string(string); | 
 | 95 | #endif | 
 | 96 | 	return NOTIFY_DONE; | 
 | 97 | } | 
 | 98 |  | 
 | 99 | static int lasat_panic_prom_monitor(struct notifier_block *this, | 
 | 100 | 			     unsigned long event, void *ptr) | 
 | 101 | { | 
 | 102 | 	prom_monitor(); | 
 | 103 | 	return NOTIFY_DONE; | 
 | 104 | } | 
 | 105 |  | 
| Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 106 | static struct notifier_block lasat_panic_block[] = | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | { | 
 | 108 | 	{ lasat_panic_display, NULL, INT_MAX }, | 
 | 109 | 	{ lasat_panic_prom_monitor, NULL, INT_MIN } | 
 | 110 | }; | 
 | 111 |  | 
 | 112 | static void lasat_time_init(void) | 
 | 113 | { | 
 | 114 | 	mips_hpt_frequency = lasat_board_info.li_cpu_hz / 2; | 
 | 115 | } | 
 | 116 |  | 
| Ralf Baechle | 54d0a21 | 2006-07-09 21:38:56 +0100 | [diff] [blame] | 117 | void __init plat_timer_setup(struct irqaction *irq) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | { | 
| Ralf Baechle | 54d0a21 | 2006-07-09 21:38:56 +0100 | [diff] [blame] | 119 | 	write_c0_compare( read_c0_count() + mips_hpt_frequency / HZ); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | 	change_c0_status(ST0_IM, IE_IRQ0 | IE_IRQ5); | 
 | 121 | } | 
 | 122 |  | 
 | 123 | #define DYNAMIC_SERIAL_INIT | 
 | 124 | #ifdef DYNAMIC_SERIAL_INIT | 
 | 125 | void __init serial_init(void) | 
 | 126 | { | 
 | 127 | #ifdef CONFIG_SERIAL_8250 | 
 | 128 | 	struct uart_port s; | 
 | 129 |  | 
 | 130 | 	memset(&s, 0, sizeof(s)); | 
 | 131 |  | 
| Russell King | 59a675b | 2006-02-05 10:52:29 +0000 | [diff] [blame] | 132 | 	s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; | 
| Russell King | 9b4a161 | 2006-02-05 10:48:10 +0000 | [diff] [blame] | 133 | 	s.iotype = UPIO_MEM; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 |  | 
 | 135 | 	if (mips_machtype == MACH_LASAT_100) { | 
 | 136 | 		s.uartclk = LASAT_BASE_BAUD_100 * 16; | 
 | 137 | 		s.irq = LASATINT_UART_100; | 
 | 138 | 		s.regshift = LASAT_UART_REGS_SHIFT_100; | 
 | 139 | 		s.membase = (char *)KSEG1ADDR(LASAT_UART_REGS_BASE_100); | 
 | 140 | 	} else { | 
 | 141 | 		s.uartclk = LASAT_BASE_BAUD_200 * 16; | 
 | 142 | 		s.irq = LASATINT_UART_200; | 
 | 143 | 		s.regshift = LASAT_UART_REGS_SHIFT_200; | 
 | 144 | 		s.membase = (char *)KSEG1ADDR(LASAT_UART_REGS_BASE_200); | 
 | 145 | 	} | 
 | 146 |  | 
 | 147 | 	if (early_serial_setup(&s) != 0) | 
 | 148 | 		printk(KERN_ERR "Serial setup failed!\n"); | 
 | 149 | #endif | 
 | 150 | } | 
 | 151 | #endif | 
 | 152 |  | 
| Ralf Baechle | 2925aba | 2006-06-18 01:32:22 +0100 | [diff] [blame] | 153 | void __init plat_mem_setup(void) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | { | 
 | 155 | 	int i; | 
 | 156 | 	lasat_misc  = &lasat_misc_info[mips_machtype]; | 
 | 157 | #ifdef CONFIG_PICVUE | 
 | 158 | 	picvue = &pvc_defs[mips_machtype]; | 
 | 159 | #endif | 
 | 160 |  | 
 | 161 | 	/* Set up panic notifier */ | 
 | 162 | 	for (i = 0; i < sizeof(lasat_panic_block) / sizeof(struct notifier_block); i++) | 
| Alan Stern | e041c68 | 2006-03-27 01:16:30 -0800 | [diff] [blame] | 163 | 		atomic_notifier_chain_register(&panic_notifier_list, | 
 | 164 | 				&lasat_panic_block[i]); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 |  | 
 | 166 | 	lasat_reboot_setup(); | 
 | 167 |  | 
 | 168 | 	board_time_init = lasat_time_init; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 |  | 
 | 170 | #ifdef CONFIG_DS1603 | 
 | 171 | 	ds1603 = &ds_defs[mips_machtype]; | 
| Yoichi Yuasa | d23ee8f | 2006-03-27 01:16:33 -0800 | [diff] [blame] | 172 | 	rtc_mips_get_time = ds1603_read; | 
 | 173 | 	rtc_mips_set_time = ds1603_set; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | #endif | 
 | 175 |  | 
 | 176 | #ifdef DYNAMIC_SERIAL_INIT | 
 | 177 | 	serial_init(); | 
 | 178 | #endif | 
 | 179 | 	/* Switch from prom exception handler to normal mode */ | 
 | 180 | 	change_c0_status(ST0_BEV,0); | 
 | 181 |  | 
 | 182 | 	prom_printf("Lasat specific initialization complete\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | } |