aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/pci
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>2006-12-28 12:22:32 -0500
committerRalf Baechle <ralf@linux-mips.org>2007-02-18 16:31:37 -0500
commitc066a32a890c50ce59e91f8cea8eb5fd8d5821b9 (patch)
treed129af235d11d44c649f0743bc38535c3a229e41 /arch/mips/pci
parent5759906ca9e5201c3fd40d61c861ec1e441d3a24 (diff)
[MIPS] Support for several more SNI RM models.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/pci')
-rw-r--r--arch/mips/pci/fixup-sni.c66
-rw-r--r--arch/mips/pci/ops-sni.c77
2 files changed, 138 insertions, 5 deletions
diff --git a/arch/mips/pci/fixup-sni.c b/arch/mips/pci/fixup-sni.c
index a176f2ca8656..0c9a4732d455 100644
--- a/arch/mips/pci/fixup-sni.c
+++ b/arch/mips/pci/fixup-sni.c
@@ -15,7 +15,7 @@
15#include <asm/sni.h> 15#include <asm/sni.h>
16 16
17/* 17/*
18 * Shortcuts ... 18 * PCIMT Shortcuts ...
19 */ 19 */
20#define SCSI PCIMT_IRQ_SCSI 20#define SCSI PCIMT_IRQ_SCSI
21#define ETH PCIMT_IRQ_ETHERNET 21#define ETH PCIMT_IRQ_ETHERNET
@@ -67,6 +67,50 @@ static char irq_tab_rm300d[8][5] __initdata = {
67 { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */ 67 { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */
68}; 68};
69 69
70static 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 */
77};
78#undef SCSI
79#undef ETH
80#undef INTA
81#undef INTB
82#undef INTC
83#undef INTD
84
85
86/*
87 * PCIT Shortcuts ...
88 */
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
96
97static 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 */
112};
113
70static inline int is_rm300_revd(void) 114static inline int is_rm300_revd(void)
71{ 115{
72 unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR; 116 unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
@@ -76,10 +120,24 @@ static inline int is_rm300_revd(void)
76 120
77int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 121int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
78{ 122{
79 if (is_rm300_revd()) 123 switch (sni_brd_type) {
80 return irq_tab_rm300d[slot][pin]; 124 case SNI_BRD_PCI_TOWER:
125 case SNI_BRD_PCI_TOWER_CPLUS:
126 return irq_tab_pcit[slot][pin];
127
128 case SNI_BRD_PCI_MTOWER:
129 if (is_rm300_revd())
130 return irq_tab_rm300d[slot][pin];
131 /* fall through */
81 132
82 return irq_tab_rm200[slot][pin]; 133 case SNI_BRD_PCI_DESKTOP:
134 return irq_tab_rm200[slot][pin];
135
136 case SNI_BRD_PCI_MTOWER_CPLUS:
137 return irq_tab_rm300e[slot][pin];
138 }
139
140 return 0;
83} 141}
84 142
85/* Do platform specific device initialization at pci_enable_device() time */ 143/* Do platform specific device initialization at pci_enable_device() time */
diff --git a/arch/mips/pci/ops-sni.c b/arch/mips/pci/ops-sni.c
index 2b0ccd6d9dcd..fa2d2c60f797 100644
--- a/arch/mips/pci/ops-sni.c
+++ b/arch/mips/pci/ops-sni.c
@@ -83,7 +83,82 @@ static int pcimt_write(struct pci_bus *bus, unsigned int devfn, int reg,
83 return 0; 83 return 0;
84} 84}
85 85
86struct pci_ops sni_pci_ops = { 86struct pci_ops sni_pcimt_ops = {
87 .read = pcimt_read, 87 .read = pcimt_read,
88 .write = pcimt_write, 88 .write = pcimt_write,
89}; 89};
90
91static int pcit_set_config_address(unsigned int busno, unsigned int devfn, int reg)
92{
93 if ((devfn > 255) || (reg > 255) || (busno > 255))
94 return PCIBIOS_BAD_REGISTER_NUMBER;
95
96 outl ((1 << 31) | ((busno & 0xff) << 16) | ((devfn & 0xff) << 8) | (reg & 0xfc), 0xcf8);
97 return PCIBIOS_SUCCESSFUL;
98}
99
100static int pcit_read(struct pci_bus *bus, unsigned int devfn, int reg,
101 int size, u32 * val)
102{
103 int res;
104
105 /*
106 * on bus 0 we need to check, whether there is a device answering
107 * for the devfn by doing a config write and checking the result. If
108 * we don't do it, we will get a data bus error
109 */
110 if (bus->number == 0) {
111 pcit_set_config_address (0, 0, 0x68);
112 outl (inl (0xcfc) | 0xc0000000, 0xcfc);
113 if ((res = pcit_set_config_address(0, devfn, 0)))
114 return res;
115 outl (0xffffffff, 0xcfc);
116 pcit_set_config_address (0, 0, 0x68);
117 if (inl(0xcfc) & 0x100000)
118 return PCIBIOS_DEVICE_NOT_FOUND;
119 }
120 if ((res = pcit_set_config_address(bus->number, devfn, reg)))
121 return res;
122
123 switch (size) {
124 case 1:
125 *val = inb(PCIMT_CONFIG_DATA + (reg & 3));
126 break;
127 case 2:
128 *val = inw(PCIMT_CONFIG_DATA + (reg & 2));
129 break;
130 case 4:
131 *val = inl(PCIMT_CONFIG_DATA);
132 break;
133 }
134 return 0;
135}
136
137static int pcit_write(struct pci_bus *bus, unsigned int devfn, int reg,
138 int size, u32 val)
139{
140 int res;
141
142 if ((res = pcit_set_config_address(bus->number, devfn, reg)))
143 return res;
144
145 switch (size) {
146 case 1:
147 outb (val, PCIMT_CONFIG_DATA + (reg & 3));
148 break;
149 case 2:
150 outw (val, PCIMT_CONFIG_DATA + (reg & 2));
151 break;
152 case 4:
153 outl (val, PCIMT_CONFIG_DATA);
154 break;
155 }
156
157 return 0;
158}
159
160
161struct pci_ops sni_pcit_ops = {
162 .read = pcit_read,
163 .write = pcit_write,
164};