File: /usr/src/linux/arch/mips/mips-boards/malta/malta_setup.c
1 /*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 */
18 #include <linux/config.h>
19 #include <linux/init.h>
20 #include <linux/sched.h>
21 #include <linux/mc146818rtc.h>
22 #include <linux/ioport.h>
23 #include <linux/pci.h>
24 #ifdef CONFIG_BLK_DEV_IDE
25 #include <linux/ide.h>
26 #endif
27
28 #include <asm/cpu.h>
29 #include <asm/bootinfo.h>
30 #include <asm/irq.h>
31 #include <asm/mips-boards/generic.h>
32 #include <asm/mips-boards/prom.h>
33 #include <asm/mips-boards/malta.h>
34 #include <asm/mips-boards/maltaint.h>
35 #ifdef CONFIG_BLK_DEV_FD
36 #include <asm/floppy.h>
37 #endif
38 #include <asm/dma.h>
39
40 #if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_PROM_CONSOLE)
41 extern void console_setup(char *, int *);
42 char serial_console[20];
43 #endif
44
45 #ifdef CONFIG_REMOTE_DEBUG
46 extern void set_debug_traps(void);
47 extern void rs_kgdb_hook(int);
48 extern void breakpoint(void);
49 static int remote_debug = 0;
50 #endif
51
52 extern struct ide_ops std_ide_ops;
53 extern struct fd_ops std_fd_ops;
54 extern struct rtc_ops malta_rtc_ops;
55 extern struct kbd_ops std_kbd_ops;
56
57 extern void mips_reboot_setup(void);
58
59 struct resource standard_io_resources[] = {
60 { "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
61 { "timer", 0x40, 0x5f, IORESOURCE_BUSY },
62 { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY },
63 { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
64 };
65
66 #define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource))
67
68 void __init malta_setup(void)
69 {
70 #ifdef CONFIG_REMOTE_DEBUG
71 int rs_putDebugChar(char);
72 char rs_getDebugChar(void);
73 extern int (*generic_putDebugChar)(char);
74 extern char (*generic_getDebugChar)(void);
75 #endif
76 char *argptr;
77 int i;
78
79 /* Request I/O space for devices used on the Malta board. */
80 for (i = 0; i < STANDARD_IO_RESOURCES; i++)
81 request_resource(&ioport_resource, standard_io_resources+i);
82
83 /*
84 * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge.
85 */
86 enable_dma(4);
87
88 #ifdef CONFIG_SERIAL_CONSOLE
89 argptr = prom_getcmdline();
90 if ((argptr = strstr(argptr, "console=")) == NULL) {
91 argptr = prom_getcmdline();
92 strcat(argptr, " console=ttyS0,38400");
93 }
94 #endif
95
96 #ifdef CONFIG_REMOTE_DEBUG
97 argptr = prom_getcmdline();
98 if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
99 int line;
100 argptr += strlen("kgdb=ttyS");
101 if (*argptr != '0' && *argptr != '1')
102 printk("KGDB: Uknown serial line /dev/ttyS%c, "
103 "falling back to /dev/ttyS1\n", *argptr);
104 line = *argptr == '0' ? 0 : 1;
105 printk("KGDB: Using serial line /dev/ttyS%d for session\n",
106 line ? 1 : 0);
107
108 rs_kgdb_hook(line);
109 generic_putDebugChar = rs_putDebugChar;
110 generic_getDebugChar = rs_getDebugChar;
111
112 prom_printf("KGDB: Using serial line /dev/ttyS%d for session, "
113 "please connect your debugger\n", line ? 1 : 0);
114
115 remote_debug = 1;
116 /* Breakpoints are in init_IRQ() */
117 }
118 #endif
119
120 argptr = prom_getcmdline();
121 if ((argptr = strstr(argptr, "nofpu")) != NULL)
122 mips_cpu.options &= ~MIPS_CPU_FPU;
123
124 rtc_ops = &malta_rtc_ops;
125 #ifdef CONFIG_BLK_DEV_IDE
126 ide_ops = &std_ide_ops;
127 #endif
128 #ifdef CONFIG_BLK_DEV_FD
129 fd_ops = &std_fd_ops;
130 #endif
131 #ifdef CONFIG_PC_KEYB
132 kbd_ops = &std_kbd_ops;
133 #endif
134 mips_reboot_setup();
135 }
136