Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Ralf Baechle | 3a1d821 | 2007-03-01 15:35:54 +0000 | [diff] [blame] | 17 | #include <irq.h> |
| 18 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | /* |
Thomas Bogendoerfer | c066a32 | 2006-12-28 18:22:32 +0100 | [diff] [blame] | 20 | * PCIMT Shortcuts ... |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | */ |
| 22 | #define SCSI PCIMT_IRQ_SCSI |
| 23 | #define ETH PCIMT_IRQ_ETHERNET |
| 24 | #define INTA PCIMT_IRQ_INTA |
| 25 | #define INTB PCIMT_IRQ_INTB |
| 26 | #define INTC PCIMT_IRQ_INTC |
| 27 | #define INTD PCIMT_IRQ_INTD |
| 28 | |
| 29 | /* |
| 30 | * Device 0: PCI EISA Bridge (directly routed) |
| 31 | * Device 1: NCR53c810 SCSI (directly routed) |
| 32 | * Device 2: PCnet32 Ethernet (directly routed) |
| 33 | * Device 3: VGA (routed to INTB) |
| 34 | * Device 4: Unused |
| 35 | * Device 5: Slot 2 |
| 36 | * Device 6: Slot 3 |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 37 | * Device 7: Slot 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | * |
| 39 | * Documentation says the VGA is device 5 and device 3 is unused but that |
| 40 | * seem to be a documentation error. At least on my RM200C the Cirrus |
| 41 | * Logic CL-GD5434 VGA is device 3. |
| 42 | */ |
| 43 | static char irq_tab_rm200[8][5] __initdata = { |
| 44 | /* INTA INTB INTC INTD */ |
| 45 | { 0, 0, 0, 0, 0 }, /* EISA bridge */ |
| 46 | { SCSI, SCSI, SCSI, SCSI, SCSI }, /* SCSI */ |
| 47 | { ETH, ETH, ETH, ETH, ETH }, /* Ethernet */ |
| 48 | { INTB, INTB, INTB, INTB, INTB }, /* VGA */ |
| 49 | { 0, 0, 0, 0, 0 }, /* Unused */ |
| 50 | { 0, INTB, INTC, INTD, INTA }, /* Slot 2 */ |
| 51 | { 0, INTC, INTD, INTA, INTB }, /* Slot 3 */ |
| 52 | { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */ |
| 53 | }; |
| 54 | |
| 55 | /* |
| 56 | * In Revision D of the RM300 Device 2 has become a normal purpose Slot 1 |
| 57 | * |
| 58 | * The VGA card is optional for RM300 systems. |
| 59 | */ |
| 60 | static char irq_tab_rm300d[8][5] __initdata = { |
| 61 | /* INTA INTB INTC INTD */ |
| 62 | { 0, 0, 0, 0, 0 }, /* EISA bridge */ |
| 63 | { SCSI, SCSI, SCSI, SCSI, SCSI }, /* SCSI */ |
| 64 | { 0, INTC, INTD, INTA, INTB }, /* Slot 1 */ |
| 65 | { INTB, INTB, INTB, INTB, INTB }, /* VGA */ |
| 66 | { 0, 0, 0, 0, 0 }, /* Unused */ |
| 67 | { 0, INTB, INTC, INTD, INTA }, /* Slot 2 */ |
| 68 | { 0, INTC, INTD, INTA, INTB }, /* Slot 3 */ |
| 69 | { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */ |
| 70 | }; |
| 71 | |
Thomas Bogendoerfer | c066a32 | 2006-12-28 18:22:32 +0100 | [diff] [blame] | 72 | static char irq_tab_rm300e[5][5] __initdata = { |
| 73 | /* INTA INTB INTC INTD */ |
| 74 | { 0, 0, 0, 0, 0 }, /* HOST bridge */ |
| 75 | { SCSI, SCSI, SCSI, SCSI, SCSI }, /* SCSI */ |
| 76 | { 0, INTC, INTD, INTA, INTB }, /* Bridge/i960 */ |
| 77 | { 0, INTD, INTA, INTB, INTC }, /* Slot 1 */ |
| 78 | { 0, INTA, INTB, INTC, INTD }, /* Slot 2 */ |
| 79 | }; |
| 80 | #undef SCSI |
| 81 | #undef ETH |
| 82 | #undef INTA |
| 83 | #undef INTB |
| 84 | #undef INTC |
| 85 | #undef INTD |
| 86 | |
| 87 | |
| 88 | /* |
| 89 | * PCIT Shortcuts ... |
| 90 | */ |
| 91 | #define SCSI0 PCIT_IRQ_SCSI0 |
| 92 | #define SCSI1 PCIT_IRQ_SCSI1 |
| 93 | #define ETH PCIT_IRQ_ETHERNET |
| 94 | #define INTA PCIT_IRQ_INTA |
| 95 | #define INTB PCIT_IRQ_INTB |
| 96 | #define INTC PCIT_IRQ_INTC |
| 97 | #define INTD PCIT_IRQ_INTD |
| 98 | |
| 99 | static char irq_tab_pcit[13][5] __initdata = { |
| 100 | /* INTA INTB INTC INTD */ |
| 101 | { 0, 0, 0, 0, 0 }, /* HOST bridge */ |
| 102 | { SCSI0, SCSI0, SCSI0, SCSI0, SCSI0 }, /* SCSI */ |
| 103 | { SCSI1, SCSI1, SCSI1, SCSI1, SCSI1 }, /* SCSI */ |
| 104 | { ETH, ETH, ETH, ETH, ETH }, /* Ethernet */ |
| 105 | { 0, INTA, INTB, INTC, INTD }, /* PCI-PCI bridge */ |
| 106 | { 0, 0, 0, 0, 0 }, /* Unused */ |
| 107 | { 0, 0, 0, 0, 0 }, /* Unused */ |
| 108 | { 0, 0, 0, 0, 0 }, /* Unused */ |
| 109 | { 0, INTA, INTB, INTC, INTD }, /* Slot 1 */ |
| 110 | { 0, INTB, INTC, INTD, INTA }, /* Slot 2 */ |
| 111 | { 0, INTC, INTD, INTA, INTB }, /* Slot 3 */ |
| 112 | { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */ |
| 113 | { 0, INTA, INTB, INTC, INTD }, /* Slot 5 */ |
| 114 | }; |
| 115 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | static inline int is_rm300_revd(void) |
| 117 | { |
| 118 | unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR; |
| 119 | |
| 120 | return (csmsr & 0xa0) == 0x20; |
| 121 | } |
| 122 | |
| 123 | int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
| 124 | { |
Thomas Bogendoerfer | c066a32 | 2006-12-28 18:22:32 +0100 | [diff] [blame] | 125 | switch (sni_brd_type) { |
| 126 | case SNI_BRD_PCI_TOWER: |
| 127 | case SNI_BRD_PCI_TOWER_CPLUS: |
| 128 | return irq_tab_pcit[slot][pin]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | |
Thomas Bogendoerfer | c066a32 | 2006-12-28 18:22:32 +0100 | [diff] [blame] | 130 | case SNI_BRD_PCI_MTOWER: |
| 131 | if (is_rm300_revd()) |
| 132 | return irq_tab_rm300d[slot][pin]; |
| 133 | /* fall through */ |
| 134 | |
| 135 | case SNI_BRD_PCI_DESKTOP: |
| 136 | return irq_tab_rm200[slot][pin]; |
| 137 | |
| 138 | case SNI_BRD_PCI_MTOWER_CPLUS: |
| 139 | return irq_tab_rm300e[slot][pin]; |
| 140 | } |
| 141 | |
| 142 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | /* Do platform specific device initialization at pci_enable_device() time */ |
| 146 | int pcibios_plat_dev_init(struct pci_dev *dev) |
| 147 | { |
| 148 | return 0; |
| 149 | } |