1 /* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * SNI specific PCI support for RM200/RM300. 7 * 8 * Copyright (C) 1997 - 2000, 2003, 04 Ralf Baechle (ralf@linux-mips.org) 9 */ 10 #include <linux/kernel.h> 11 #include <linux/init.h> 12 #include <linux/pci.h> 13 14 #include <asm/mipsregs.h> 15 #include <asm/sni.h> 16 17 /* 18 * Shortcuts ... 19 */ 20 #define SCSI PCIMT_IRQ_SCSI 21 #define ETH PCIMT_IRQ_ETHERNET 22 #define INTA PCIMT_IRQ_INTA 23 #define INTB PCIMT_IRQ_INTB 24 #define INTC PCIMT_IRQ_INTC 25 #define INTD PCIMT_IRQ_INTD 26 27 /* 28 * Device 0: PCI EISA Bridge (directly routed) 29 * Device 1: NCR53c810 SCSI (directly routed) 30 * Device 2: PCnet32 Ethernet (directly routed) 31 * Device 3: VGA (routed to INTB) 32 * Device 4: Unused 33 * Device 5: Slot 2 34 * Device 6: Slot 3 35 * Device 7: Slot 4 36 * 37 * Documentation says the VGA is device 5 and device 3 is unused but that 38 * seem to be a documentation error. At least on my RM200C the Cirrus 39 * Logic CL-GD5434 VGA is device 3. 40 */ 41 static char irq_tab_rm200[8][5] __initdata = { 42 /* INTA INTB INTC INTD */ 43 { 0, 0, 0, 0, 0 }, /* EISA bridge */ 44 { SCSI, SCSI, SCSI, SCSI, SCSI }, /* SCSI */ 45 { ETH, ETH, ETH, ETH, ETH }, /* Ethernet */ 46 { INTB, INTB, INTB, INTB, INTB }, /* VGA */ 47 { 0, 0, 0, 0, 0 }, /* Unused */ 48 { 0, INTB, INTC, INTD, INTA }, /* Slot 2 */ 49 { 0, INTC, INTD, INTA, INTB }, /* Slot 3 */ 50 { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */ 51 }; 52 53 /* 54 * In Revision D of the RM300 Device 2 has become a normal purpose Slot 1 55 * 56 * The VGA card is optional for RM300 systems. 57 */ 58 static char irq_tab_rm300d[8][5] __initdata = { 59 /* INTA INTB INTC INTD */ 60 { 0, 0, 0, 0, 0 }, /* EISA bridge */ 61 { SCSI, SCSI, SCSI, SCSI, SCSI }, /* SCSI */ 62 { 0, INTC, INTD, INTA, INTB }, /* Slot 1 */ 63 { INTB, INTB, INTB, INTB, INTB }, /* VGA */ 64 { 0, 0, 0, 0, 0 }, /* Unused */ 65 { 0, INTB, INTC, INTD, INTA }, /* Slot 2 */ 66 { 0, INTC, INTD, INTA, INTB }, /* Slot 3 */ 67 { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */ 68 }; 69 70 static inline int is_rm300_revd(void) 71 { 72 unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR; 73 74 return (csmsr & 0xa0) == 0x20; 75 } 76 77 int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 78 { 79 if (is_rm300_revd()) 80 return irq_tab_rm300d[slot][pin]; 81 82 return irq_tab_rm200[slot][pin]; 83 } 84 85 /* Do platform specific device initialization at pci_enable_device() time */ 86 int pcibios_plat_dev_init(struct pci_dev *dev) 87 { 88 return 0; 89 } 90