| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * ip22-setup.c: SGI specific setup, including init of the feature struct. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) | 
					
						
							|  |  |  |  * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org) | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/kernel.h>
 | 
					
						
							|  |  |  | #include <linux/kdev_t.h>
 | 
					
						
							|  |  |  | #include <linux/types.h>
 | 
					
						
							|  |  |  | #include <linux/module.h>
 | 
					
						
							|  |  |  | #include <linux/console.h>
 | 
					
						
							|  |  |  | #include <linux/sched.h>
 | 
					
						
							|  |  |  | #include <linux/tty.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <asm/addrspace.h>
 | 
					
						
							|  |  |  | #include <asm/bcache.h>
 | 
					
						
							|  |  |  | #include <asm/bootinfo.h>
 | 
					
						
							|  |  |  | #include <asm/irq.h>
 | 
					
						
							|  |  |  | #include <asm/reboot.h>
 | 
					
						
							|  |  |  | #include <asm/time.h>
 | 
					
						
							|  |  |  | #include <asm/io.h>
 | 
					
						
							|  |  |  | #include <asm/traps.h>
 | 
					
						
							|  |  |  | #include <asm/sgialib.h>
 | 
					
						
							|  |  |  | #include <asm/sgi/mc.h>
 | 
					
						
							|  |  |  | #include <asm/sgi/hpc3.h>
 | 
					
						
							|  |  |  | #include <asm/sgi/ip22.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | unsigned long sgi_gfxaddr; | 
					
						
							| 
									
										
										
										
											2007-08-22 16:29:56 +01:00
										 |  |  | EXPORT_SYMBOL_GPL(sgi_gfxaddr); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | extern void ip22_be_init(void) __init; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-18 01:32:22 +01:00
										 |  |  | void __init plat_mem_setup(void) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	char *ctype; | 
					
						
							| 
									
										
										
										
											2006-01-30 17:48:27 +00:00
										 |  |  | 	char *cserial; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	board_be_init = ip22_be_init; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Init the INDY HPC I/O controller.  Need to call this before
 | 
					
						
							|  |  |  | 	 * fucking with the memory controller because it needs to know the | 
					
						
							|  |  |  | 	 * boardID and whether this is a Guiness or a FullHouse machine. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	sgihpc_init(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Init INDY memory controller. */ | 
					
						
							|  |  |  | 	sgimc_init(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_BOARD_SCACHE
 | 
					
						
							|  |  |  | 	/* Now enable boardcaches, if any. */ | 
					
						
							|  |  |  | 	indy_sc_init(); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Set EISA IO port base for Indigo2
 | 
					
						
							|  |  |  | 	 * ioremap cannot fail */ | 
					
						
							|  |  |  | 	set_io_port_base((unsigned long)ioremap(0x00080000, | 
					
						
							|  |  |  | 						0x1fffffff - 0x00080000)); | 
					
						
							|  |  |  | 	/* ARCS console environment variable is set to "g?" for
 | 
					
						
							|  |  |  | 	 * graphics console, it is set to "d" for the first serial | 
					
						
							|  |  |  | 	 * line and "d2" for the second serial line. | 
					
						
							| 
									
										
										
										
											2006-01-30 17:48:27 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * Need to check if the case is 'g' but no keyboard: | 
					
						
							|  |  |  | 	 * (ConsoleIn/Out = serial) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	ctype = ArcGetEnvironmentVariable("console"); | 
					
						
							| 
									
										
										
										
											2006-01-30 17:48:27 +00:00
										 |  |  | 	cserial = ArcGetEnvironmentVariable("ConsoleOut"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		static char options[8]; | 
					
						
							|  |  |  | 		char *baud = ArcGetEnvironmentVariable("dbaud"); | 
					
						
							|  |  |  | 		if (baud) | 
					
						
							|  |  |  | 			strcpy(options, baud); | 
					
						
							|  |  |  | 		add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0, | 
					
						
							|  |  |  | 				      baud ? options : NULL); | 
					
						
							|  |  |  | 	} else if (!ctype || *ctype != 'g') { | 
					
						
							| 
									
										
										
										
											2006-01-30 17:48:27 +00:00
										 |  |  | 		/* Use ARC if we don't want serial ('d') or graphics ('g'). */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		prom_flags |= PROM_FLAG_USE_AS_CONSOLE; | 
					
						
							|  |  |  | 		add_preferred_console("arc", 0, NULL); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE)
 | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		ULONG *gfxinfo; | 
					
						
							|  |  |  | 		ULONG * (*__vec)(void) = (void *) (long) | 
					
						
							|  |  |  | 			*((_PULONG *)(long)((PROMBLOCK)->pvector + 0x20)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		gfxinfo = __vec(); | 
					
						
							|  |  |  | 		sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000 | 
					
						
							|  |  |  | 			       && gfxinfo[1] <= 0xc0000000) | 
					
						
							|  |  |  | 			       ? gfxinfo[1] - 0xa0000000 : 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		/* newport addresses? */ | 
					
						
							|  |  |  | 		if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) { | 
					
						
							|  |  |  | 			conswitchp = &newport_con; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | } |