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 | |
Thomas Bogendoerfer | 231a35d | 2008-01-04 23:31:07 +0100 | [diff] [blame] | 22 | #ifdef CONFIG_SNIPROM |
| 23 | #include <asm/mipsprom.h> |
| 24 | #endif |
| 25 | |
| 26 | #include <asm/bootinfo.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | #include <asm/io.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | #include <asm/reboot.h> |
| 29 | #include <asm/sni.h> |
Thomas Bogendoerfer | c066a32 | 2006-12-28 18:22:32 +0100 | [diff] [blame] | 30 | |
| 31 | unsigned int sni_brd_type; |
Thomas Bogendoerfer | 231a35d | 2008-01-04 23:31:07 +0100 | [diff] [blame] | 32 | EXPORT_SYMBOL(sni_brd_type); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
| 34 | extern void sni_machine_restart(char *command); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | extern void sni_machine_power_off(void); |
| 36 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | static void __init sni_display_setup(void) |
| 38 | { |
Thomas Bogendoerfer | 4a0312f | 2006-06-13 13:59:01 +0200 | [diff] [blame] | 39 | #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_ARC) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | struct screen_info *si = &screen_info; |
| 41 | DISPLAY_STATUS *di; |
| 42 | |
| 43 | di = ArcGetDisplayStatus(1); |
| 44 | |
| 45 | if (di) { |
| 46 | si->orig_x = di->CursorXPosition; |
| 47 | si->orig_y = di->CursorYPosition; |
| 48 | si->orig_video_cols = di->CursorMaxXPosition; |
| 49 | si->orig_video_lines = di->CursorMaxYPosition; |
| 50 | si->orig_video_isVGA = VIDEO_TYPE_VGAC; |
| 51 | si->orig_video_points = 16; |
| 52 | } |
| 53 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | } |
| 55 | |
Thomas Bogendoerfer | 231a35d | 2008-01-04 23:31:07 +0100 | [diff] [blame] | 56 | static void __init sni_console_setup(void) |
| 57 | { |
| 58 | #ifndef CONFIG_ARC |
| 59 | char *ctype; |
| 60 | char *cdev; |
| 61 | char *baud; |
| 62 | int port; |
| 63 | static char options[8]; |
| 64 | |
| 65 | cdev = prom_getenv("console_dev"); |
| 66 | if (strncmp(cdev, "tty", 3) == 0) { |
| 67 | ctype = prom_getenv("console"); |
| 68 | switch (*ctype) { |
| 69 | default: |
| 70 | case 'l': |
| 71 | port = 0; |
| 72 | baud = prom_getenv("lbaud"); |
| 73 | break; |
| 74 | case 'r': |
| 75 | port = 1; |
| 76 | baud = prom_getenv("rbaud"); |
| 77 | break; |
| 78 | } |
| 79 | if (baud) |
| 80 | strcpy(options, baud); |
| 81 | if (strncmp(cdev, "tty552", 6) == 0) |
| 82 | add_preferred_console("ttyS", port, |
| 83 | baud ? options : NULL); |
| 84 | else |
| 85 | add_preferred_console("ttySC", port, |
| 86 | baud ? options : NULL); |
| 87 | } |
| 88 | #endif |
| 89 | } |
| 90 | |
| 91 | #ifdef DEBUG |
| 92 | static void __init sni_idprom_dump(void) |
| 93 | { |
| 94 | int i; |
| 95 | |
| 96 | pr_debug("SNI IDProm dump:\n"); |
| 97 | for (i = 0; i < 256; i++) { |
| 98 | if (i%16 == 0) |
| 99 | pr_debug("%04x ", i); |
| 100 | |
| 101 | printk("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i)); |
| 102 | |
| 103 | if (i % 16 == 15) |
| 104 | printk("\n"); |
| 105 | } |
| 106 | } |
| 107 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | |
Ralf Baechle | 2925aba | 2006-06-18 01:32:22 +0100 | [diff] [blame] | 109 | void __init plat_mem_setup(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | { |
Thomas Bogendoerfer | 231a35d | 2008-01-04 23:31:07 +0100 | [diff] [blame] | 111 | int cputype; |
| 112 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | set_io_port_base(SNI_PORT_BASE); |
Thomas Bogendoerfer | c066a32 | 2006-12-28 18:22:32 +0100 | [diff] [blame] | 114 | // ioport_resource.end = sni_io_resource.end; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
| 116 | /* |
| 117 | * Setup (E)ISA I/O memory access stuff |
| 118 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | #ifdef CONFIG_EISA |
| 120 | EISA_bus = 1; |
| 121 | #endif |
| 122 | |
Thomas Bogendoerfer | 231a35d | 2008-01-04 23:31:07 +0100 | [diff] [blame] | 123 | sni_brd_type = *(unsigned char *)SNI_IDPROM_BRDTYPE; |
| 124 | cputype = *(unsigned char *)SNI_IDPROM_CPUTYPE; |
| 125 | switch (sni_brd_type) { |
| 126 | case SNI_BRD_TOWER_OASIC: |
| 127 | switch (cputype) { |
| 128 | case SNI_CPU_M8030: |
| 129 | system_type = "RM400-330"; |
| 130 | break; |
| 131 | case SNI_CPU_M8031: |
| 132 | system_type = "RM400-430"; |
| 133 | break; |
| 134 | case SNI_CPU_M8037: |
| 135 | system_type = "RM400-530"; |
| 136 | break; |
| 137 | case SNI_CPU_M8034: |
| 138 | system_type = "RM400-730"; |
| 139 | break; |
| 140 | default: |
| 141 | system_type = "RM400-xxx"; |
| 142 | break; |
| 143 | } |
| 144 | break; |
| 145 | case SNI_BRD_MINITOWER: |
| 146 | switch (cputype) { |
| 147 | case SNI_CPU_M8021: |
| 148 | case SNI_CPU_M8043: |
| 149 | system_type = "RM400-120"; |
| 150 | break; |
| 151 | case SNI_CPU_M8040: |
| 152 | system_type = "RM400-220"; |
| 153 | break; |
| 154 | case SNI_CPU_M8053: |
| 155 | system_type = "RM400-225"; |
| 156 | break; |
| 157 | case SNI_CPU_M8050: |
| 158 | system_type = "RM400-420"; |
| 159 | break; |
| 160 | default: |
| 161 | system_type = "RM400-xxx"; |
| 162 | break; |
| 163 | } |
| 164 | break; |
| 165 | case SNI_BRD_PCI_TOWER: |
| 166 | system_type = "RM400-Cxx"; |
| 167 | break; |
| 168 | case SNI_BRD_RM200: |
| 169 | system_type = "RM200-xxx"; |
| 170 | break; |
| 171 | case SNI_BRD_PCI_MTOWER: |
| 172 | system_type = "RM300-Cxx"; |
| 173 | break; |
| 174 | case SNI_BRD_PCI_DESKTOP: |
| 175 | switch (read_c0_prid() & 0xff00) { |
| 176 | case PRID_IMP_R4600: |
| 177 | case PRID_IMP_R4700: |
| 178 | system_type = "RM200-C20"; |
| 179 | break; |
| 180 | case PRID_IMP_R5000: |
| 181 | system_type = "RM200-C40"; |
| 182 | break; |
| 183 | default: |
| 184 | system_type = "RM200-Cxx"; |
| 185 | break; |
| 186 | } |
| 187 | break; |
| 188 | case SNI_BRD_PCI_TOWER_CPLUS: |
| 189 | system_type = "RM400-Exx"; |
| 190 | break; |
| 191 | case SNI_BRD_PCI_MTOWER_CPLUS: |
| 192 | system_type = "RM300-Exx"; |
| 193 | break; |
| 194 | } |
| 195 | pr_debug("Found SNI brdtype %02x name %s\n", sni_brd_type, system_type); |
| 196 | |
| 197 | #ifdef DEBUG |
| 198 | sni_idprom_dump(); |
| 199 | #endif |
| 200 | |
Thomas Bogendoerfer | c066a32 | 2006-12-28 18:22:32 +0100 | [diff] [blame] | 201 | switch (sni_brd_type) { |
| 202 | case SNI_BRD_10: |
| 203 | case SNI_BRD_10NEW: |
| 204 | case SNI_BRD_TOWER_OASIC: |
| 205 | case SNI_BRD_MINITOWER: |
| 206 | sni_a20r_init(); |
| 207 | break; |
| 208 | |
| 209 | case SNI_BRD_PCI_TOWER: |
| 210 | case SNI_BRD_PCI_TOWER_CPLUS: |
| 211 | sni_pcit_init(); |
| 212 | break; |
| 213 | |
| 214 | case SNI_BRD_RM200: |
| 215 | sni_rm200_init(); |
| 216 | break; |
| 217 | |
| 218 | case SNI_BRD_PCI_MTOWER: |
| 219 | case SNI_BRD_PCI_DESKTOP: |
| 220 | case SNI_BRD_PCI_MTOWER_CPLUS: |
| 221 | sni_pcimt_init(); |
| 222 | break; |
| 223 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | |
| 225 | _machine_restart = sni_machine_restart; |
Ralf Baechle | fcdb27a | 2006-01-18 17:37:07 +0000 | [diff] [blame] | 226 | pm_power_off = sni_machine_power_off; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | |
| 228 | sni_display_setup(); |
Thomas Bogendoerfer | 231a35d | 2008-01-04 23:31:07 +0100 | [diff] [blame] | 229 | sni_console_setup(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | } |
Thomas Bogendoerfer | 22df5bc | 2007-05-17 14:53:12 +0200 | [diff] [blame] | 231 | |
Thomas Bogendoerfer | 231a35d | 2008-01-04 23:31:07 +0100 | [diff] [blame] | 232 | #ifdef CONFIG_PCI |
Thomas Bogendoerfer | 22df5bc | 2007-05-17 14:53:12 +0200 | [diff] [blame] | 233 | |
| 234 | #include <linux/pci.h> |
| 235 | #include <video/vga.h> |
| 236 | #include <video/cirrus.h> |
| 237 | |
| 238 | static void __devinit quirk_cirrus_ram_size(struct pci_dev *dev) |
| 239 | { |
| 240 | u16 cmd; |
| 241 | |
| 242 | /* |
| 243 | * firmware doesn't set the ram size correct, so we |
| 244 | * need to do it here, otherwise we get screen corruption |
| 245 | * on older Cirrus chips |
| 246 | */ |
Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame] | 247 | pci_read_config_word(dev, PCI_COMMAND, &cmd); |
Thomas Bogendoerfer | 22df5bc | 2007-05-17 14:53:12 +0200 | [diff] [blame] | 248 | if ((cmd & (PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) |
| 249 | == (PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) { |
Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame] | 250 | vga_wseq(NULL, CL_SEQR6, 0x12); /* unlock all extension registers */ |
| 251 | vga_wseq(NULL, CL_SEQRF, 0x18); |
Thomas Bogendoerfer | 22df5bc | 2007-05-17 14:53:12 +0200 | [diff] [blame] | 252 | } |
| 253 | } |
| 254 | |
| 255 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5434_8, |
| 256 | quirk_cirrus_ram_size); |
| 257 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5436, |
| 258 | quirk_cirrus_ram_size); |
| 259 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446, |
| 260 | quirk_cirrus_ram_size); |
| 261 | #endif |