11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds * Setup pointers to hardware-dependent routines. 31da177e4SLinus Torvalds * 41da177e4SLinus Torvalds * This file is subject to the terms and conditions of the GNU General Public 51da177e4SLinus Torvalds * License. See the file "COPYING" in the main directory of this archive 61da177e4SLinus Torvalds * for more details. 71da177e4SLinus Torvalds * 8fcdb27adSRalf Baechle * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org) 922df5bc5SThomas Bogendoerfer * Copyright (C) 2006,2007 Thomas Bogendoerfer (tsbogend@alpha.franken.de) 101da177e4SLinus Torvalds */ 111da177e4SLinus Torvalds #include <linux/eisa.h> 121da177e4SLinus Torvalds #include <linux/init.h> 131da177e4SLinus Torvalds #include <linux/console.h> 141da177e4SLinus Torvalds #include <linux/fb.h> 15894673eeSJon Smirl #include <linux/screen_info.h> 161da177e4SLinus Torvalds 174a0312fcSThomas Bogendoerfer #ifdef CONFIG_ARC 182f56cfddSAurelien Jarno #include <asm/fw/arc/types.h> 191da177e4SLinus Torvalds #include <asm/sgialib.h> 204a0312fcSThomas Bogendoerfer #endif 214a0312fcSThomas Bogendoerfer 22*231a35d3SThomas Bogendoerfer #ifdef CONFIG_SNIPROM 23*231a35d3SThomas Bogendoerfer #include <asm/mipsprom.h> 24*231a35d3SThomas Bogendoerfer #endif 25*231a35d3SThomas Bogendoerfer 26*231a35d3SThomas Bogendoerfer #include <asm/bootinfo.h> 271da177e4SLinus Torvalds #include <asm/io.h> 281da177e4SLinus Torvalds #include <asm/reboot.h> 291da177e4SLinus Torvalds #include <asm/sni.h> 30c066a32aSThomas Bogendoerfer 31c066a32aSThomas Bogendoerfer unsigned int sni_brd_type; 32*231a35d3SThomas Bogendoerfer EXPORT_SYMBOL(sni_brd_type); 331da177e4SLinus Torvalds 341da177e4SLinus Torvalds extern void sni_machine_restart(char *command); 351da177e4SLinus Torvalds extern void sni_machine_power_off(void); 361da177e4SLinus Torvalds 371da177e4SLinus Torvalds static void __init sni_display_setup(void) 381da177e4SLinus Torvalds { 394a0312fcSThomas Bogendoerfer #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_ARC) 401da177e4SLinus Torvalds struct screen_info *si = &screen_info; 411da177e4SLinus Torvalds DISPLAY_STATUS *di; 421da177e4SLinus Torvalds 431da177e4SLinus Torvalds di = ArcGetDisplayStatus(1); 441da177e4SLinus Torvalds 451da177e4SLinus Torvalds if (di) { 461da177e4SLinus Torvalds si->orig_x = di->CursorXPosition; 471da177e4SLinus Torvalds si->orig_y = di->CursorYPosition; 481da177e4SLinus Torvalds si->orig_video_cols = di->CursorMaxXPosition; 491da177e4SLinus Torvalds si->orig_video_lines = di->CursorMaxYPosition; 501da177e4SLinus Torvalds si->orig_video_isVGA = VIDEO_TYPE_VGAC; 511da177e4SLinus Torvalds si->orig_video_points = 16; 521da177e4SLinus Torvalds } 531da177e4SLinus Torvalds #endif 541da177e4SLinus Torvalds } 551da177e4SLinus Torvalds 56*231a35d3SThomas Bogendoerfer static void __init sni_console_setup(void) 57*231a35d3SThomas Bogendoerfer { 58*231a35d3SThomas Bogendoerfer #ifndef CONFIG_ARC 59*231a35d3SThomas Bogendoerfer char *ctype; 60*231a35d3SThomas Bogendoerfer char *cdev; 61*231a35d3SThomas Bogendoerfer char *baud; 62*231a35d3SThomas Bogendoerfer int port; 63*231a35d3SThomas Bogendoerfer static char options[8]; 64*231a35d3SThomas Bogendoerfer 65*231a35d3SThomas Bogendoerfer cdev = prom_getenv("console_dev"); 66*231a35d3SThomas Bogendoerfer if (strncmp(cdev, "tty", 3) == 0) { 67*231a35d3SThomas Bogendoerfer ctype = prom_getenv("console"); 68*231a35d3SThomas Bogendoerfer switch (*ctype) { 69*231a35d3SThomas Bogendoerfer default: 70*231a35d3SThomas Bogendoerfer case 'l': 71*231a35d3SThomas Bogendoerfer port = 0; 72*231a35d3SThomas Bogendoerfer baud = prom_getenv("lbaud"); 73*231a35d3SThomas Bogendoerfer break; 74*231a35d3SThomas Bogendoerfer case 'r': 75*231a35d3SThomas Bogendoerfer port = 1; 76*231a35d3SThomas Bogendoerfer baud = prom_getenv("rbaud"); 77*231a35d3SThomas Bogendoerfer break; 78*231a35d3SThomas Bogendoerfer } 79*231a35d3SThomas Bogendoerfer if (baud) 80*231a35d3SThomas Bogendoerfer strcpy(options, baud); 81*231a35d3SThomas Bogendoerfer if (strncmp(cdev, "tty552", 6) == 0) 82*231a35d3SThomas Bogendoerfer add_preferred_console("ttyS", port, 83*231a35d3SThomas Bogendoerfer baud ? options : NULL); 84*231a35d3SThomas Bogendoerfer else 85*231a35d3SThomas Bogendoerfer add_preferred_console("ttySC", port, 86*231a35d3SThomas Bogendoerfer baud ? options : NULL); 87*231a35d3SThomas Bogendoerfer } 88*231a35d3SThomas Bogendoerfer #endif 89*231a35d3SThomas Bogendoerfer } 90*231a35d3SThomas Bogendoerfer 91*231a35d3SThomas Bogendoerfer #ifdef DEBUG 92*231a35d3SThomas Bogendoerfer static void __init sni_idprom_dump(void) 93*231a35d3SThomas Bogendoerfer { 94*231a35d3SThomas Bogendoerfer int i; 95*231a35d3SThomas Bogendoerfer 96*231a35d3SThomas Bogendoerfer pr_debug("SNI IDProm dump:\n"); 97*231a35d3SThomas Bogendoerfer for (i = 0; i < 256; i++) { 98*231a35d3SThomas Bogendoerfer if (i%16 == 0) 99*231a35d3SThomas Bogendoerfer pr_debug("%04x ", i); 100*231a35d3SThomas Bogendoerfer 101*231a35d3SThomas Bogendoerfer printk("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i)); 102*231a35d3SThomas Bogendoerfer 103*231a35d3SThomas Bogendoerfer if (i % 16 == 15) 104*231a35d3SThomas Bogendoerfer printk("\n"); 105*231a35d3SThomas Bogendoerfer } 106*231a35d3SThomas Bogendoerfer } 107*231a35d3SThomas Bogendoerfer #endif 1081da177e4SLinus Torvalds 1092925aba4SRalf Baechle void __init plat_mem_setup(void) 1101da177e4SLinus Torvalds { 111*231a35d3SThomas Bogendoerfer int cputype; 112*231a35d3SThomas Bogendoerfer 1131da177e4SLinus Torvalds set_io_port_base(SNI_PORT_BASE); 114c066a32aSThomas Bogendoerfer // ioport_resource.end = sni_io_resource.end; 1151da177e4SLinus Torvalds 1161da177e4SLinus Torvalds /* 1171da177e4SLinus Torvalds * Setup (E)ISA I/O memory access stuff 1181da177e4SLinus Torvalds */ 119*231a35d3SThomas Bogendoerfer isa_slot_offset = CKSEG1ADDR(0xb0000000); 1201da177e4SLinus Torvalds #ifdef CONFIG_EISA 1211da177e4SLinus Torvalds EISA_bus = 1; 1221da177e4SLinus Torvalds #endif 1231da177e4SLinus Torvalds 124*231a35d3SThomas Bogendoerfer sni_brd_type = *(unsigned char *)SNI_IDPROM_BRDTYPE; 125*231a35d3SThomas Bogendoerfer cputype = *(unsigned char *)SNI_IDPROM_CPUTYPE; 126*231a35d3SThomas Bogendoerfer switch (sni_brd_type) { 127*231a35d3SThomas Bogendoerfer case SNI_BRD_TOWER_OASIC: 128*231a35d3SThomas Bogendoerfer switch (cputype) { 129*231a35d3SThomas Bogendoerfer case SNI_CPU_M8030: 130*231a35d3SThomas Bogendoerfer system_type = "RM400-330"; 131*231a35d3SThomas Bogendoerfer break; 132*231a35d3SThomas Bogendoerfer case SNI_CPU_M8031: 133*231a35d3SThomas Bogendoerfer system_type = "RM400-430"; 134*231a35d3SThomas Bogendoerfer break; 135*231a35d3SThomas Bogendoerfer case SNI_CPU_M8037: 136*231a35d3SThomas Bogendoerfer system_type = "RM400-530"; 137*231a35d3SThomas Bogendoerfer break; 138*231a35d3SThomas Bogendoerfer case SNI_CPU_M8034: 139*231a35d3SThomas Bogendoerfer system_type = "RM400-730"; 140*231a35d3SThomas Bogendoerfer break; 141*231a35d3SThomas Bogendoerfer default: 142*231a35d3SThomas Bogendoerfer system_type = "RM400-xxx"; 143*231a35d3SThomas Bogendoerfer break; 144*231a35d3SThomas Bogendoerfer } 145*231a35d3SThomas Bogendoerfer break; 146*231a35d3SThomas Bogendoerfer case SNI_BRD_MINITOWER: 147*231a35d3SThomas Bogendoerfer switch (cputype) { 148*231a35d3SThomas Bogendoerfer case SNI_CPU_M8021: 149*231a35d3SThomas Bogendoerfer case SNI_CPU_M8043: 150*231a35d3SThomas Bogendoerfer system_type = "RM400-120"; 151*231a35d3SThomas Bogendoerfer break; 152*231a35d3SThomas Bogendoerfer case SNI_CPU_M8040: 153*231a35d3SThomas Bogendoerfer system_type = "RM400-220"; 154*231a35d3SThomas Bogendoerfer break; 155*231a35d3SThomas Bogendoerfer case SNI_CPU_M8053: 156*231a35d3SThomas Bogendoerfer system_type = "RM400-225"; 157*231a35d3SThomas Bogendoerfer break; 158*231a35d3SThomas Bogendoerfer case SNI_CPU_M8050: 159*231a35d3SThomas Bogendoerfer system_type = "RM400-420"; 160*231a35d3SThomas Bogendoerfer break; 161*231a35d3SThomas Bogendoerfer default: 162*231a35d3SThomas Bogendoerfer system_type = "RM400-xxx"; 163*231a35d3SThomas Bogendoerfer break; 164*231a35d3SThomas Bogendoerfer } 165*231a35d3SThomas Bogendoerfer break; 166*231a35d3SThomas Bogendoerfer case SNI_BRD_PCI_TOWER: 167*231a35d3SThomas Bogendoerfer system_type = "RM400-Cxx"; 168*231a35d3SThomas Bogendoerfer break; 169*231a35d3SThomas Bogendoerfer case SNI_BRD_RM200: 170*231a35d3SThomas Bogendoerfer system_type = "RM200-xxx"; 171*231a35d3SThomas Bogendoerfer break; 172*231a35d3SThomas Bogendoerfer case SNI_BRD_PCI_MTOWER: 173*231a35d3SThomas Bogendoerfer system_type = "RM300-Cxx"; 174*231a35d3SThomas Bogendoerfer break; 175*231a35d3SThomas Bogendoerfer case SNI_BRD_PCI_DESKTOP: 176*231a35d3SThomas Bogendoerfer switch (read_c0_prid() & 0xff00) { 177*231a35d3SThomas Bogendoerfer case PRID_IMP_R4600: 178*231a35d3SThomas Bogendoerfer case PRID_IMP_R4700: 179*231a35d3SThomas Bogendoerfer system_type = "RM200-C20"; 180*231a35d3SThomas Bogendoerfer break; 181*231a35d3SThomas Bogendoerfer case PRID_IMP_R5000: 182*231a35d3SThomas Bogendoerfer system_type = "RM200-C40"; 183*231a35d3SThomas Bogendoerfer break; 184*231a35d3SThomas Bogendoerfer default: 185*231a35d3SThomas Bogendoerfer system_type = "RM200-Cxx"; 186*231a35d3SThomas Bogendoerfer break; 187*231a35d3SThomas Bogendoerfer } 188*231a35d3SThomas Bogendoerfer break; 189*231a35d3SThomas Bogendoerfer case SNI_BRD_PCI_TOWER_CPLUS: 190*231a35d3SThomas Bogendoerfer system_type = "RM400-Exx"; 191*231a35d3SThomas Bogendoerfer break; 192*231a35d3SThomas Bogendoerfer case SNI_BRD_PCI_MTOWER_CPLUS: 193*231a35d3SThomas Bogendoerfer system_type = "RM300-Exx"; 194*231a35d3SThomas Bogendoerfer break; 195*231a35d3SThomas Bogendoerfer } 196*231a35d3SThomas Bogendoerfer pr_debug("Found SNI brdtype %02x name %s\n", sni_brd_type, system_type); 197*231a35d3SThomas Bogendoerfer 198*231a35d3SThomas Bogendoerfer #ifdef DEBUG 199*231a35d3SThomas Bogendoerfer sni_idprom_dump(); 200*231a35d3SThomas Bogendoerfer #endif 201*231a35d3SThomas Bogendoerfer 202c066a32aSThomas Bogendoerfer switch (sni_brd_type) { 203c066a32aSThomas Bogendoerfer case SNI_BRD_10: 204c066a32aSThomas Bogendoerfer case SNI_BRD_10NEW: 205c066a32aSThomas Bogendoerfer case SNI_BRD_TOWER_OASIC: 206c066a32aSThomas Bogendoerfer case SNI_BRD_MINITOWER: 207c066a32aSThomas Bogendoerfer sni_a20r_init(); 208c066a32aSThomas Bogendoerfer break; 209c066a32aSThomas Bogendoerfer 210c066a32aSThomas Bogendoerfer case SNI_BRD_PCI_TOWER: 211c066a32aSThomas Bogendoerfer case SNI_BRD_PCI_TOWER_CPLUS: 212c066a32aSThomas Bogendoerfer sni_pcit_init(); 213c066a32aSThomas Bogendoerfer break; 214c066a32aSThomas Bogendoerfer 215c066a32aSThomas Bogendoerfer case SNI_BRD_RM200: 216c066a32aSThomas Bogendoerfer sni_rm200_init(); 217c066a32aSThomas Bogendoerfer break; 218c066a32aSThomas Bogendoerfer 219c066a32aSThomas Bogendoerfer case SNI_BRD_PCI_MTOWER: 220c066a32aSThomas Bogendoerfer case SNI_BRD_PCI_DESKTOP: 221c066a32aSThomas Bogendoerfer case SNI_BRD_PCI_MTOWER_CPLUS: 222c066a32aSThomas Bogendoerfer sni_pcimt_init(); 223c066a32aSThomas Bogendoerfer break; 224c066a32aSThomas Bogendoerfer } 2251da177e4SLinus Torvalds 2261da177e4SLinus Torvalds _machine_restart = sni_machine_restart; 227fcdb27adSRalf Baechle pm_power_off = sni_machine_power_off; 2281da177e4SLinus Torvalds 2291da177e4SLinus Torvalds sni_display_setup(); 230*231a35d3SThomas Bogendoerfer sni_console_setup(); 2311da177e4SLinus Torvalds } 23222df5bc5SThomas Bogendoerfer 233*231a35d3SThomas Bogendoerfer #ifdef CONFIG_PCI 23422df5bc5SThomas Bogendoerfer 23522df5bc5SThomas Bogendoerfer #include <linux/pci.h> 23622df5bc5SThomas Bogendoerfer #include <video/vga.h> 23722df5bc5SThomas Bogendoerfer #include <video/cirrus.h> 23822df5bc5SThomas Bogendoerfer 23922df5bc5SThomas Bogendoerfer static void __devinit quirk_cirrus_ram_size(struct pci_dev *dev) 24022df5bc5SThomas Bogendoerfer { 24122df5bc5SThomas Bogendoerfer u16 cmd; 24222df5bc5SThomas Bogendoerfer 24322df5bc5SThomas Bogendoerfer /* 24422df5bc5SThomas Bogendoerfer * firmware doesn't set the ram size correct, so we 24522df5bc5SThomas Bogendoerfer * need to do it here, otherwise we get screen corruption 24622df5bc5SThomas Bogendoerfer * on older Cirrus chips 24722df5bc5SThomas Bogendoerfer */ 24822df5bc5SThomas Bogendoerfer pci_read_config_word(dev, PCI_COMMAND, &cmd); 24922df5bc5SThomas Bogendoerfer if ((cmd & (PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) 25022df5bc5SThomas Bogendoerfer == (PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) { 25122df5bc5SThomas Bogendoerfer vga_wseq(NULL, CL_SEQR6, 0x12); /* unlock all extension registers */ 25222df5bc5SThomas Bogendoerfer vga_wseq(NULL, CL_SEQRF, 0x18); 25322df5bc5SThomas Bogendoerfer } 25422df5bc5SThomas Bogendoerfer } 25522df5bc5SThomas Bogendoerfer 25622df5bc5SThomas Bogendoerfer DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5434_8, 25722df5bc5SThomas Bogendoerfer quirk_cirrus_ram_size); 25822df5bc5SThomas Bogendoerfer DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5436, 25922df5bc5SThomas Bogendoerfer quirk_cirrus_ram_size); 26022df5bc5SThomas Bogendoerfer DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446, 26122df5bc5SThomas Bogendoerfer quirk_cirrus_ram_size); 26222df5bc5SThomas Bogendoerfer #endif 263