| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * Setup pointers to hardware-dependent routines. | 
 | 3 |  * | 
 | 4 |  * This file is subject to the terms and conditions of the GNU General Public | 
 | 5 |  * License.  See the file "COPYING" in the main directory of this archive | 
 | 6 |  * for more details. | 
 | 7 |  * | 
| Ralf Baechle | fcdb27a | 2006-01-18 17:37:07 +0000 | [diff] [blame] | 8 |  * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org) | 
| Thomas Bogendoerfer | 22df5bc | 2007-05-17 14:53:12 +0200 | [diff] [blame] | 9 |  * Copyright (C) 2006,2007 Thomas Bogendoerfer (tsbogend@alpha.franken.de) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 |  */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <linux/eisa.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/init.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/console.h> | 
 | 14 | #include <linux/fb.h> | 
| Jon Smirl | 894673e | 2006-07-10 04:44:13 -0700 | [diff] [blame] | 15 | #include <linux/screen_info.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 |  | 
| Thomas Bogendoerfer | 4a0312f | 2006-06-13 13:59:01 +0200 | [diff] [blame] | 17 | #ifdef CONFIG_ARC | 
| Aurelien Jarno | 2f56cfd | 2007-09-05 08:59:34 +0200 | [diff] [blame] | 18 | #include <asm/fw/arc/types.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #include <asm/sgialib.h> | 
| Thomas Bogendoerfer | 4a0312f | 2006-06-13 13:59:01 +0200 | [diff] [blame] | 20 | #endif | 
 | 21 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <asm/io.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #include <asm/reboot.h> | 
 | 24 | #include <asm/sni.h> | 
| Thomas Bogendoerfer | c066a32 | 2006-12-28 18:22:32 +0100 | [diff] [blame] | 25 |  | 
 | 26 | unsigned int sni_brd_type; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 |  | 
 | 28 | extern void sni_machine_restart(char *command); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | extern void sni_machine_power_off(void); | 
 | 30 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | static void __init sni_display_setup(void) | 
 | 32 | { | 
| Thomas Bogendoerfer | 4a0312f | 2006-06-13 13:59:01 +0200 | [diff] [blame] | 33 | #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_ARC) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | 	struct screen_info *si = &screen_info; | 
 | 35 | 	DISPLAY_STATUS *di; | 
 | 36 |  | 
 | 37 | 	di = ArcGetDisplayStatus(1); | 
 | 38 |  | 
 | 39 | 	if (di) { | 
 | 40 | 		si->orig_x		= di->CursorXPosition; | 
 | 41 | 		si->orig_y		= di->CursorYPosition; | 
 | 42 | 		si->orig_video_cols	= di->CursorMaxXPosition; | 
 | 43 | 		si->orig_video_lines	= di->CursorMaxYPosition; | 
 | 44 | 		si->orig_video_isVGA	= VIDEO_TYPE_VGAC; | 
 | 45 | 		si->orig_video_points	= 16; | 
 | 46 | 	} | 
 | 47 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | } | 
 | 49 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 |  | 
| Ralf Baechle | 2925aba | 2006-06-18 01:32:22 +0100 | [diff] [blame] | 51 | void __init plat_mem_setup(void) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | 	set_io_port_base(SNI_PORT_BASE); | 
| Thomas Bogendoerfer | c066a32 | 2006-12-28 18:22:32 +0100 | [diff] [blame] | 54 | //	ioport_resource.end = sni_io_resource.end; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 |  | 
 | 56 | 	/* | 
 | 57 | 	 * Setup (E)ISA I/O memory access stuff | 
 | 58 | 	 */ | 
 | 59 | 	isa_slot_offset = 0xb0000000; | 
 | 60 | #ifdef CONFIG_EISA | 
 | 61 | 	EISA_bus = 1; | 
 | 62 | #endif | 
 | 63 |  | 
| Thomas Bogendoerfer | c066a32 | 2006-12-28 18:22:32 +0100 | [diff] [blame] | 64 | 	switch (sni_brd_type) { | 
 | 65 | 	case SNI_BRD_10: | 
 | 66 | 	case SNI_BRD_10NEW: | 
 | 67 | 	case SNI_BRD_TOWER_OASIC: | 
 | 68 | 	case SNI_BRD_MINITOWER: | 
 | 69 | 	        sni_a20r_init(); | 
 | 70 | 	        break; | 
 | 71 |  | 
 | 72 | 	case SNI_BRD_PCI_TOWER: | 
 | 73 | 	case SNI_BRD_PCI_TOWER_CPLUS: | 
 | 74 | 	        sni_pcit_init(); | 
 | 75 | 		break; | 
 | 76 |  | 
 | 77 | 	case SNI_BRD_RM200: | 
 | 78 | 	        sni_rm200_init(); | 
 | 79 | 	        break; | 
 | 80 |  | 
 | 81 | 	case SNI_BRD_PCI_MTOWER: | 
 | 82 | 	case SNI_BRD_PCI_DESKTOP: | 
 | 83 | 	case SNI_BRD_PCI_MTOWER_CPLUS: | 
 | 84 | 	        sni_pcimt_init(); | 
 | 85 | 	        break; | 
 | 86 | 	} | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 |  | 
 | 88 | 	_machine_restart = sni_machine_restart; | 
| Ralf Baechle | fcdb27a | 2006-01-18 17:37:07 +0000 | [diff] [blame] | 89 | 	pm_power_off = sni_machine_power_off; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 |  | 
 | 91 | 	sni_display_setup(); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | } | 
| Thomas Bogendoerfer | 22df5bc | 2007-05-17 14:53:12 +0200 | [diff] [blame] | 93 |  | 
 | 94 | #if CONFIG_PCI | 
 | 95 |  | 
 | 96 | #include <linux/pci.h> | 
 | 97 | #include <video/vga.h> | 
 | 98 | #include <video/cirrus.h> | 
 | 99 |  | 
 | 100 | static void __devinit quirk_cirrus_ram_size(struct pci_dev *dev) | 
 | 101 | { | 
 | 102 | 	u16 cmd; | 
 | 103 |  | 
 | 104 | 	/* | 
 | 105 | 	 * firmware doesn't set the ram size correct, so we | 
 | 106 | 	 * need to do it here, otherwise we get screen corruption | 
 | 107 | 	 * on older Cirrus chips | 
 | 108 | 	 */ | 
| Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame] | 109 | 	pci_read_config_word(dev, PCI_COMMAND, &cmd); | 
| Thomas Bogendoerfer | 22df5bc | 2007-05-17 14:53:12 +0200 | [diff] [blame] | 110 | 	if ((cmd & (PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) | 
 | 111 | 	        == (PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) { | 
| Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame] | 112 | 		vga_wseq(NULL, CL_SEQR6, 0x12);	/* unlock all extension registers */ | 
 | 113 | 		vga_wseq(NULL, CL_SEQRF, 0x18); | 
| Thomas Bogendoerfer | 22df5bc | 2007-05-17 14:53:12 +0200 | [diff] [blame] | 114 | 	} | 
 | 115 | } | 
 | 116 |  | 
 | 117 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5434_8, | 
 | 118 |                         quirk_cirrus_ram_size); | 
 | 119 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5436, | 
 | 120 |                         quirk_cirrus_ram_size); | 
 | 121 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446, | 
 | 122 |                         quirk_cirrus_ram_size); | 
 | 123 | #endif |