2 * BRIEF MODULE DESCRIPTION
3 * Galileo EV96100 setup.
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
9 * This file was derived from Carsten Langgaard's
10 * arch/mips/mips-boards/atlas/atlas_setup.c.
12 * Carsten Langgaard, carstenl@mips.com
13 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
23 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * You should have received a copy of the GNU General Public License along
32 * with this program; if not, write to the Free Software Foundation, Inc.,
33 * 675 Mass Ave, Cambridge, MA 02139, USA.
35 #include <linux/config.h>
36 #include <linux/init.h>
37 #include <linux/sched.h>
38 #include <linux/ioport.h>
39 #include <linux/mc146818rtc.h>
40 #include <linux/string.h>
41 #include <linux/ctype.h>
42 #include <linux/pci.h>
45 #include <asm/bootinfo.h>
46 #include <asm/mipsregs.h>
48 #include <asm/delay.h>
49 #include <asm/gt64120/gt64120.h>
50 #include <asm/galileo-boards/ev96100int.h>
53 extern char * __init prom_getcmdline(void);
55 extern void mips_reboot_setup(void);
56 extern struct rtc_ops no_rtc_ops;
57 extern struct resource ioport_resource;
59 unsigned char mac_0_1[12];
61 void __init ev96100_setup(void)
63 unsigned int config = read_c0_config();
64 unsigned int status = read_c0_status();
65 unsigned int info = read_c0_info();
70 clear_c0_status(ST0_FR);
73 printk("Secondary cache is enabled\n");
76 printk("Secondary cache is disabled\n");
79 if (status & (1<<27)) {
80 printk("User-mode cache ops enabled\n");
83 printk("User-mode cache ops disabled\n");
86 printk("CP0 info reg: %x\n", (unsigned)info);
88 printk("burst mode Scache RAMS\n");
91 printk("pipelined Scache RAMS\n");
94 if ((info & (0x3<<26)) >> 26 == 0) {
95 printk("67 percent drive strength\n");
97 else if ((info & (0x3<<26)) >> 26 == 1) {
98 printk("50 percent drive strength\n");
100 else if ((info & (0x3<<26)) >> 26 == 2) {
101 printk("100 percent drive strength\n");
103 else if ((info & (0x3<<26)) >> 26 == 3) {
104 printk("83 percent drive strength\n");
108 if ((info & (0x3<<23)) >> 23 == 0) {
109 printk("Write Protocol: R4000 compatible\n");
111 else if ((info & (0x3<<23)) >> 23 == 1) {
112 printk("Write Protocol: Reserved\n");
114 else if ((info & (0x3<<23)) >> 23 == 2) {
115 printk("Write Protocol: Pipelined\n");
117 else if ((info & (0x3<<23)) >> 23 == 3) {
118 printk("Write Protocol: Write re-issue\n");
122 printk("Atomic Enable is set\n");
125 argptr = prom_getcmdline();
126 #ifdef CONFIG_SERIAL_CONSOLE
127 if (strstr(argptr, "console=") == NULL) {
128 argptr = prom_getcmdline();
129 strcat(argptr, " console=ttyS0,115200");
133 rtc_ops = &no_rtc_ops;
135 set_io_port_base(KSEG1);
136 ioport_resource.start = GT_PCI_IO_BASE;
137 ioport_resource.end = GT_PCI_IO_BASE + 0x01ffffff;
139 #ifdef CONFIG_BLK_DEV_INITRD
140 ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
145 * setup gt controller master bit so we can do config cycles
148 /* Clear cause register bits */
149 GT_WRITE(GT_INTRCAUSE_OFS, ~(GT_INTRCAUSE_MASABORT0_BIT |
150 GT_INTRCAUSE_TARABORT0_BIT));
152 GT_WRITE(GT_PCI0_CFGADDR_OFS,
153 (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) |
154 (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) |
155 ((PCI_COMMAND / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) |
156 GT_PCI0_CFGADDR_CONFIGEN_BIT);
159 tmp = GT_READ(GT_PCI0_CFGDATA_OFS);
161 tmp |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
162 PCI_COMMAND_MASTER | PCI_COMMAND_SERR);
163 GT_WRITE(GT_PCI0_CFGADDR_OFS,
164 (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) |
165 (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) |
166 ((PCI_COMMAND / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) |
167 GT_PCI0_CFGADDR_CONFIGEN_BIT);
169 GT_WRITE(GT_PCI0_CFGDATA_OFS, tmp);
172 GT_WRITE(GT_PCI0_CFGADDR_OFS,
173 (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) |
174 (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) |
175 ((PCI_COMMAND / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) |
176 GT_PCI0_CFGADDR_CONFIGEN_BIT);
179 tmp = GT_READ(GT_PCI0_CFGDATA_OFS);
182 unsigned short get_gt_devid()
186 /* Figure out if this is a gt96100 or gt96100A */
187 GT_WRITE(GT_PCI0_CFGADDR_OFS,
188 (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) |
189 (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) |
190 ((PCI_VENDOR_ID / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) |
191 GT_PCI0_CFGADDR_CONFIGEN_BIT);
194 gt_devid = GT_READ(GT_PCI0_CFGDATA_OFS);
196 return gt_devid >> 16;