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
6 * SNI specific PCI support for RM200/RM300.
8 * Copyright (C) 1997 - 2000, 2003, 04 Ralf Baechle (ralf@linux-mips.org)
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/pci.h>
14 #include <asm/mipsregs.h>
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
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)
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.
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 */
54 * In Revision D of the RM300 Device 2 has become a normal purpose Slot 1
56 * The VGA card is optional for RM300 systems.
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 */
70 static char irq_tab_rm300e[5][5] __initdata = {
71 /* INTA INTB INTC INTD */
72 { 0, 0, 0, 0, 0 }, /* HOST bridge */
73 { SCSI, SCSI, SCSI, SCSI, SCSI }, /* SCSI */
74 { 0, INTC, INTD, INTA, INTB }, /* Bridge/i960 */
75 { 0, INTD, INTA, INTB, INTC }, /* Slot 1 */
76 { 0, INTA, INTB, INTC, INTD }, /* Slot 2 */
89 #define SCSI0 PCIT_IRQ_SCSI0
90 #define SCSI1 PCIT_IRQ_SCSI1
91 #define ETH PCIT_IRQ_ETHERNET
92 #define INTA PCIT_IRQ_INTA
93 #define INTB PCIT_IRQ_INTB
94 #define INTC PCIT_IRQ_INTC
95 #define INTD PCIT_IRQ_INTD
97 static char irq_tab_pcit[13][5] __initdata = {
98 /* INTA INTB INTC INTD */
99 { 0, 0, 0, 0, 0 }, /* HOST bridge */
100 { SCSI0, SCSI0, SCSI0, SCSI0, SCSI0 }, /* SCSI */
101 { SCSI1, SCSI1, SCSI1, SCSI1, SCSI1 }, /* SCSI */
102 { ETH, ETH, ETH, ETH, ETH }, /* Ethernet */
103 { 0, INTA, INTB, INTC, INTD }, /* PCI-PCI bridge */
104 { 0, 0, 0, 0, 0 }, /* Unused */
105 { 0, 0, 0, 0, 0 }, /* Unused */
106 { 0, 0, 0, 0, 0 }, /* Unused */
107 { 0, INTA, INTB, INTC, INTD }, /* Slot 1 */
108 { 0, INTB, INTC, INTD, INTA }, /* Slot 2 */
109 { 0, INTC, INTD, INTA, INTB }, /* Slot 3 */
110 { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */
111 { 0, INTA, INTB, INTC, INTD }, /* Slot 5 */
114 static inline int is_rm300_revd(void)
116 unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
118 return (csmsr & 0xa0) == 0x20;
121 int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
123 switch (sni_brd_type) {
124 case SNI_BRD_PCI_TOWER:
125 case SNI_BRD_PCI_TOWER_CPLUS:
126 return irq_tab_pcit[slot][pin];
128 case SNI_BRD_PCI_MTOWER:
130 return irq_tab_rm300d[slot][pin];
133 case SNI_BRD_PCI_DESKTOP:
134 return irq_tab_rm200[slot][pin];
136 case SNI_BRD_PCI_MTOWER_CPLUS:
137 return irq_tab_rm300e[slot][pin];
143 /* Do platform specific device initialization at pci_enable_device() time */
144 int pcibios_plat_dev_init(struct pci_dev *dev)