Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Setup pointers to hardware-dependent routines.
0003  *
0004  * This file is subject to the terms and conditions of the GNU General Public
0005  * License.  See the file "COPYING" in the main directory of this archive
0006  * for more details.
0007  *
0008  * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org)
0009  * Copyright (C) 2006,2007 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
0010  */
0011 #include <linux/eisa.h>
0012 #include <linux/init.h>
0013 #include <linux/export.h>
0014 #include <linux/console.h>
0015 #include <linux/fb.h>
0016 #include <linux/screen_info.h>
0017 
0018 #ifdef CONFIG_FW_ARC
0019 #include <asm/fw/arc/types.h>
0020 #include <asm/sgialib.h>
0021 #endif
0022 
0023 #ifdef CONFIG_FW_SNIPROM
0024 #include <asm/mipsprom.h>
0025 #endif
0026 
0027 #include <asm/bootinfo.h>
0028 #include <asm/cpu.h>
0029 #include <asm/io.h>
0030 #include <asm/reboot.h>
0031 #include <asm/sni.h>
0032 
0033 unsigned int sni_brd_type;
0034 EXPORT_SYMBOL(sni_brd_type);
0035 
0036 extern void sni_machine_restart(char *command);
0037 extern void sni_machine_power_off(void);
0038 
0039 static void __init sni_display_setup(void)
0040 {
0041 #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC)
0042     struct screen_info *si = &screen_info;
0043     DISPLAY_STATUS *di;
0044 
0045     di = ArcGetDisplayStatus(1);
0046 
0047     if (di) {
0048         si->orig_x      = di->CursorXPosition;
0049         si->orig_y      = di->CursorYPosition;
0050         si->orig_video_cols = di->CursorMaxXPosition;
0051         si->orig_video_lines    = di->CursorMaxYPosition;
0052         si->orig_video_isVGA    = VIDEO_TYPE_VGAC;
0053         si->orig_video_points   = 16;
0054     }
0055 #endif
0056 }
0057 
0058 static void __init sni_console_setup(void)
0059 {
0060 #ifndef CONFIG_FW_ARC
0061     char *ctype;
0062     char *cdev;
0063     char *baud;
0064     int port;
0065     static char options[8] __initdata;
0066 
0067     cdev = prom_getenv("console_dev");
0068     if (strncmp(cdev, "tty", 3) == 0) {
0069         ctype = prom_getenv("console");
0070         switch (*ctype) {
0071         default:
0072         case 'l':
0073             port = 0;
0074             baud = prom_getenv("lbaud");
0075             break;
0076         case 'r':
0077             port = 1;
0078             baud = prom_getenv("rbaud");
0079             break;
0080         }
0081         if (baud)
0082             strcpy(options, baud);
0083         if (strncmp(cdev, "tty552", 6) == 0)
0084             add_preferred_console("ttyS", port,
0085                           baud ? options : NULL);
0086         else
0087             add_preferred_console("ttySC", port,
0088                           baud ? options : NULL);
0089     }
0090 #endif
0091 }
0092 
0093 #ifdef DEBUG
0094 static void __init sni_idprom_dump(void)
0095 {
0096     int i;
0097 
0098     pr_debug("SNI IDProm dump:\n");
0099     for (i = 0; i < 256; i++) {
0100         if (i%16 == 0)
0101             pr_debug("%04x ", i);
0102 
0103         printk("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i));
0104 
0105         if (i % 16 == 15)
0106             printk("\n");
0107     }
0108 }
0109 #endif
0110 
0111 void __init plat_mem_setup(void)
0112 {
0113     int cputype;
0114 
0115     set_io_port_base(SNI_PORT_BASE);
0116 //  ioport_resource.end = sni_io_resource.end;
0117 
0118     /*
0119      * Setup (E)ISA I/O memory access stuff
0120      */
0121 #ifdef CONFIG_EISA
0122     EISA_bus = 1;
0123 #endif
0124 
0125     sni_brd_type = *(unsigned char *)SNI_IDPROM_BRDTYPE;
0126     cputype = *(unsigned char *)SNI_IDPROM_CPUTYPE;
0127     switch (sni_brd_type) {
0128     case SNI_BRD_TOWER_OASIC:
0129         switch (cputype) {
0130         case SNI_CPU_M8030:
0131             system_type = "RM400-330";
0132             break;
0133         case SNI_CPU_M8031:
0134             system_type = "RM400-430";
0135             break;
0136         case SNI_CPU_M8037:
0137             system_type = "RM400-530";
0138             break;
0139         case SNI_CPU_M8034:
0140             system_type = "RM400-730";
0141             break;
0142         default:
0143             system_type = "RM400-xxx";
0144             break;
0145         }
0146         break;
0147     case SNI_BRD_MINITOWER:
0148         switch (cputype) {
0149         case SNI_CPU_M8021:
0150         case SNI_CPU_M8043:
0151             system_type = "RM400-120";
0152             break;
0153         case SNI_CPU_M8040:
0154             system_type = "RM400-220";
0155             break;
0156         case SNI_CPU_M8053:
0157             system_type = "RM400-225";
0158             break;
0159         case SNI_CPU_M8050:
0160             system_type = "RM400-420";
0161             break;
0162         default:
0163             system_type = "RM400-xxx";
0164             break;
0165         }
0166         break;
0167     case SNI_BRD_PCI_TOWER:
0168         system_type = "RM400-Cxx";
0169         break;
0170     case SNI_BRD_RM200:
0171         system_type = "RM200-xxx";
0172         break;
0173     case SNI_BRD_PCI_MTOWER:
0174         system_type = "RM300-Cxx";
0175         break;
0176     case SNI_BRD_PCI_DESKTOP:
0177         switch (read_c0_prid() & PRID_IMP_MASK) {
0178         case PRID_IMP_R4600:
0179         case PRID_IMP_R4700:
0180             system_type = "RM200-C20";
0181             break;
0182         case PRID_IMP_R5000:
0183             system_type = "RM200-C40";
0184             break;
0185         default:
0186             system_type = "RM200-Cxx";
0187             break;
0188         }
0189         break;
0190     case SNI_BRD_PCI_TOWER_CPLUS:
0191         system_type = "RM400-Exx";
0192         break;
0193     case SNI_BRD_PCI_MTOWER_CPLUS:
0194         system_type = "RM300-Exx";
0195         break;
0196     }
0197     pr_debug("Found SNI brdtype %02x name %s\n", sni_brd_type, system_type);
0198 
0199 #ifdef DEBUG
0200     sni_idprom_dump();
0201 #endif
0202 
0203     switch (sni_brd_type) {
0204     case SNI_BRD_10:
0205     case SNI_BRD_10NEW:
0206     case SNI_BRD_TOWER_OASIC:
0207     case SNI_BRD_MINITOWER:
0208         sni_a20r_init();
0209         break;
0210 
0211     case SNI_BRD_PCI_TOWER:
0212     case SNI_BRD_PCI_TOWER_CPLUS:
0213         sni_pcit_init();
0214         break;
0215 
0216     case SNI_BRD_RM200:
0217         sni_rm200_init();
0218         break;
0219 
0220     case SNI_BRD_PCI_MTOWER:
0221     case SNI_BRD_PCI_DESKTOP:
0222     case SNI_BRD_PCI_MTOWER_CPLUS:
0223         sni_pcimt_init();
0224         break;
0225     }
0226 
0227     _machine_restart = sni_machine_restart;
0228     pm_power_off = sni_machine_power_off;
0229 
0230     sni_display_setup();
0231     sni_console_setup();
0232 }
0233 
0234 #ifdef CONFIG_PCI
0235 
0236 #include <linux/pci.h>
0237 #include <video/vga.h>
0238 #include <video/cirrus.h>
0239 
0240 static void quirk_cirrus_ram_size(struct pci_dev *dev)
0241 {
0242     u16 cmd;
0243 
0244     /*
0245      * firmware doesn't set the ram size correct, so we
0246      * need to do it here, otherwise we get screen corruption
0247      * on older Cirrus chips
0248      */
0249     pci_read_config_word(dev, PCI_COMMAND, &cmd);
0250     if ((cmd & (PCI_COMMAND_IO|PCI_COMMAND_MEMORY))
0251         == (PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) {
0252         vga_wseq(NULL, CL_SEQR6, 0x12); /* unlock all extension registers */
0253         vga_wseq(NULL, CL_SEQRF, 0x18);
0254     }
0255 }
0256 
0257 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5434_8,
0258             quirk_cirrus_ram_size);
0259 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5436,
0260             quirk_cirrus_ram_size);
0261 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446,
0262             quirk_cirrus_ram_size);
0263 #endif