2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
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.
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
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.
18 #include <linux/init.h>
19 #include <linux/sched.h>
20 #include <linux/ioport.h>
21 #include <linux/pci.h>
22 #include <linux/screen_info.h>
25 #include <asm/bootinfo.h>
27 #include <asm/mips-boards/generic.h>
28 #include <asm/mips-boards/prom.h>
29 #include <asm/mips-boards/malta.h>
30 #include <asm/mips-boards/maltaint.h>
33 #include <asm/traps.h>
35 #include <linux/console.h>
38 extern void mips_reboot_setup(void);
39 extern void mips_time_init(void);
40 extern unsigned long mips_rtc_get_time(void);
43 extern void kgdb_config(void);
46 struct resource standard_io_resources[] = {
47 { .name = "dma1", .start = 0x00, .end = 0x1f, .flags = IORESOURCE_BUSY },
48 { .name = "timer", .start = 0x40, .end = 0x5f, .flags = IORESOURCE_BUSY },
49 { .name = "keyboard", .start = 0x60, .end = 0x6f, .flags = IORESOURCE_BUSY },
50 { .name = "dma page reg", .start = 0x80, .end = 0x8f, .flags = IORESOURCE_BUSY },
51 { .name = "dma2", .start = 0xc0, .end = 0xdf, .flags = IORESOURCE_BUSY },
54 const char *get_system_type(void)
59 #if defined(CONFIG_MIPS_MT_SMTC)
60 const char display_string[] = " SMTC LINUX ON MALTA ";
62 const char display_string[] = " LINUX ON MALTA ";
63 #endif /* CONFIG_MIPS_MT_SMTC */
65 #ifdef CONFIG_BLK_DEV_FD
66 void __init fd_activate(void)
69 * Activate Floppy Controller in the SMSC FDC37M817 Super I/O
71 * Done by YAMON 2.00 onwards
73 /* Entering config state. */
74 SMSC_WRITE(SMSC_CONFIG_ENTER, SMSC_CONFIG_REG);
76 /* Activate floppy controller. */
77 SMSC_WRITE(SMSC_CONFIG_DEVNUM, SMSC_CONFIG_REG);
78 SMSC_WRITE(SMSC_CONFIG_DEVNUM_FLOPPY, SMSC_DATA_REG);
79 SMSC_WRITE(SMSC_CONFIG_ACTIVATE, SMSC_CONFIG_REG);
80 SMSC_WRITE(SMSC_CONFIG_ACTIVATE_ENABLE, SMSC_DATA_REG);
82 /* Exit config state. */
83 SMSC_WRITE(SMSC_CONFIG_EXIT, SMSC_CONFIG_REG);
87 void __init plat_mem_setup(void)
93 /* Request I/O space for devices used on the Malta board. */
94 for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
95 request_resource(&ioport_resource, standard_io_resources+i);
98 * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge.
106 if ((mips_revision_corid == MIPS_REVISION_CORID_BONITO64) ||
107 (mips_revision_corid == MIPS_REVISION_CORID_CORE_20K) ||
108 (mips_revision_corid == MIPS_REVISION_CORID_CORE_EMUL_BON)) {
111 argptr = prom_getcmdline();
112 if (strstr(argptr, "debug")) {
113 BONITO_BONGENCFG |= BONITO_BONGENCFG_DEBUGMODE;
114 printk ("Enabled Bonito debug mode\n");
117 BONITO_BONGENCFG &= ~BONITO_BONGENCFG_DEBUGMODE;
119 #ifdef CONFIG_DMA_COHERENT
120 if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) {
121 BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
122 printk("Enabled Bonito CPU coherency\n");
124 argptr = prom_getcmdline();
125 if (strstr(argptr, "iobcuncached")) {
126 BONITO_PCICACHECTRL &= ~BONITO_PCICACHECTRL_IOBCCOH_EN;
127 BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG &
128 ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
129 BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
130 printk("Disabled Bonito IOBC coherency\n");
133 BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_IOBCCOH_EN;
134 BONITO_PCIMEMBASECFG |=
135 (BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
136 BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
137 printk("Enabled Bonito IOBC coherency\n");
141 panic("Hardware DMA cache coherency not supported");
145 #ifdef CONFIG_DMA_COHERENT
147 panic("Hardware DMA cache coherency not supported");
151 #ifdef CONFIG_BLK_DEV_IDE
152 /* Check PCI clock */
154 unsigned int __iomem *jmpr_p = (unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
155 int jmpr = (readw(jmpr_p) >> 2) & 0x07;
156 static const int pciclocks[] __initdata = {
157 33, 20, 25, 30, 12, 16, 37, 10
159 int pciclock = pciclocks[jmpr];
160 char *argptr = prom_getcmdline();
162 if (pciclock != 33 && !strstr (argptr, "idebus=")) {
163 printk("WARNING: PCI clock is %dMHz, setting idebus\n", pciclock);
164 argptr += strlen(argptr);
165 sprintf (argptr, " idebus=%d", pciclock);
166 if (pciclock < 20 || pciclock > 66)
167 printk ("WARNING: IDE timing calculations will be incorrect\n");
171 #ifdef CONFIG_BLK_DEV_FD
175 #if defined(CONFIG_VGA_CONSOLE)
176 screen_info = (struct screen_info) {
177 0, 25, /* orig-x, orig-y */
179 0, /* orig-video-page */
180 0, /* orig-video-mode */
181 80, /* orig-video-cols */
182 0,0,0, /* ega_ax, ega_bx, ega_cx */
183 25, /* orig-video-lines */
184 VIDEO_TYPE_VGAC, /* orig-video-isVGA */
185 16 /* orig-video-points */
191 board_time_init = mips_time_init;
192 rtc_mips_get_time = mips_rtc_get_time;