aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/sni/sniprom.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/sni/sniprom.c')
-rw-r--r--arch/mips/sni/sniprom.c129
1 files changed, 119 insertions, 10 deletions
diff --git a/arch/mips/sni/sniprom.c b/arch/mips/sni/sniprom.c
index 1213d166f22e..6a44bbf0b732 100644
--- a/arch/mips/sni/sniprom.c
+++ b/arch/mips/sni/sniprom.c
@@ -12,6 +12,7 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/console.h>
15 16
16#include <asm/addrspace.h> 17#include <asm/addrspace.h>
17#include <asm/sni.h> 18#include <asm/sni.h>
@@ -31,7 +32,7 @@
31#define PROM_ENTRY(x) (PROM_VEC + (x)) 32#define PROM_ENTRY(x) (PROM_VEC + (x))
32 33
33 34
34#undef DEBUG 35#define DEBUG
35#ifdef DEBUG 36#ifdef DEBUG
36#define DBG_PRINTF(x...) prom_printf(x) 37#define DBG_PRINTF(x...) prom_printf(x)
37#else 38#else
@@ -93,14 +94,14 @@ static void sni_idprom_dump(void)
93{ 94{
94 int i; 95 int i;
95 96
96 prom_printf("SNI IDProm dump (first 128byte):\n"); 97 prom_printf("SNI IDProm dump:\n");
97 for(i=0;i<128;i++) { 98 for (i = 0; i < 256; i++) {
98 if (i%16 == 0) 99 if (i%16 == 0)
99 prom_printf("%04x ", i); 100 prom_printf("%04x ", i);
100 101
101 prom_printf("%02x ", *(unsigned char *) (SNI_IDPROM_BASE+i)); 102 prom_printf("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i));
102 103
103 if (i%16 == 15) 104 if (i % 16 == 15)
104 prom_printf("\n"); 105 prom_printf("\n");
105 } 106 }
106} 107}
@@ -118,7 +119,7 @@ static void sni_mem_init(void )
118 } memconf[8]; 119 } memconf[8];
119 120
120 /* MemSIZE from prom in 16MByte chunks */ 121 /* MemSIZE from prom in 16MByte chunks */
121 memsize=*((unsigned char *) SNI_IDPROM_MEMSIZE) * 16; 122 memsize = *((unsigned char *) SNI_IDPROM_MEMSIZE) * 16;
122 123
123 DBG_PRINTF("IDProm memsize: %lu MByte\n", memsize); 124 DBG_PRINTF("IDProm memsize: %lu MByte\n", memsize);
124 125
@@ -126,26 +127,134 @@ static void sni_mem_init(void )
126 __prom_get_memconf(&memconf); 127 __prom_get_memconf(&memconf);
127 128
128 DBG_PRINTF("prom_get_mem_conf memory configuration:\n"); 129 DBG_PRINTF("prom_get_mem_conf memory configuration:\n");
129 for(i=0;i<8 && memconf[i].size;i++) { 130 for (i = 0;i < 8 && memconf[i].size; i++) {
130 prom_printf("Bank%d: %08x @ %08x\n", i, 131 if (sni_brd_type == SNI_BRD_PCI_TOWER ||
132 sni_brd_type == SNI_BRD_PCI_TOWER_CPLUS) {
133 if (memconf[i].base >= 0x20000000 &&
134 memconf[i].base < 0x30000000) {
135 memconf[i].base -= 0x20000000;
136 }
137 }
138 DBG_PRINTF("Bank%d: %08x @ %08x\n", i,
131 memconf[i].size, memconf[i].base); 139 memconf[i].size, memconf[i].base);
132 add_memory_region(memconf[i].base, memconf[i].size, BOOT_MEM_RAM); 140 add_memory_region(memconf[i].base, memconf[i].size, BOOT_MEM_RAM);
133 } 141 }
134} 142}
135 143
144static void __init sni_console_setup(void)
145{
146 char *ctype;
147 char *cdev;
148 char *baud;
149 int port;
150 static char options[8];
151
152 cdev = prom_getenv ("console_dev");
153 if (strncmp (cdev, "tty", 3) == 0) {
154 ctype = prom_getenv ("console");
155 switch (*ctype) {
156 default:
157 case 'l':
158 port = 0;
159 baud = prom_getenv("lbaud");
160 break;
161 case 'r':
162 port = 1;
163 baud = prom_getenv("rbaud");
164 break;
165 }
166 if (baud)
167 strcpy(options, baud);
168 add_preferred_console("ttyS", port, baud ? options : NULL);
169 }
170}
171
136void __init prom_init(void) 172void __init prom_init(void)
137{ 173{
138 int argc = fw_arg0; 174 int argc = fw_arg0;
139 char **argv = (void *)fw_arg1; 175 char **argv = (void *)fw_arg1;
140 unsigned int sni_brd_type = *(unsigned char *) SNI_IDPROM_BRDTYPE;
141 int i; 176 int i;
177 int cputype;
142 178
143 DBG_PRINTF("Found SNI brdtype %02x\n", sni_brd_type); 179 sni_brd_type = *(unsigned char *)SNI_IDPROM_BRDTYPE;
180 cputype = *(unsigned char *)SNI_IDPROM_CPUTYPE;
181 switch (sni_brd_type) {
182 case SNI_BRD_TOWER_OASIC:
183 switch (cputype) {
184 case SNI_CPU_M8030:
185 systype = "RM400-330";
186 break;
187 case SNI_CPU_M8031:
188 systype = "RM400-430";
189 break;
190 case SNI_CPU_M8037:
191 systype = "RM400-530";
192 break;
193 case SNI_CPU_M8034:
194 systype = "RM400-730";
195 break;
196 default:
197 systype = "RM400-xxx";
198 break;
199 }
200 break;
201 case SNI_BRD_MINITOWER:
202 switch (cputype) {
203 case SNI_CPU_M8021:
204 case SNI_CPU_M8043:
205 systype = "RM400-120";
206 break;
207 case SNI_CPU_M8040:
208 systype = "RM400-220";
209 break;
210 case SNI_CPU_M8053:
211 systype = "RM400-225";
212 break;
213 case SNI_CPU_M8050:
214 systype = "RM400-420";
215 break;
216 default:
217 systype = "RM400-xxx";
218 break;
219 }
220 break;
221 case SNI_BRD_PCI_TOWER:
222 systype = "RM400-Cxx";
223 break;
224 case SNI_BRD_RM200:
225 systype = "RM200-xxx";
226 break;
227 case SNI_BRD_PCI_MTOWER:
228 systype = "RM300-Cxx";
229 break;
230 case SNI_BRD_PCI_DESKTOP:
231 switch (read_c0_prid() & 0xff00) {
232 case PRID_IMP_R4600:
233 case PRID_IMP_R4700:
234 systype = "RM200-C20";
235 break;
236 case PRID_IMP_R5000:
237 systype = "RM200-C40";
238 break;
239 default:
240 systype = "RM200-Cxx";
241 break;
242 }
243 break;
244 case SNI_BRD_PCI_TOWER_CPLUS:
245 systype = "RM400-Exx";
246 break;
247 case SNI_BRD_PCI_MTOWER_CPLUS:
248 systype = "RM300-Exx";
249 break;
250 }
251 DBG_PRINTF("Found SNI brdtype %02x name %s\n", sni_brd_type,systype);
144 252
145#ifdef DEBUG 253#ifdef DEBUG
146 sni_idprom_dump(); 254 sni_idprom_dump();
147#endif 255#endif
148 sni_mem_init(); 256 sni_mem_init();
257 sni_console_setup();
149 258
150 /* copy prom cmdline parameters to kernel cmdline */ 259 /* copy prom cmdline parameters to kernel cmdline */
151 for (i = 1; i < argc; i++) { 260 for (i = 1; i < argc; i++) {