Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can distribute it and/or modify it |
| 5 | * under the terms of the GNU General Public License (Version 2) as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 11 | * for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License along |
| 14 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 15 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. |
| 16 | * |
| 17 | */ |
| 18 | |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 19 | #include <linux/init.h> |
| 20 | #include <linux/string.h> |
| 21 | #include <linux/kernel.h> |
Ralf Baechle | f6e2373 | 2007-07-10 17:32:56 +0100 | [diff] [blame] | 22 | #include <linux/io.h> |
| 23 | #include <linux/irq.h> |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 24 | #include <linux/ioport.h> |
| 25 | #include <linux/tty.h> |
| 26 | #include <linux/serial.h> |
| 27 | #include <linux/serial_core.h> |
Yinghai Lu | b187f18 | 2007-07-18 00:49:10 -0700 | [diff] [blame] | 28 | #include <linux/serial_8250.h> |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 29 | |
| 30 | #include <asm/cpu.h> |
| 31 | #include <asm/bootinfo.h> |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 32 | #include <asm/mips-boards/generic.h> |
| 33 | #include <asm/mips-boards/prom.h> |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 34 | #include <asm/time.h> |
| 35 | #include <asm/mips-boards/sim.h> |
| 36 | #include <asm/mips-boards/simint.h> |
Ralf Baechle | 56eccc3 | 2011-06-06 01:17:25 +0100 | [diff] [blame] | 37 | #include <asm/smp-ops.h> |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 38 | |
| 39 | |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 40 | static void __init serial_init(void); |
Ralf Baechle | 982f6ff | 2009-09-17 02:25:07 +0200 | [diff] [blame] | 41 | unsigned int _isbonito; |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 42 | |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 43 | const char *get_system_type(void) |
| 44 | { |
| 45 | return "MIPSsim"; |
| 46 | } |
| 47 | |
Ralf Baechle | 2925aba | 2006-06-18 01:32:22 +0100 | [diff] [blame] | 48 | void __init plat_mem_setup(void) |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 49 | { |
| 50 | set_io_port_base(0xbfd00000); |
| 51 | |
| 52 | serial_init(); |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 53 | } |
| 54 | |
Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 55 | extern struct plat_smp_ops ssmtc_smp_ops; |
| 56 | |
Ralf Baechle | f6e2373 | 2007-07-10 17:32:56 +0100 | [diff] [blame] | 57 | void __init prom_init(void) |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 58 | { |
| 59 | set_io_port_base(0xbfd00000); |
| 60 | |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 61 | prom_meminit(); |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 62 | |
Ralf Baechle | 852fe31 | 2011-05-28 15:27:59 +0100 | [diff] [blame] | 63 | if (cpu_has_mipsmt) { |
| 64 | if (!register_vsmp_smp_ops()) |
| 65 | return; |
| 66 | |
Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 67 | #ifdef CONFIG_MIPS_MT_SMTC |
Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 68 | register_smp_ops(&ssmtc_smp_ops); |
Ralf Baechle | 852fe31 | 2011-05-28 15:27:59 +0100 | [diff] [blame] | 69 | return; |
Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 70 | #endif |
Ralf Baechle | 852fe31 | 2011-05-28 15:27:59 +0100 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | register_up_smp_ops(); |
Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 74 | } |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 75 | |
| 76 | static void __init serial_init(void) |
| 77 | { |
| 78 | #ifdef CONFIG_SERIAL_8250 |
| 79 | struct uart_port s; |
| 80 | |
| 81 | memset(&s, 0, sizeof(s)); |
| 82 | |
| 83 | s.iobase = 0x3f8; |
| 84 | |
| 85 | /* hardware int 4 - the serial int, is CPU int 6 |
| 86 | but poll for now */ |
| 87 | s.irq = 0; |
Ralf Baechle | a74b460 | 2007-07-12 17:41:14 +0100 | [diff] [blame] | 88 | s.uartclk = 1843200; |
Russell King | 59a675b | 2006-02-05 10:52:29 +0000 | [diff] [blame] | 89 | s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; |
Russell King | 9b4a161 | 2006-02-05 10:48:10 +0000 | [diff] [blame] | 90 | s.iotype = UPIO_PORT; |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 91 | s.regshift = 0; |
| 92 | s.timeout = 4; |
| 93 | |
| 94 | if (early_serial_setup(&s) != 0) { |
Ralf Baechle | 36a8853 | 2007-03-01 11:56:43 +0000 | [diff] [blame] | 95 | printk(KERN_ERR "Serial setup failed!\n"); |
Ralf Baechle | c78cbf4 | 2005-09-30 13:59:37 +0100 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | #endif |
| 99 | } |