diff options
Diffstat (limited to 'arch/mips/pci')
-rw-r--r-- | arch/mips/pci/Makefile | 13 | ||||
-rw-r--r-- | arch/mips/pci/fixup-atlas.c | 91 | ||||
-rw-r--r-- | arch/mips/pci/fixup-jmr3927.c | 35 | ||||
-rw-r--r-- | arch/mips/pci/fixup-rbtx4927.c | 119 | ||||
-rw-r--r-- | arch/mips/pci/fixup-rbtx4938.c | 53 | ||||
-rw-r--r-- | arch/mips/pci/fixup-tx4938.c | 92 | ||||
-rw-r--r-- | arch/mips/pci/fixup-vr4133.c | 195 | ||||
-rw-r--r-- | arch/mips/pci/ops-mace.c | 7 | ||||
-rw-r--r-- | arch/mips/pci/ops-tx3927.c | 87 | ||||
-rw-r--r-- | arch/mips/pci/ops-tx4927.c | 517 | ||||
-rw-r--r-- | arch/mips/pci/ops-tx4938.c | 214 | ||||
-rw-r--r-- | arch/mips/pci/pci-bcm1480.c | 3 | ||||
-rw-r--r-- | arch/mips/pci/pci-ip27.c | 1 | ||||
-rw-r--r-- | arch/mips/pci/pci-jmr3927.c | 58 | ||||
-rw-r--r-- | arch/mips/pci/pci-lasat.c | 14 | ||||
-rw-r--r-- | arch/mips/pci/pci-sb1250.c | 4 | ||||
-rw-r--r-- | arch/mips/pci/pci-tx4927.c | 83 | ||||
-rw-r--r-- | arch/mips/pci/pci-tx4938.c | 134 | ||||
-rw-r--r-- | arch/mips/pci/pci.c | 3 |
19 files changed, 764 insertions, 959 deletions
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile index ed0c07622baa..57e34cafa497 100644 --- a/arch/mips/pci/Makefile +++ b/arch/mips/pci/Makefile | |||
@@ -11,17 +11,16 @@ obj-$(CONFIG_MIPS_BONITO64) += ops-bonito64.o | |||
11 | obj-$(CONFIG_PCI_GT64XXX_PCI0) += ops-gt64xxx_pci0.o | 11 | obj-$(CONFIG_PCI_GT64XXX_PCI0) += ops-gt64xxx_pci0.o |
12 | obj-$(CONFIG_MIPS_MSC) += ops-msc.o | 12 | obj-$(CONFIG_MIPS_MSC) += ops-msc.o |
13 | obj-$(CONFIG_MIPS_NILE4) += ops-nile4.o | 13 | obj-$(CONFIG_MIPS_NILE4) += ops-nile4.o |
14 | obj-$(CONFIG_MIPS_TX3927) += ops-tx3927.o | 14 | obj-$(CONFIG_SOC_TX3927) += ops-tx3927.o |
15 | obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o | 15 | obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o |
16 | obj-$(CONFIG_NEC_CMBVR4133) += fixup-vr4133.o | ||
17 | obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o | 16 | obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o |
17 | obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o | ||
18 | 18 | ||
19 | # | 19 | # |
20 | # These are still pretty much in the old state, watch, go blind. | 20 | # These are still pretty much in the old state, watch, go blind. |
21 | # | 21 | # |
22 | obj-$(CONFIG_BASLER_EXCITE) += ops-titan.o pci-excite.o fixup-excite.o | 22 | obj-$(CONFIG_BASLER_EXCITE) += ops-titan.o pci-excite.o fixup-excite.o |
23 | obj-$(CONFIG_LASAT) += pci-lasat.o | 23 | obj-$(CONFIG_LASAT) += pci-lasat.o |
24 | obj-$(CONFIG_MIPS_ATLAS) += fixup-atlas.o | ||
25 | obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o | 24 | obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o |
26 | obj-$(CONFIG_SOC_AU1500) += fixup-au1000.o ops-au1000.o | 25 | obj-$(CONFIG_SOC_AU1500) += fixup-au1000.o ops-au1000.o |
27 | obj-$(CONFIG_SOC_AU1550) += fixup-au1000.o ops-au1000.o | 26 | obj-$(CONFIG_SOC_AU1550) += fixup-au1000.o ops-au1000.o |
@@ -42,9 +41,11 @@ obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o | |||
42 | obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o | 41 | obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o |
43 | obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o | 42 | obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o |
44 | obj-$(CONFIG_TANBAC_TB0287) += fixup-tb0287.o | 43 | obj-$(CONFIG_TANBAC_TB0287) += fixup-tb0287.o |
45 | obj-$(CONFIG_TOSHIBA_JMR3927) += fixup-jmr3927.o pci-jmr3927.o | 44 | obj-$(CONFIG_TOSHIBA_JMR3927) += fixup-jmr3927.o |
46 | obj-$(CONFIG_TOSHIBA_RBTX4927) += fixup-rbtx4927.o ops-tx4927.o | 45 | obj-$(CONFIG_SOC_TX4927) += pci-tx4927.o |
47 | obj-$(CONFIG_TOSHIBA_RBTX4938) += fixup-tx4938.o ops-tx4938.o | 46 | obj-$(CONFIG_SOC_TX4938) += pci-tx4938.o |
47 | obj-$(CONFIG_TOSHIBA_RBTX4927) += fixup-rbtx4927.o | ||
48 | obj-$(CONFIG_TOSHIBA_RBTX4938) += fixup-rbtx4938.o | ||
48 | obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o | 49 | obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o |
49 | obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o | 50 | obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o |
50 | obj-$(CONFIG_WR_PPMC) += fixup-wrppmc.o | 51 | obj-$(CONFIG_WR_PPMC) += fixup-wrppmc.o |
diff --git a/arch/mips/pci/fixup-atlas.c b/arch/mips/pci/fixup-atlas.c deleted file mode 100644 index 506e883a8c71..000000000000 --- a/arch/mips/pci/fixup-atlas.c +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2003, 2004 Ralf Baechle (ralf@linux-mips.org) | ||
3 | * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. | ||
4 | * Author: Maciej W. Rozycki <macro@mips.com> | ||
5 | * | ||
6 | * This program is free software; you can distribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License (Version 2) as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
13 | * for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
18 | */ | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/pci.h> | ||
21 | |||
22 | #include <asm/mips-boards/atlasint.h> | ||
23 | |||
24 | #define PCIA ATLAS_INT_PCIA | ||
25 | #define PCIB ATLAS_INT_PCIB | ||
26 | #define PCIC ATLAS_INT_PCIC | ||
27 | #define PCID ATLAS_INT_PCID | ||
28 | #define INTA ATLAS_INT_INTA | ||
29 | #define INTB ATLAS_INT_INTB | ||
30 | #define ETH ATLAS_INT_ETH | ||
31 | #define INTC ATLAS_INT_INTC | ||
32 | #define SCSI ATLAS_INT_SCSI | ||
33 | #define INTD ATLAS_INT_INTD | ||
34 | |||
35 | static char irq_tab[][5] __initdata = { | ||
36 | /* INTA INTB INTC INTD */ | ||
37 | {0, 0, 0, 0, 0 }, /* 0: Unused */ | ||
38 | {0, 0, 0, 0, 0 }, /* 1: Unused */ | ||
39 | {0, 0, 0, 0, 0 }, /* 2: Unused */ | ||
40 | {0, 0, 0, 0, 0 }, /* 3: Unused */ | ||
41 | {0, 0, 0, 0, 0 }, /* 4: Unused */ | ||
42 | {0, 0, 0, 0, 0 }, /* 5: Unused */ | ||
43 | {0, 0, 0, 0, 0 }, /* 6: Unused */ | ||
44 | {0, 0, 0, 0, 0 }, /* 7: Unused */ | ||
45 | {0, 0, 0, 0, 0 }, /* 8: Unused */ | ||
46 | {0, 0, 0, 0, 0 }, /* 9: Unused */ | ||
47 | {0, 0, 0, 0, 0 }, /* 10: Unused */ | ||
48 | {0, 0, 0, 0, 0 }, /* 11: Unused */ | ||
49 | {0, 0, 0, 0, 0 }, /* 12: Unused */ | ||
50 | {0, 0, 0, 0, 0 }, /* 13: Unused */ | ||
51 | {0, 0, 0, 0, 0 }, /* 14: Unused */ | ||
52 | {0, PCIA, PCIB, PCIC, PCID }, /* 15: cPCI (behind 21150) */ | ||
53 | {0, SCSI, 0, 0, 0 }, /* 16: SYM53C810A SCSI */ | ||
54 | {0, 0, 0, 0, 0 }, /* 17: Core */ | ||
55 | {0, INTA, INTB, INTC, INTD }, /* 18: PCI Slot */ | ||
56 | {0, ETH, 0, 0, 0 }, /* 19: SAA9730 Eth. et al. */ | ||
57 | {0, 0, 0, 0, 0 }, /* 20: Unused */ | ||
58 | {0, 0, 0, 0, 0 } /* 21: Unused */ | ||
59 | }; | ||
60 | |||
61 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
62 | { | ||
63 | return irq_tab[slot][pin]; | ||
64 | } | ||
65 | |||
66 | /* Do platform specific device initialization at pci_enable_device() time */ | ||
67 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
68 | { | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | #ifdef CONFIG_KGDB | ||
73 | /* | ||
74 | * The PCI scan may have moved the saa9730 I/O address, so reread | ||
75 | * the address here. | ||
76 | * This does mean that it's not possible to debug the PCI bus configuration | ||
77 | * code, but it is better than nothing... | ||
78 | */ | ||
79 | |||
80 | static void atlas_saa9730_base_fixup(struct pci_dev *pdev) | ||
81 | { | ||
82 | extern void *saa9730_base; | ||
83 | if (pdev->bus == 0 && PCI_SLOT(pdev->devfn) == 19) | ||
84 | (void) pci_read_config_dword(pdev, 0x14, (u32 *)&saa9730_base); | ||
85 | printk("saa9730_base = %x\n", saa9730_base); | ||
86 | } | ||
87 | |||
88 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA9730, | ||
89 | atlas_saa9730_base_fixup); | ||
90 | |||
91 | #endif | ||
diff --git a/arch/mips/pci/fixup-jmr3927.c b/arch/mips/pci/fixup-jmr3927.c index e974394be7bc..0f1069527cba 100644 --- a/arch/mips/pci/fixup-jmr3927.c +++ b/arch/mips/pci/fixup-jmr3927.c | |||
@@ -28,36 +28,31 @@ | |||
28 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 28 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
29 | */ | 29 | */ |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/pci.h> | 31 | #include <asm/txx9/pci.h> |
32 | #include <linux/init.h> | 32 | #include <asm/txx9/jmr3927.h> |
33 | 33 | ||
34 | #include <asm/jmr3927/jmr3927.h> | 34 | int __init jmr3927_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
35 | |||
36 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
37 | { | 35 | { |
38 | unsigned char irq = pin; | 36 | unsigned char irq = pin; |
39 | 37 | ||
40 | /* SMSC SLC90E66 IDE uses irq 14, 15 (default) */ | ||
41 | if (dev->vendor == PCI_VENDOR_ID_EFAR && | ||
42 | dev->device == PCI_DEVICE_ID_EFAR_SLC90E66_1) | ||
43 | return irq; | ||
44 | /* IRQ rotation (PICMG) */ | 38 | /* IRQ rotation (PICMG) */ |
45 | irq--; /* 0-3 */ | 39 | irq--; /* 0-3 */ |
46 | if (dev->bus->parent == NULL && | 40 | if (slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(23)) { |
47 | slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(23)) { | ||
48 | /* PCI CardSlot (IDSEL=A23, DevNu=12) */ | 41 | /* PCI CardSlot (IDSEL=A23, DevNu=12) */ |
49 | /* PCIA => PCIC (IDSEL=A23) */ | 42 | /* PCIA => PCIC (IDSEL=A23) */ |
50 | /* NOTE: JMR3927 JP1 must be set to OPEN */ | 43 | /* NOTE: JMR3927 JP1 must be set to OPEN */ |
51 | irq = (irq + 2) % 4; | 44 | irq = (irq + 2) % 4; |
52 | } else if (dev->bus->parent == NULL && | 45 | } else if (slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(22)) { |
53 | slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(22)) { | ||
54 | /* PCI CardSlot (IDSEL=A22, DevNu=11) */ | 46 | /* PCI CardSlot (IDSEL=A22, DevNu=11) */ |
55 | /* PCIA => PCIA (IDSEL=A22) */ | 47 | /* PCIA => PCIA (IDSEL=A22) */ |
56 | /* NOTE: JMR3927 JP1 must be set to OPEN */ | 48 | /* NOTE: JMR3927 JP1 must be set to OPEN */ |
57 | irq = (irq + 0) % 4; | 49 | irq = (irq + 0) % 4; |
58 | } else { | 50 | } else { |
59 | /* PCI Backplane */ | 51 | /* PCI Backplane */ |
60 | irq = (irq + 3 + slot) % 4; | 52 | if (txx9_pci_option & TXX9_PCI_OPT_PICMG) |
53 | irq = (irq + 33 - slot) % 4; | ||
54 | else | ||
55 | irq = (irq + 3 + slot) % 4; | ||
61 | } | 56 | } |
62 | irq++; /* 1-4 */ | 57 | irq++; /* 1-4 */ |
63 | 58 | ||
@@ -66,15 +61,13 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
66 | irq = JMR3927_IRQ_IOC_PCIA; | 61 | irq = JMR3927_IRQ_IOC_PCIA; |
67 | break; | 62 | break; |
68 | case 2: | 63 | case 2: |
69 | // wrong for backplane irq = JMR3927_IRQ_IOC_PCIB; | 64 | irq = JMR3927_IRQ_IOC_PCIB; |
70 | irq = JMR3927_IRQ_IOC_PCID; | ||
71 | break; | 65 | break; |
72 | case 3: | 66 | case 3: |
73 | irq = JMR3927_IRQ_IOC_PCIC; | 67 | irq = JMR3927_IRQ_IOC_PCIC; |
74 | break; | 68 | break; |
75 | case 4: | 69 | case 4: |
76 | // wrong for backplane irq = JMR3927_IRQ_IOC_PCID; | 70 | irq = JMR3927_IRQ_IOC_PCID; |
77 | irq = JMR3927_IRQ_IOC_PCIB; | ||
78 | break; | 71 | break; |
79 | } | 72 | } |
80 | 73 | ||
@@ -84,9 +77,3 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
84 | irq = JMR3927_IRQ_ETHER0; | 77 | irq = JMR3927_IRQ_ETHER0; |
85 | return irq; | 78 | return irq; |
86 | } | 79 | } |
87 | |||
88 | /* Do platform specific device initialization at pci_enable_device() time */ | ||
89 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
90 | { | ||
91 | return 0; | ||
92 | } | ||
diff --git a/arch/mips/pci/fixup-rbtx4927.c b/arch/mips/pci/fixup-rbtx4927.c index 7450c335b387..321db265829c 100644 --- a/arch/mips/pci/fixup-rbtx4927.c +++ b/arch/mips/pci/fixup-rbtx4927.c | |||
@@ -33,108 +33,41 @@ | |||
33 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 33 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
34 | */ | 34 | */ |
35 | #include <linux/types.h> | 35 | #include <linux/types.h> |
36 | #include <linux/pci.h> | 36 | #include <asm/txx9/pci.h> |
37 | #include <linux/kernel.h> | 37 | #include <asm/txx9/rbtx4927.h> |
38 | #include <linux/init.h> | ||
39 | 38 | ||
40 | #include <asm/tx4927/tx4927.h> | 39 | int __init rbtx4927_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
41 | #include <asm/tx4927/tx4927_pci.h> | ||
42 | |||
43 | #undef DEBUG | ||
44 | #ifdef DEBUG | ||
45 | #define DBG(x...) printk(x) | ||
46 | #else | ||
47 | #define DBG(x...) | ||
48 | #endif | ||
49 | |||
50 | /* look up table for backplane pci irq for slots 17-20 by pin # */ | ||
51 | static unsigned char backplane_pci_irq[4][4] = { | ||
52 | /* PJ6 SLOT: 17, PIN: 1 */ {TX4927_IRQ_IOC_PCIA, | ||
53 | /* PJ6 SLOT: 17, PIN: 2 */ | ||
54 | TX4927_IRQ_IOC_PCIB, | ||
55 | /* PJ6 SLOT: 17, PIN: 3 */ | ||
56 | TX4927_IRQ_IOC_PCIC, | ||
57 | /* PJ6 SLOT: 17, PIN: 4 */ | ||
58 | TX4927_IRQ_IOC_PCID}, | ||
59 | /* SB SLOT: 18, PIN: 1 */ {TX4927_IRQ_IOC_PCIB, | ||
60 | /* SB SLOT: 18, PIN: 2 */ | ||
61 | TX4927_IRQ_IOC_PCIC, | ||
62 | /* SB SLOT: 18, PIN: 3 */ | ||
63 | TX4927_IRQ_IOC_PCID, | ||
64 | /* SB SLOT: 18, PIN: 4 */ | ||
65 | TX4927_IRQ_IOC_PCIA}, | ||
66 | /* PJ5 SLOT: 19, PIN: 1 */ {TX4927_IRQ_IOC_PCIC, | ||
67 | /* PJ5 SLOT: 19, PIN: 2 */ | ||
68 | TX4927_IRQ_IOC_PCID, | ||
69 | /* PJ5 SLOT: 19, PIN: 3 */ | ||
70 | TX4927_IRQ_IOC_PCIA, | ||
71 | /* PJ5 SLOT: 19, PIN: 4 */ | ||
72 | TX4927_IRQ_IOC_PCIB}, | ||
73 | /* PJ4 SLOT: 20, PIN: 1 */ {TX4927_IRQ_IOC_PCID, | ||
74 | /* PJ4 SLOT: 20, PIN: 2 */ | ||
75 | TX4927_IRQ_IOC_PCIA, | ||
76 | /* PJ4 SLOT: 20, PIN: 3 */ | ||
77 | TX4927_IRQ_IOC_PCIB, | ||
78 | /* PJ4 SLOT: 20, PIN: 4 */ | ||
79 | TX4927_IRQ_IOC_PCIC} | ||
80 | }; | ||
81 | |||
82 | static int pci_get_irq(const struct pci_dev *dev, int pin) | ||
83 | { | 40 | { |
84 | unsigned char irq = pin; | 41 | unsigned char irq = pin; |
85 | 42 | ||
86 | DBG("pci_get_irq: pin is %d\n", pin); | ||
87 | /* IRQ rotation */ | 43 | /* IRQ rotation */ |
88 | irq--; /* 0-3 */ | 44 | irq--; /* 0-3 */ |
89 | if (dev->bus->parent == NULL && | 45 | if (slot == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) { |
90 | PCI_SLOT(dev->devfn) == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) { | 46 | /* PCI CardSlot (IDSEL=A23) */ |
91 | printk("Onboard PCI_SLOT(dev->devfn) is %d\n", | 47 | /* PCIA => PCIA */ |
92 | PCI_SLOT(dev->devfn)); | 48 | irq = (irq + 0 + slot) % 4; |
93 | /* IDSEL=A23 is tx4927 onboard pci slot */ | ||
94 | irq = (irq + PCI_SLOT(dev->devfn)) % 4; | ||
95 | irq++; /* 1-4 */ | ||
96 | DBG("irq is now %d\n", irq); | ||
97 | |||
98 | switch (irq) { | ||
99 | case 1: | ||
100 | irq = TX4927_IRQ_IOC_PCIA; | ||
101 | break; | ||
102 | case 2: | ||
103 | irq = TX4927_IRQ_IOC_PCIB; | ||
104 | break; | ||
105 | case 3: | ||
106 | irq = TX4927_IRQ_IOC_PCIC; | ||
107 | break; | ||
108 | case 4: | ||
109 | irq = TX4927_IRQ_IOC_PCID; | ||
110 | break; | ||
111 | } | ||
112 | } else { | 49 | } else { |
113 | /* PCI Backplane */ | 50 | /* PCI Backplane */ |
114 | DBG("PCI Backplane PCI_SLOT(dev->devfn) is %d\n", | 51 | if (txx9_pci_option & TXX9_PCI_OPT_PICMG) |
115 | PCI_SLOT(dev->devfn)); | 52 | irq = (irq + 33 - slot) % 4; |
116 | irq = backplane_pci_irq[PCI_SLOT(dev->devfn) - 17][irq]; | 53 | else |
54 | irq = (irq + 3 + slot) % 4; | ||
117 | } | 55 | } |
118 | DBG("assigned irq %d\n", irq); | 56 | irq++; /* 1-4 */ |
119 | return irq; | ||
120 | } | ||
121 | |||
122 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
123 | { | ||
124 | unsigned char irq; | ||
125 | |||
126 | printk("PCI Setup for pin %d \n", pin); | ||
127 | |||
128 | if (dev->device == 0x9130) /* IDE */ | ||
129 | irq = 14; | ||
130 | else | ||
131 | irq = pci_get_irq(dev, pin); | ||
132 | 57 | ||
58 | switch (irq) { | ||
59 | case 1: | ||
60 | irq = RBTX4927_IRQ_IOC_PCIA; | ||
61 | break; | ||
62 | case 2: | ||
63 | irq = RBTX4927_IRQ_IOC_PCIB; | ||
64 | break; | ||
65 | case 3: | ||
66 | irq = RBTX4927_IRQ_IOC_PCIC; | ||
67 | break; | ||
68 | case 4: | ||
69 | irq = RBTX4927_IRQ_IOC_PCID; | ||
70 | break; | ||
71 | } | ||
133 | return irq; | 72 | return irq; |
134 | } | 73 | } |
135 | |||
136 | /* Do platform specific device initialization at pci_enable_device() time */ | ||
137 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
138 | { | ||
139 | return 0; | ||
140 | } | ||
diff --git a/arch/mips/pci/fixup-rbtx4938.c b/arch/mips/pci/fixup-rbtx4938.c new file mode 100644 index 000000000000..a80579af609b --- /dev/null +++ b/arch/mips/pci/fixup-rbtx4938.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * Toshiba rbtx4938 pci routines | ||
3 | * Copyright (C) 2000-2001 Toshiba Corporation | ||
4 | * | ||
5 | * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the | ||
6 | * terms of the GNU General Public License version 2. This program is | ||
7 | * licensed "as is" without any warranty of any kind, whether express | ||
8 | * or implied. | ||
9 | * | ||
10 | * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) | ||
11 | */ | ||
12 | #include <linux/types.h> | ||
13 | #include <asm/txx9/pci.h> | ||
14 | #include <asm/txx9/rbtx4938.h> | ||
15 | |||
16 | int __init rbtx4938_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
17 | { | ||
18 | int irq = tx4938_pcic1_map_irq(dev, slot); | ||
19 | |||
20 | if (irq >= 0) | ||
21 | return irq; | ||
22 | irq = pin; | ||
23 | /* IRQ rotation */ | ||
24 | irq--; /* 0-3 */ | ||
25 | if (slot == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) { | ||
26 | /* PCI CardSlot (IDSEL=A23) */ | ||
27 | /* PCIA => PCIA (IDSEL=A23) */ | ||
28 | irq = (irq + 0 + slot) % 4; | ||
29 | } else { | ||
30 | /* PCI Backplane */ | ||
31 | if (txx9_pci_option & TXX9_PCI_OPT_PICMG) | ||
32 | irq = (irq + 33 - slot) % 4; | ||
33 | else | ||
34 | irq = (irq + 3 + slot) % 4; | ||
35 | } | ||
36 | irq++; /* 1-4 */ | ||
37 | |||
38 | switch (irq) { | ||
39 | case 1: | ||
40 | irq = RBTX4938_IRQ_IOC_PCIA; | ||
41 | break; | ||
42 | case 2: | ||
43 | irq = RBTX4938_IRQ_IOC_PCIB; | ||
44 | break; | ||
45 | case 3: | ||
46 | irq = RBTX4938_IRQ_IOC_PCIC; | ||
47 | break; | ||
48 | case 4: | ||
49 | irq = RBTX4938_IRQ_IOC_PCID; | ||
50 | break; | ||
51 | } | ||
52 | return irq; | ||
53 | } | ||
diff --git a/arch/mips/pci/fixup-tx4938.c b/arch/mips/pci/fixup-tx4938.c deleted file mode 100644 index f2ba06ee0c10..000000000000 --- a/arch/mips/pci/fixup-tx4938.c +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | /* | ||
2 | * Toshiba rbtx4938 pci routines | ||
3 | * Copyright (C) 2000-2001 Toshiba Corporation | ||
4 | * | ||
5 | * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the | ||
6 | * terms of the GNU General Public License version 2. This program is | ||
7 | * licensed "as is" without any warranty of any kind, whether express | ||
8 | * or implied. | ||
9 | * | ||
10 | * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) | ||
11 | */ | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/pci.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/init.h> | ||
16 | |||
17 | #include <asm/tx4938/rbtx4938.h> | ||
18 | |||
19 | extern struct pci_controller tx4938_pci_controller[]; | ||
20 | |||
21 | static int pci_get_irq(const struct pci_dev *dev, int pin) | ||
22 | { | ||
23 | int irq = pin; | ||
24 | u8 slot = PCI_SLOT(dev->devfn); | ||
25 | struct pci_controller *controller = (struct pci_controller *)dev->sysdata; | ||
26 | |||
27 | if (controller == &tx4938_pci_controller[1]) { | ||
28 | /* TX4938 PCIC1 */ | ||
29 | switch (slot) { | ||
30 | case TX4938_PCIC_IDSEL_AD_TO_SLOT(31): | ||
31 | if (tx4938_ccfgptr->pcfg & TX4938_PCFG_ETH0_SEL) | ||
32 | return RBTX4938_IRQ_IRC + TX4938_IR_ETH0; | ||
33 | break; | ||
34 | case TX4938_PCIC_IDSEL_AD_TO_SLOT(30): | ||
35 | if (tx4938_ccfgptr->pcfg & TX4938_PCFG_ETH1_SEL) | ||
36 | return RBTX4938_IRQ_IRC + TX4938_IR_ETH1; | ||
37 | break; | ||
38 | } | ||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | /* IRQ rotation */ | ||
43 | irq--; /* 0-3 */ | ||
44 | if (dev->bus->parent == NULL && | ||
45 | (slot == TX4938_PCIC_IDSEL_AD_TO_SLOT(23))) { | ||
46 | /* PCI CardSlot (IDSEL=A23) */ | ||
47 | /* PCIA => PCIA (IDSEL=A23) */ | ||
48 | irq = (irq + 0 + slot) % 4; | ||
49 | } else { | ||
50 | /* PCI Backplane */ | ||
51 | irq = (irq + 33 - slot) % 4; | ||
52 | } | ||
53 | irq++; /* 1-4 */ | ||
54 | |||
55 | switch (irq) { | ||
56 | case 1: | ||
57 | irq = RBTX4938_IRQ_IOC_PCIA; | ||
58 | break; | ||
59 | case 2: | ||
60 | irq = RBTX4938_IRQ_IOC_PCIB; | ||
61 | break; | ||
62 | case 3: | ||
63 | irq = RBTX4938_IRQ_IOC_PCIC; | ||
64 | break; | ||
65 | case 4: | ||
66 | irq = RBTX4938_IRQ_IOC_PCID; | ||
67 | break; | ||
68 | } | ||
69 | return irq; | ||
70 | } | ||
71 | |||
72 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
73 | { | ||
74 | unsigned char irq = 0; | ||
75 | |||
76 | irq = pci_get_irq(dev, pin); | ||
77 | |||
78 | printk(KERN_INFO "PCI: 0x%02x:0x%02x(0x%02x,0x%02x) IRQ=%d\n", | ||
79 | dev->bus->number, dev->devfn, PCI_SLOT(dev->devfn), | ||
80 | PCI_FUNC(dev->devfn), irq); | ||
81 | |||
82 | return irq; | ||
83 | } | ||
84 | |||
85 | /* | ||
86 | * Do platform specific device initialization at pci_enable_device() time | ||
87 | */ | ||
88 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
89 | { | ||
90 | return 0; | ||
91 | } | ||
92 | |||
diff --git a/arch/mips/pci/fixup-vr4133.c b/arch/mips/pci/fixup-vr4133.c deleted file mode 100644 index de5e5f6bbf4c..000000000000 --- a/arch/mips/pci/fixup-vr4133.c +++ /dev/null | |||
@@ -1,195 +0,0 @@ | |||
1 | /* | ||
2 | * arch/mips/pci/fixup-vr4133.c | ||
3 | * | ||
4 | * The NEC CMB-VR4133 Board specific PCI fixups. | ||
5 | * | ||
6 | * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and | ||
7 | * Alex Sapkov <asapkov@ru.mvista.com> | ||
8 | * | ||
9 | * 2003-2004 (c) MontaVista, Software, Inc. This file is licensed under | ||
10 | * the terms of the GNU General Public License version 2. This program | ||
11 | * is licensed "as is" without any warranty of any kind, whether express | ||
12 | * or implied. | ||
13 | * | ||
14 | * Modified for support in 2.6 | ||
15 | * Author: Manish Lachwani (mlachwani@mvista.com) | ||
16 | * | ||
17 | */ | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/pci.h> | ||
20 | #include <linux/kernel.h> | ||
21 | |||
22 | #include <asm/io.h> | ||
23 | #include <asm/i8259.h> | ||
24 | #include <asm/vr41xx/cmbvr4133.h> | ||
25 | |||
26 | extern int vr4133_rockhopper; | ||
27 | extern void ali_m1535plus_init(struct pci_dev *dev); | ||
28 | extern void ali_m5229_init(struct pci_dev *dev); | ||
29 | |||
30 | /* Do platform specific device initialization at pci_enable_device() time */ | ||
31 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
32 | { | ||
33 | /* | ||
34 | * We have to reset AMD PCnet adapter on Rockhopper since | ||
35 | * PMON leaves it enabled and generating interrupts. This leads | ||
36 | * to a lock if some PCI device driver later enables the IRQ line | ||
37 | * shared with PCnet and there is no AMD PCnet driver to catch its | ||
38 | * interrupts. | ||
39 | */ | ||
40 | #ifdef CONFIG_ROCKHOPPER | ||
41 | if (dev->vendor == PCI_VENDOR_ID_AMD && | ||
42 | dev->device == PCI_DEVICE_ID_AMD_LANCE) { | ||
43 | inl(pci_resource_start(dev, 0) + 0x18); | ||
44 | } | ||
45 | #endif | ||
46 | |||
47 | /* | ||
48 | * we have to open the bridges' windows down to 0 because otherwise | ||
49 | * we cannot access ISA south bridge I/O registers that get mapped from | ||
50 | * 0. for example, 8259 PIC would be unaccessible without that | ||
51 | */ | ||
52 | if(dev->vendor == PCI_VENDOR_ID_INTEL && dev->device == PCI_DEVICE_ID_INTEL_S21152BB) { | ||
53 | pci_write_config_byte(dev, PCI_IO_BASE, 0); | ||
54 | if(dev->bus->number == 0) { | ||
55 | pci_write_config_word(dev, PCI_IO_BASE_UPPER16, 0); | ||
56 | } else { | ||
57 | pci_write_config_word(dev, PCI_IO_BASE_UPPER16, 1); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | /* | ||
65 | * M1535 IRQ mapping | ||
66 | * Feel free to change this, although it shouldn't be needed | ||
67 | */ | ||
68 | #define M1535_IRQ_INTA 7 | ||
69 | #define M1535_IRQ_INTB 9 | ||
70 | #define M1535_IRQ_INTC 10 | ||
71 | #define M1535_IRQ_INTD 11 | ||
72 | |||
73 | #define M1535_IRQ_USB 9 | ||
74 | #define M1535_IRQ_IDE 14 | ||
75 | #define M1535_IRQ_IDE2 15 | ||
76 | #define M1535_IRQ_PS2 12 | ||
77 | #define M1535_IRQ_RTC 8 | ||
78 | #define M1535_IRQ_FDC 6 | ||
79 | #define M1535_IRQ_AUDIO 5 | ||
80 | #define M1535_IRQ_COM1 4 | ||
81 | #define M1535_IRQ_COM2 4 | ||
82 | #define M1535_IRQ_IRDA 3 | ||
83 | #define M1535_IRQ_KBD 1 | ||
84 | #define M1535_IRQ_TMR 0 | ||
85 | |||
86 | /* Rockhopper "slots" assignment; this is hard-coded ... */ | ||
87 | #define ROCKHOPPER_M5451_SLOT 1 | ||
88 | #define ROCKHOPPER_M1535_SLOT 2 | ||
89 | #define ROCKHOPPER_M5229_SLOT 11 | ||
90 | #define ROCKHOPPER_M5237_SLOT 15 | ||
91 | #define ROCKHOPPER_PMU_SLOT 12 | ||
92 | /* ... and hard-wired. */ | ||
93 | #define ROCKHOPPER_PCI1_SLOT 3 | ||
94 | #define ROCKHOPPER_PCI2_SLOT 4 | ||
95 | #define ROCKHOPPER_PCI3_SLOT 5 | ||
96 | #define ROCKHOPPER_PCI4_SLOT 6 | ||
97 | #define ROCKHOPPER_PCNET_SLOT 1 | ||
98 | |||
99 | #define M1535_IRQ_MASK(n) (1 << (n)) | ||
100 | |||
101 | #define M1535_IRQ_EDGE (M1535_IRQ_MASK(M1535_IRQ_TMR) | \ | ||
102 | M1535_IRQ_MASK(M1535_IRQ_KBD) | \ | ||
103 | M1535_IRQ_MASK(M1535_IRQ_COM1) | \ | ||
104 | M1535_IRQ_MASK(M1535_IRQ_COM2) | \ | ||
105 | M1535_IRQ_MASK(M1535_IRQ_IRDA) | \ | ||
106 | M1535_IRQ_MASK(M1535_IRQ_RTC) | \ | ||
107 | M1535_IRQ_MASK(M1535_IRQ_FDC) | \ | ||
108 | M1535_IRQ_MASK(M1535_IRQ_PS2)) | ||
109 | |||
110 | #define M1535_IRQ_LEVEL (M1535_IRQ_MASK(M1535_IRQ_IDE) | \ | ||
111 | M1535_IRQ_MASK(M1535_IRQ_USB) | \ | ||
112 | M1535_IRQ_MASK(M1535_IRQ_INTA) | \ | ||
113 | M1535_IRQ_MASK(M1535_IRQ_INTB) | \ | ||
114 | M1535_IRQ_MASK(M1535_IRQ_INTC) | \ | ||
115 | M1535_IRQ_MASK(M1535_IRQ_INTD)) | ||
116 | |||
117 | struct irq_map_entry { | ||
118 | u16 bus; | ||
119 | u8 slot; | ||
120 | u8 irq; | ||
121 | }; | ||
122 | static struct irq_map_entry int_map[] = { | ||
123 | {1, ROCKHOPPER_M5451_SLOT, M1535_IRQ_AUDIO}, /* Audio controller */ | ||
124 | {1, ROCKHOPPER_PCI1_SLOT, M1535_IRQ_INTD}, /* PCI slot #1 */ | ||
125 | {1, ROCKHOPPER_PCI2_SLOT, M1535_IRQ_INTC}, /* PCI slot #2 */ | ||
126 | {1, ROCKHOPPER_M5237_SLOT, M1535_IRQ_USB}, /* USB host controller */ | ||
127 | {1, ROCKHOPPER_M5229_SLOT, IDE_PRIMARY_IRQ}, /* IDE controller */ | ||
128 | {2, ROCKHOPPER_PCNET_SLOT, M1535_IRQ_INTD}, /* AMD Am79c973 on-board | ||
129 | ethernet */ | ||
130 | {2, ROCKHOPPER_PCI3_SLOT, M1535_IRQ_INTB}, /* PCI slot #3 */ | ||
131 | {2, ROCKHOPPER_PCI4_SLOT, M1535_IRQ_INTC} /* PCI slot #4 */ | ||
132 | }; | ||
133 | |||
134 | static int pci_intlines[] = | ||
135 | { M1535_IRQ_INTA, M1535_IRQ_INTB, M1535_IRQ_INTC, M1535_IRQ_INTD }; | ||
136 | |||
137 | /* Determine the Rockhopper IRQ line number for the PCI device */ | ||
138 | int rockhopper_get_irq(struct pci_dev *dev, u8 pin, u8 slot) | ||
139 | { | ||
140 | struct pci_bus *bus; | ||
141 | int i; | ||
142 | |||
143 | bus = dev->bus; | ||
144 | if (bus == NULL) | ||
145 | return -1; | ||
146 | |||
147 | for (i = 0; i < ARRAY_SIZE(int_map); i++) { | ||
148 | if (int_map[i].bus == bus->number && int_map[i].slot == slot) { | ||
149 | int line; | ||
150 | for (line = 0; line < 4; line++) | ||
151 | if (pci_intlines[line] == int_map[i].irq) | ||
152 | break; | ||
153 | if (line < 4) | ||
154 | return pci_intlines[(line + (pin - 1)) % 4]; | ||
155 | else | ||
156 | return int_map[i].irq; | ||
157 | } | ||
158 | } | ||
159 | return -1; | ||
160 | } | ||
161 | |||
162 | #ifdef CONFIG_ROCKHOPPER | ||
163 | void i8259_init(void) | ||
164 | { | ||
165 | init_i8259_irqs(); | ||
166 | |||
167 | outb(0x00, 0x4d0); | ||
168 | outb(0x02, 0x4d1); /* USB IRQ9 is level */ | ||
169 | } | ||
170 | #endif | ||
171 | |||
172 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
173 | { | ||
174 | extern int pci_probe_only; | ||
175 | pci_probe_only = 1; | ||
176 | |||
177 | #ifdef CONFIG_ROCKHOPPER | ||
178 | if( dev->bus->number == 1 && vr4133_rockhopper ) { | ||
179 | if(slot == ROCKHOPPER_PCI1_SLOT || slot == ROCKHOPPER_PCI2_SLOT) | ||
180 | dev->irq = CMBVR41XX_INTA_IRQ; | ||
181 | else | ||
182 | dev->irq = rockhopper_get_irq(dev, pin, slot); | ||
183 | } else | ||
184 | dev->irq = CMBVR41XX_INTA_IRQ; | ||
185 | #else | ||
186 | dev->irq = CMBVR41XX_INTA_IRQ; | ||
187 | #endif | ||
188 | |||
189 | return dev->irq; | ||
190 | } | ||
191 | |||
192 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, ali_m1535plus_init); | ||
193 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5229, ali_m5229_init); | ||
194 | |||
195 | |||
diff --git a/arch/mips/pci/ops-mace.c b/arch/mips/pci/ops-mace.c index e95881897ec9..1cfb5588699f 100644 --- a/arch/mips/pci/ops-mace.c +++ b/arch/mips/pci/ops-mace.c | |||
@@ -61,6 +61,13 @@ mace_pci_read_config(struct pci_bus *bus, unsigned int devfn, | |||
61 | /* ack possible master abort */ | 61 | /* ack possible master abort */ |
62 | mace->pci.error &= ~MACEPCI_ERROR_MASTER_ABORT; | 62 | mace->pci.error &= ~MACEPCI_ERROR_MASTER_ABORT; |
63 | mace->pci.control = control; | 63 | mace->pci.control = control; |
64 | /* | ||
65 | * someone forgot to set the ultra bit for the onboard | ||
66 | * scsi chips; we fake it here | ||
67 | */ | ||
68 | if (bus->number == 0 && reg == 0x40 && size == 4 && | ||
69 | (devfn == (1 << 3) || devfn == (2 << 3))) | ||
70 | *val |= 0x1000; | ||
64 | 71 | ||
65 | DPRINTK("read%d: reg=%08x,val=%02x\n", size * 8, reg, *val); | 72 | DPRINTK("read%d: reg=%08x,val=%02x\n", size * 8, reg, *val); |
66 | 73 | ||
diff --git a/arch/mips/pci/ops-tx3927.c b/arch/mips/pci/ops-tx3927.c index aa698bd0d5e3..8a17a39e5bf2 100644 --- a/arch/mips/pci/ops-tx3927.c +++ b/arch/mips/pci/ops-tx3927.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * | 8 | * |
9 | * Based on arch/mips/ddb5xxx/ddb5477/pci_ops.c | 9 | * Based on arch/mips/ddb5xxx/ddb5477/pci_ops.c |
10 | * | 10 | * |
11 | * Define the pci_ops for JMR3927. | 11 | * Define the pci_ops for TX3927. |
12 | * | 12 | * |
13 | * Much of the code is derived from the original DDB5074 port by | 13 | * Much of the code is derived from the original DDB5074 port by |
14 | * Geert Uytterhoeven <geert@sonycom.com> | 14 | * Geert Uytterhoeven <geert@sonycom.com> |
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
40 | 40 | ||
41 | #include <asm/addrspace.h> | 41 | #include <asm/addrspace.h> |
42 | #include <asm/jmr3927/jmr3927.h> | 42 | #include <asm/txx9/tx3927.h> |
43 | 43 | ||
44 | static inline int mkaddr(unsigned char bus, unsigned char dev_fn, | 44 | static inline int mkaddr(unsigned char bus, unsigned char dev_fn, |
45 | unsigned char where) | 45 | unsigned char where) |
@@ -68,7 +68,7 @@ static inline int check_abort(void) | |||
68 | return PCIBIOS_SUCCESSFUL; | 68 | return PCIBIOS_SUCCESSFUL; |
69 | } | 69 | } |
70 | 70 | ||
71 | static int jmr3927_pci_read_config(struct pci_bus *bus, unsigned int devfn, | 71 | static int tx3927_pci_read_config(struct pci_bus *bus, unsigned int devfn, |
72 | int where, int size, u32 * val) | 72 | int where, int size, u32 * val) |
73 | { | 73 | { |
74 | int ret; | 74 | int ret; |
@@ -94,7 +94,7 @@ static int jmr3927_pci_read_config(struct pci_bus *bus, unsigned int devfn, | |||
94 | return check_abort(); | 94 | return check_abort(); |
95 | } | 95 | } |
96 | 96 | ||
97 | static int jmr3927_pci_write_config(struct pci_bus *bus, unsigned int devfn, | 97 | static int tx3927_pci_write_config(struct pci_bus *bus, unsigned int devfn, |
98 | int where, int size, u32 val) | 98 | int where, int size, u32 val) |
99 | { | 99 | { |
100 | int ret; | 100 | int ret; |
@@ -125,7 +125,80 @@ static int jmr3927_pci_write_config(struct pci_bus *bus, unsigned int devfn, | |||
125 | return check_abort(); | 125 | return check_abort(); |
126 | } | 126 | } |
127 | 127 | ||
128 | struct pci_ops jmr3927_pci_ops = { | 128 | static struct pci_ops tx3927_pci_ops = { |
129 | jmr3927_pci_read_config, | 129 | .read = tx3927_pci_read_config, |
130 | jmr3927_pci_write_config, | 130 | .write = tx3927_pci_write_config, |
131 | }; | 131 | }; |
132 | |||
133 | void __init tx3927_pcic_setup(struct pci_controller *channel, | ||
134 | unsigned long sdram_size, int extarb) | ||
135 | { | ||
136 | unsigned long flags; | ||
137 | unsigned long io_base = | ||
138 | channel->io_resource->start + mips_io_port_base - IO_BASE; | ||
139 | unsigned long io_size = | ||
140 | channel->io_resource->end - channel->io_resource->start; | ||
141 | unsigned long io_pciaddr = | ||
142 | channel->io_resource->start - channel->io_offset; | ||
143 | unsigned long mem_base = | ||
144 | channel->mem_resource->start; | ||
145 | unsigned long mem_size = | ||
146 | channel->mem_resource->end - channel->mem_resource->start; | ||
147 | unsigned long mem_pciaddr = | ||
148 | channel->mem_resource->start - channel->mem_offset; | ||
149 | |||
150 | printk(KERN_INFO "TX3927 PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s", | ||
151 | tx3927_pcicptr->did, tx3927_pcicptr->vid, | ||
152 | tx3927_pcicptr->rid, | ||
153 | extarb ? "External" : "Internal"); | ||
154 | channel->pci_ops = &tx3927_pci_ops; | ||
155 | |||
156 | local_irq_save(flags); | ||
157 | /* Disable External PCI Config. Access */ | ||
158 | tx3927_pcicptr->lbc = TX3927_PCIC_LBC_EPCAD; | ||
159 | #ifdef __BIG_ENDIAN | ||
160 | tx3927_pcicptr->lbc |= TX3927_PCIC_LBC_IBSE | | ||
161 | TX3927_PCIC_LBC_TIBSE | | ||
162 | TX3927_PCIC_LBC_TMFBSE | TX3927_PCIC_LBC_MSDSE; | ||
163 | #endif | ||
164 | /* LB->PCI mappings */ | ||
165 | tx3927_pcicptr->iomas = ~(io_size - 1); | ||
166 | tx3927_pcicptr->ilbioma = io_base; | ||
167 | tx3927_pcicptr->ipbioma = io_pciaddr; | ||
168 | tx3927_pcicptr->mmas = ~(mem_size - 1); | ||
169 | tx3927_pcicptr->ilbmma = mem_base; | ||
170 | tx3927_pcicptr->ipbmma = mem_pciaddr; | ||
171 | /* PCI->LB mappings */ | ||
172 | tx3927_pcicptr->iobas = 0xffffffff; | ||
173 | tx3927_pcicptr->ioba = 0; | ||
174 | tx3927_pcicptr->tlbioma = 0; | ||
175 | tx3927_pcicptr->mbas = ~(sdram_size - 1); | ||
176 | tx3927_pcicptr->mba = 0; | ||
177 | tx3927_pcicptr->tlbmma = 0; | ||
178 | /* Enable Direct mapping Address Space Decoder */ | ||
179 | tx3927_pcicptr->lbc |= TX3927_PCIC_LBC_ILMDE | TX3927_PCIC_LBC_ILIDE; | ||
180 | |||
181 | /* Clear All Local Bus Status */ | ||
182 | tx3927_pcicptr->lbstat = TX3927_PCIC_LBIM_ALL; | ||
183 | /* Enable All Local Bus Interrupts */ | ||
184 | tx3927_pcicptr->lbim = TX3927_PCIC_LBIM_ALL; | ||
185 | /* Clear All PCI Status Error */ | ||
186 | tx3927_pcicptr->pcistat = TX3927_PCIC_PCISTATIM_ALL; | ||
187 | /* Enable All PCI Status Error Interrupts */ | ||
188 | tx3927_pcicptr->pcistatim = TX3927_PCIC_PCISTATIM_ALL; | ||
189 | |||
190 | /* PCIC Int => IRC IRQ10 */ | ||
191 | tx3927_pcicptr->il = TX3927_IR_PCI; | ||
192 | /* Target Control (per errata) */ | ||
193 | tx3927_pcicptr->tc = TX3927_PCIC_TC_OF8E | TX3927_PCIC_TC_IF8E; | ||
194 | |||
195 | /* Enable Bus Arbiter */ | ||
196 | if (!extarb) | ||
197 | tx3927_pcicptr->pbapmc = TX3927_PCIC_PBAPMC_PBAEN; | ||
198 | |||
199 | tx3927_pcicptr->pcicmd = PCI_COMMAND_MASTER | | ||
200 | PCI_COMMAND_MEMORY | | ||
201 | PCI_COMMAND_IO | | ||
202 | PCI_COMMAND_PARITY | PCI_COMMAND_SERR; | ||
203 | local_irq_restore(flags); | ||
204 | } | ||
diff --git a/arch/mips/pci/ops-tx4927.c b/arch/mips/pci/ops-tx4927.c index 150419c8b414..c6b49bccd274 100644 --- a/arch/mips/pci/ops-tx4927.c +++ b/arch/mips/pci/ops-tx4927.c | |||
@@ -1,209 +1,408 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2001 MontaVista Software Inc. | 2 | * Define the pci_ops for the PCIC on Toshiba TX4927, TX4938, etc. |
3 | * Author: MontaVista Software, Inc. | ||
4 | * ahennessy@mvista.com | ||
5 | * | 3 | * |
6 | * Copyright (C) 2000-2001 Toshiba Corporation | 4 | * Based on linux/arch/mips/pci/ops-tx4938.c, |
7 | * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org) | 5 | * linux/arch/mips/pci/fixup-rbtx4938.c, |
8 | * | 6 | * linux/arch/mips/txx9/rbtx4938/setup.c, |
9 | * Based on arch/mips/ddb5xxx/ddb5477/pci_ops.c | 7 | * and RBTX49xx patch from CELF patch archive. |
10 | * | ||
11 | * Define the pci_ops for the Toshiba rbtx4927 | ||
12 | * | ||
13 | * Much of the code is derived from the original DDB5074 port by | ||
14 | * Geert Uytterhoeven <geert@sonycom.com> | ||
15 | * | ||
16 | * Copyright 2004 MontaVista Software Inc. | ||
17 | * Author: Manish Lachwani (mlachwani@mvista.com) | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or modify it | ||
20 | * under the terms of the GNU General Public License as published by the | ||
21 | * Free Software Foundation; either version 2 of the License, or (at your | ||
22 | * option) any later version. | ||
23 | * | 8 | * |
24 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 9 | * 2003-2005 (c) MontaVista Software, Inc. |
25 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 10 | * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org) |
26 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | 11 | * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007 |
27 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
28 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
29 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
30 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
31 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
33 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
34 | * | 12 | * |
35 | * You should have received a copy of the GNU General Public License along | 13 | * This program is free software; you can redistribute it and/or modify it |
36 | * with this program; if not, write to the Free Software Foundation, Inc., | 14 | * under the terms of the GNU General Public License as published by the |
37 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | * Free Software Foundation; either version 2 of the License, or (at your |
16 | * option) any later version. | ||
38 | */ | 17 | */ |
39 | #include <linux/types.h> | ||
40 | #include <linux/pci.h> | ||
41 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
42 | #include <linux/init.h> | 19 | #include <asm/txx9/tx4927pcic.h> |
43 | |||
44 | #include <asm/addrspace.h> | ||
45 | #include <asm/byteorder.h> | ||
46 | #include <asm/tx4927/tx4927_pci.h> | ||
47 | |||
48 | /* initialize in setup */ | ||
49 | struct resource pci_io_resource = { | ||
50 | .name = "TX4927 PCI IO SPACE", | ||
51 | .start = 0x1000, | ||
52 | .end = (0x1000 + (TX4927_PCIIO_SIZE)) - 1, | ||
53 | .flags = IORESOURCE_IO | ||
54 | }; | ||
55 | 20 | ||
56 | /* initialize in setup */ | 21 | static struct { |
57 | struct resource pci_mem_resource = { | 22 | struct pci_controller *channel; |
58 | .name = "TX4927 PCI MEM SPACE", | 23 | struct tx4927_pcic_reg __iomem *pcicptr; |
59 | .start = TX4927_PCIMEM, | 24 | } pcicptrs[2]; /* TX4938 has 2 pcic */ |
60 | .end = TX4927_PCIMEM + TX4927_PCIMEM_SIZE - 1, | 25 | |
61 | .flags = IORESOURCE_MEM | 26 | static void __init set_tx4927_pcicptr(struct pci_controller *channel, |
62 | }; | 27 | struct tx4927_pcic_reg __iomem *pcicptr) |
28 | { | ||
29 | int i; | ||
30 | |||
31 | for (i = 0; i < ARRAY_SIZE(pcicptrs); i++) { | ||
32 | if (pcicptrs[i].channel == channel) { | ||
33 | pcicptrs[i].pcicptr = pcicptr; | ||
34 | return; | ||
35 | } | ||
36 | } | ||
37 | for (i = 0; i < ARRAY_SIZE(pcicptrs); i++) { | ||
38 | if (!pcicptrs[i].channel) { | ||
39 | pcicptrs[i].channel = channel; | ||
40 | pcicptrs[i].pcicptr = pcicptr; | ||
41 | return; | ||
42 | } | ||
43 | } | ||
44 | BUG(); | ||
45 | } | ||
63 | 46 | ||
64 | static int mkaddr(int bus, int dev_fn, int where, int *flagsp) | 47 | struct tx4927_pcic_reg __iomem *get_tx4927_pcicptr( |
48 | struct pci_controller *channel) | ||
65 | { | 49 | { |
66 | if (bus > 0) { | 50 | int i; |
67 | /* Type 1 configuration */ | ||
68 | tx4927_pcicptr->g2pcfgadrs = ((bus & 0xff) << 0x10) | | ||
69 | ((dev_fn & 0xff) << 0x08) | (where & 0xfc) | 1; | ||
70 | } else { | ||
71 | if (dev_fn >= PCI_DEVFN(TX4927_PCIC_MAX_DEVNU, 0)) | ||
72 | return -1; | ||
73 | 51 | ||
74 | /* Type 0 configuration */ | 52 | for (i = 0; i < ARRAY_SIZE(pcicptrs); i++) { |
75 | tx4927_pcicptr->g2pcfgadrs = ((bus & 0xff) << 0x10) | | 53 | if (pcicptrs[i].channel == channel) |
76 | ((dev_fn & 0xff) << 0x08) | (where & 0xfc); | 54 | return pcicptrs[i].pcicptr; |
77 | } | 55 | } |
56 | return NULL; | ||
57 | } | ||
58 | |||
59 | static int mkaddr(struct pci_bus *bus, unsigned int devfn, int where, | ||
60 | struct tx4927_pcic_reg __iomem *pcicptr) | ||
61 | { | ||
62 | if (bus->parent == NULL && | ||
63 | devfn >= PCI_DEVFN(TX4927_PCIC_MAX_DEVNU, 0)) | ||
64 | return -1; | ||
65 | __raw_writel(((bus->number & 0xff) << 0x10) | ||
66 | | ((devfn & 0xff) << 0x08) | (where & 0xfc) | ||
67 | | (bus->parent ? 1 : 0), | ||
68 | &pcicptr->g2pcfgadrs); | ||
78 | /* clear M_ABORT and Disable M_ABORT Int. */ | 69 | /* clear M_ABORT and Disable M_ABORT Int. */ |
79 | tx4927_pcicptr->pcistatus = | 70 | __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff) |
80 | (tx4927_pcicptr->pcistatus & 0x0000ffff) | | 71 | | (PCI_STATUS_REC_MASTER_ABORT << 16), |
81 | (PCI_STATUS_REC_MASTER_ABORT << 16); | 72 | &pcicptr->pcistatus); |
82 | tx4927_pcicptr->pcimask &= ~PCI_STATUS_REC_MASTER_ABORT; | ||
83 | return 0; | 73 | return 0; |
84 | } | 74 | } |
85 | 75 | ||
86 | static int check_abort(int flags) | 76 | static int check_abort(struct tx4927_pcic_reg __iomem *pcicptr) |
87 | { | 77 | { |
88 | int code = PCIBIOS_SUCCESSFUL; | 78 | int code = PCIBIOS_SUCCESSFUL; |
89 | if (tx4927_pcicptr-> | 79 | |
90 | pcistatus & (PCI_STATUS_REC_MASTER_ABORT << 16)) { | 80 | /* wait write cycle completion before checking error status */ |
91 | tx4927_pcicptr->pcistatus = | 81 | while (__raw_readl(&pcicptr->pcicstatus) & TX4927_PCIC_PCICSTATUS_IWB) |
92 | (tx4927_pcicptr-> | 82 | ; |
93 | pcistatus & 0x0000ffff) | (PCI_STATUS_REC_MASTER_ABORT | 83 | if (__raw_readl(&pcicptr->pcistatus) |
94 | << 16); | 84 | & (PCI_STATUS_REC_MASTER_ABORT << 16)) { |
95 | tx4927_pcicptr->pcimask |= PCI_STATUS_REC_MASTER_ABORT; | 85 | __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff) |
86 | | (PCI_STATUS_REC_MASTER_ABORT << 16), | ||
87 | &pcicptr->pcistatus); | ||
96 | code = PCIBIOS_DEVICE_NOT_FOUND; | 88 | code = PCIBIOS_DEVICE_NOT_FOUND; |
97 | } | 89 | } |
98 | return code; | 90 | return code; |
99 | } | 91 | } |
100 | 92 | ||
101 | static int tx4927_pcibios_read_config(struct pci_bus *bus, unsigned int devfn, int where, | 93 | static u8 icd_readb(int offset, struct tx4927_pcic_reg __iomem *pcicptr) |
102 | int size, u32 * val) | 94 | { |
95 | #ifdef __BIG_ENDIAN | ||
96 | offset ^= 3; | ||
97 | #endif | ||
98 | return __raw_readb((void __iomem *)&pcicptr->g2pcfgdata + offset); | ||
99 | } | ||
100 | static u16 icd_readw(int offset, struct tx4927_pcic_reg __iomem *pcicptr) | ||
101 | { | ||
102 | #ifdef __BIG_ENDIAN | ||
103 | offset ^= 2; | ||
104 | #endif | ||
105 | return __raw_readw((void __iomem *)&pcicptr->g2pcfgdata + offset); | ||
106 | } | ||
107 | static u32 icd_readl(struct tx4927_pcic_reg __iomem *pcicptr) | ||
108 | { | ||
109 | return __raw_readl(&pcicptr->g2pcfgdata); | ||
110 | } | ||
111 | static void icd_writeb(u8 val, int offset, | ||
112 | struct tx4927_pcic_reg __iomem *pcicptr) | ||
113 | { | ||
114 | #ifdef __BIG_ENDIAN | ||
115 | offset ^= 3; | ||
116 | #endif | ||
117 | __raw_writeb(val, (void __iomem *)&pcicptr->g2pcfgdata + offset); | ||
118 | } | ||
119 | static void icd_writew(u16 val, int offset, | ||
120 | struct tx4927_pcic_reg __iomem *pcicptr) | ||
121 | { | ||
122 | #ifdef __BIG_ENDIAN | ||
123 | offset ^= 2; | ||
124 | #endif | ||
125 | __raw_writew(val, (void __iomem *)&pcicptr->g2pcfgdata + offset); | ||
126 | } | ||
127 | static void icd_writel(u32 val, struct tx4927_pcic_reg __iomem *pcicptr) | ||
103 | { | 128 | { |
104 | int flags, retval, dev, busno, func; | 129 | __raw_writel(val, &pcicptr->g2pcfgdata); |
130 | } | ||
105 | 131 | ||
106 | busno = bus->number; | 132 | static struct tx4927_pcic_reg __iomem *pci_bus_to_pcicptr(struct pci_bus *bus) |
107 | dev = PCI_SLOT(devfn); | 133 | { |
108 | func = PCI_FUNC(devfn); | 134 | struct pci_controller *channel = bus->sysdata; |
135 | return get_tx4927_pcicptr(channel); | ||
136 | } | ||
109 | 137 | ||
110 | /* check if the bus is top-level */ | 138 | static int tx4927_pci_config_read(struct pci_bus *bus, unsigned int devfn, |
111 | if (bus->parent != NULL) { | 139 | int where, int size, u32 *val) |
112 | busno = bus->number; | 140 | { |
113 | } else { | 141 | struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(bus); |
114 | busno = 0; | ||
115 | } | ||
116 | 142 | ||
117 | if (mkaddr(busno, devfn, where, &flags)) | 143 | if (mkaddr(bus, devfn, where, pcicptr)) { |
144 | *val = 0xffffffff; | ||
118 | return -1; | 145 | return -1; |
119 | 146 | } | |
120 | switch (size) { | 147 | switch (size) { |
121 | case 1: | 148 | case 1: |
122 | *val = *(volatile u8 *) ((unsigned long) & tx4927_pcicptr-> | 149 | *val = icd_readb(where & 3, pcicptr); |
123 | g2pcfgdata | | ||
124 | #ifdef __LITTLE_ENDIAN | ||
125 | (where & 3)); | ||
126 | #else | ||
127 | ((where & 0x3) ^ 0x3)); | ||
128 | #endif | ||
129 | break; | 150 | break; |
130 | case 2: | 151 | case 2: |
131 | *val = *(volatile u16 *) ((unsigned long) & tx4927_pcicptr-> | 152 | *val = icd_readw(where & 3, pcicptr); |
132 | g2pcfgdata | | ||
133 | #ifdef __LITTLE_ENDIAN | ||
134 | (where & 3)); | ||
135 | #else | ||
136 | ((where & 0x3) ^ 0x2)); | ||
137 | #endif | ||
138 | break; | ||
139 | case 4: | ||
140 | *val = tx4927_pcicptr->g2pcfgdata; | ||
141 | break; | 153 | break; |
154 | default: | ||
155 | *val = icd_readl(pcicptr); | ||
142 | } | 156 | } |
157 | return check_abort(pcicptr); | ||
158 | } | ||
143 | 159 | ||
144 | retval = check_abort(flags); | 160 | static int tx4927_pci_config_write(struct pci_bus *bus, unsigned int devfn, |
145 | if (retval == PCIBIOS_DEVICE_NOT_FOUND) | 161 | int where, int size, u32 val) |
146 | *val = 0xffffffff; | 162 | { |
163 | struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(bus); | ||
147 | 164 | ||
148 | return retval; | 165 | if (mkaddr(bus, devfn, where, pcicptr)) |
166 | return -1; | ||
167 | switch (size) { | ||
168 | case 1: | ||
169 | icd_writeb(val, where & 3, pcicptr); | ||
170 | break; | ||
171 | case 2: | ||
172 | icd_writew(val, where & 3, pcicptr); | ||
173 | break; | ||
174 | default: | ||
175 | icd_writel(val, pcicptr); | ||
176 | } | ||
177 | return check_abort(pcicptr); | ||
149 | } | 178 | } |
150 | 179 | ||
151 | static int tx4927_pcibios_write_config(struct pci_bus *bus, unsigned int devfn, int where, | 180 | static struct pci_ops tx4927_pci_ops = { |
152 | int size, u32 val) | 181 | .read = tx4927_pci_config_read, |
182 | .write = tx4927_pci_config_write, | ||
183 | }; | ||
184 | |||
185 | static struct { | ||
186 | u8 trdyto; | ||
187 | u8 retryto; | ||
188 | u16 gbwc; | ||
189 | } tx4927_pci_opts __devinitdata = { | ||
190 | .trdyto = 0, | ||
191 | .retryto = 0, | ||
192 | .gbwc = 0xfe0, /* 4064 GBUSCLK for CCFG.GTOT=0b11 */ | ||
193 | }; | ||
194 | |||
195 | void __init tx4927_pcic_setup(struct tx4927_pcic_reg __iomem *pcicptr, | ||
196 | struct pci_controller *channel, int extarb) | ||
153 | { | 197 | { |
154 | int flags, dev, busno, func; | 198 | int i; |
155 | busno = bus->number; | 199 | unsigned long flags; |
156 | dev = PCI_SLOT(devfn); | ||
157 | func = PCI_FUNC(devfn); | ||
158 | 200 | ||
159 | /* check if the bus is top-level */ | 201 | set_tx4927_pcicptr(channel, pcicptr); |
160 | if (bus->parent != NULL) { | ||
161 | busno = bus->number; | ||
162 | } else { | ||
163 | busno = 0; | ||
164 | } | ||
165 | 202 | ||
166 | if (mkaddr(busno, devfn, where, &flags)) | 203 | if (!channel->pci_ops) |
167 | return -1; | 204 | printk(KERN_INFO |
205 | "PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n", | ||
206 | __raw_readl(&pcicptr->pciid) >> 16, | ||
207 | __raw_readl(&pcicptr->pciid) & 0xffff, | ||
208 | __raw_readl(&pcicptr->pciccrev) & 0xff, | ||
209 | extarb ? "External" : "Internal"); | ||
210 | channel->pci_ops = &tx4927_pci_ops; | ||
168 | 211 | ||
169 | switch (size) { | 212 | local_irq_save(flags); |
170 | case 1: | 213 | |
171 | *(volatile u8 *) ((unsigned long) & tx4927_pcicptr-> | 214 | /* Disable All Initiator Space */ |
172 | g2pcfgdata | | 215 | __raw_writel(__raw_readl(&pcicptr->pciccfg) |
173 | #ifdef __LITTLE_ENDIAN | 216 | & ~(TX4927_PCIC_PCICCFG_G2PMEN(0) |
174 | (where & 3)) = val; | 217 | | TX4927_PCIC_PCICCFG_G2PMEN(1) |
218 | | TX4927_PCIC_PCICCFG_G2PMEN(2) | ||
219 | | TX4927_PCIC_PCICCFG_G2PIOEN), | ||
220 | &pcicptr->pciccfg); | ||
221 | |||
222 | /* GB->PCI mappings */ | ||
223 | __raw_writel((channel->io_resource->end - channel->io_resource->start) | ||
224 | >> 4, | ||
225 | &pcicptr->g2piomask); | ||
226 | ____raw_writeq((channel->io_resource->start + | ||
227 | channel->io_map_base - IO_BASE) | | ||
228 | #ifdef __BIG_ENDIAN | ||
229 | TX4927_PCIC_G2PIOGBASE_ECHG | ||
175 | #else | 230 | #else |
176 | ((where & 0x3) ^ 0x3)) = val; | 231 | TX4927_PCIC_G2PIOGBASE_BSDIS |
177 | #endif | 232 | #endif |
178 | break; | 233 | , &pcicptr->g2piogbase); |
179 | 234 | ____raw_writeq(channel->io_resource->start - channel->io_offset, | |
180 | case 2: | 235 | &pcicptr->g2piopbase); |
181 | *(volatile u16 *) ((unsigned long) & tx4927_pcicptr-> | 236 | for (i = 0; i < 3; i++) { |
182 | g2pcfgdata | | 237 | __raw_writel(0, &pcicptr->g2pmmask[i]); |
183 | #ifdef __LITTLE_ENDIAN | 238 | ____raw_writeq(0, &pcicptr->g2pmgbase[i]); |
184 | (where & 3)) = val; | 239 | ____raw_writeq(0, &pcicptr->g2pmpbase[i]); |
240 | } | ||
241 | if (channel->mem_resource->end) { | ||
242 | __raw_writel((channel->mem_resource->end | ||
243 | - channel->mem_resource->start) >> 4, | ||
244 | &pcicptr->g2pmmask[0]); | ||
245 | ____raw_writeq(channel->mem_resource->start | | ||
246 | #ifdef __BIG_ENDIAN | ||
247 | TX4927_PCIC_G2PMnGBASE_ECHG | ||
185 | #else | 248 | #else |
186 | ((where & 0x3) ^ 0x2)) = val; | 249 | TX4927_PCIC_G2PMnGBASE_BSDIS |
187 | #endif | 250 | #endif |
188 | break; | 251 | , &pcicptr->g2pmgbase[0]); |
189 | case 4: | 252 | ____raw_writeq(channel->mem_resource->start - |
190 | tx4927_pcicptr->g2pcfgdata = val; | 253 | channel->mem_offset, |
191 | break; | 254 | &pcicptr->g2pmpbase[0]); |
255 | } | ||
256 | /* PCI->GB mappings (I/O 256B) */ | ||
257 | __raw_writel(0, &pcicptr->p2giopbase); /* 256B */ | ||
258 | ____raw_writeq(0, &pcicptr->p2giogbase); | ||
259 | /* PCI->GB mappings (MEM 512MB (64MB on R1.x)) */ | ||
260 | __raw_writel(0, &pcicptr->p2gm0plbase); | ||
261 | __raw_writel(0, &pcicptr->p2gm0pubase); | ||
262 | ____raw_writeq(TX4927_PCIC_P2GMnGBASE_TMEMEN | | ||
263 | #ifdef __BIG_ENDIAN | ||
264 | TX4927_PCIC_P2GMnGBASE_TECHG | ||
265 | #else | ||
266 | TX4927_PCIC_P2GMnGBASE_TBSDIS | ||
267 | #endif | ||
268 | , &pcicptr->p2gmgbase[0]); | ||
269 | /* PCI->GB mappings (MEM 16MB) */ | ||
270 | __raw_writel(0xffffffff, &pcicptr->p2gm1plbase); | ||
271 | __raw_writel(0xffffffff, &pcicptr->p2gm1pubase); | ||
272 | ____raw_writeq(0, &pcicptr->p2gmgbase[1]); | ||
273 | /* PCI->GB mappings (MEM 1MB) */ | ||
274 | __raw_writel(0xffffffff, &pcicptr->p2gm2pbase); /* 1MB */ | ||
275 | ____raw_writeq(0, &pcicptr->p2gmgbase[2]); | ||
276 | |||
277 | /* Clear all (including IRBER) except for GBWC */ | ||
278 | __raw_writel((tx4927_pci_opts.gbwc << 16) | ||
279 | & TX4927_PCIC_PCICCFG_GBWC_MASK, | ||
280 | &pcicptr->pciccfg); | ||
281 | /* Enable Initiator Memory Space */ | ||
282 | if (channel->mem_resource->end) | ||
283 | __raw_writel(__raw_readl(&pcicptr->pciccfg) | ||
284 | | TX4927_PCIC_PCICCFG_G2PMEN(0), | ||
285 | &pcicptr->pciccfg); | ||
286 | /* Enable Initiator I/O Space */ | ||
287 | if (channel->io_resource->end) | ||
288 | __raw_writel(__raw_readl(&pcicptr->pciccfg) | ||
289 | | TX4927_PCIC_PCICCFG_G2PIOEN, | ||
290 | &pcicptr->pciccfg); | ||
291 | /* Enable Initiator Config */ | ||
292 | __raw_writel(__raw_readl(&pcicptr->pciccfg) | ||
293 | | TX4927_PCIC_PCICCFG_ICAEN | TX4927_PCIC_PCICCFG_TCAR, | ||
294 | &pcicptr->pciccfg); | ||
295 | |||
296 | /* Do not use MEMMUL, MEMINF: YMFPCI card causes M_ABORT. */ | ||
297 | __raw_writel(0, &pcicptr->pcicfg1); | ||
298 | |||
299 | __raw_writel((__raw_readl(&pcicptr->g2ptocnt) & ~0xffff) | ||
300 | | (tx4927_pci_opts.trdyto & 0xff) | ||
301 | | ((tx4927_pci_opts.retryto & 0xff) << 8), | ||
302 | &pcicptr->g2ptocnt); | ||
303 | |||
304 | /* Clear All Local Bus Status */ | ||
305 | __raw_writel(TX4927_PCIC_PCICSTATUS_ALL, &pcicptr->pcicstatus); | ||
306 | /* Enable All Local Bus Interrupts */ | ||
307 | __raw_writel(TX4927_PCIC_PCICSTATUS_ALL, &pcicptr->pcicmask); | ||
308 | /* Clear All Initiator Status */ | ||
309 | __raw_writel(TX4927_PCIC_G2PSTATUS_ALL, &pcicptr->g2pstatus); | ||
310 | /* Enable All Initiator Interrupts */ | ||
311 | __raw_writel(TX4927_PCIC_G2PSTATUS_ALL, &pcicptr->g2pmask); | ||
312 | /* Clear All PCI Status Error */ | ||
313 | __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff) | ||
314 | | (TX4927_PCIC_PCISTATUS_ALL << 16), | ||
315 | &pcicptr->pcistatus); | ||
316 | /* Enable All PCI Status Error Interrupts */ | ||
317 | __raw_writel(TX4927_PCIC_PCISTATUS_ALL, &pcicptr->pcimask); | ||
318 | |||
319 | if (!extarb) { | ||
320 | /* Reset Bus Arbiter */ | ||
321 | __raw_writel(TX4927_PCIC_PBACFG_RPBA, &pcicptr->pbacfg); | ||
322 | __raw_writel(0, &pcicptr->pbabm); | ||
323 | /* Enable Bus Arbiter */ | ||
324 | __raw_writel(TX4927_PCIC_PBACFG_PBAEN, &pcicptr->pbacfg); | ||
192 | } | 325 | } |
193 | 326 | ||
194 | return check_abort(flags); | 327 | __raw_writel(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY |
328 | | PCI_COMMAND_PARITY | PCI_COMMAND_SERR, | ||
329 | &pcicptr->pcistatus); | ||
330 | local_irq_restore(flags); | ||
331 | |||
332 | printk(KERN_DEBUG | ||
333 | "PCI: COMMAND=%04x,PCIMASK=%04x," | ||
334 | "TRDYTO=%02x,RETRYTO=%02x,GBWC=%03x\n", | ||
335 | __raw_readl(&pcicptr->pcistatus) & 0xffff, | ||
336 | __raw_readl(&pcicptr->pcimask) & 0xffff, | ||
337 | __raw_readl(&pcicptr->g2ptocnt) & 0xff, | ||
338 | (__raw_readl(&pcicptr->g2ptocnt) & 0xff00) >> 8, | ||
339 | (__raw_readl(&pcicptr->pciccfg) >> 16) & 0xfff); | ||
195 | } | 340 | } |
196 | 341 | ||
197 | struct pci_ops tx4927_pci_ops = { | 342 | static void tx4927_report_pcic_status1(struct tx4927_pcic_reg __iomem *pcicptr) |
198 | tx4927_pcibios_read_config, | 343 | { |
199 | tx4927_pcibios_write_config | 344 | __u16 pcistatus = (__u16)(__raw_readl(&pcicptr->pcistatus) >> 16); |
200 | }; | 345 | __u32 g2pstatus = __raw_readl(&pcicptr->g2pstatus); |
346 | __u32 pcicstatus = __raw_readl(&pcicptr->pcicstatus); | ||
347 | static struct { | ||
348 | __u32 flag; | ||
349 | const char *str; | ||
350 | } pcistat_tbl[] = { | ||
351 | { PCI_STATUS_DETECTED_PARITY, "DetectedParityError" }, | ||
352 | { PCI_STATUS_SIG_SYSTEM_ERROR, "SignaledSystemError" }, | ||
353 | { PCI_STATUS_REC_MASTER_ABORT, "ReceivedMasterAbort" }, | ||
354 | { PCI_STATUS_REC_TARGET_ABORT, "ReceivedTargetAbort" }, | ||
355 | { PCI_STATUS_SIG_TARGET_ABORT, "SignaledTargetAbort" }, | ||
356 | { PCI_STATUS_PARITY, "MasterParityError" }, | ||
357 | }, g2pstat_tbl[] = { | ||
358 | { TX4927_PCIC_G2PSTATUS_TTOE, "TIOE" }, | ||
359 | { TX4927_PCIC_G2PSTATUS_RTOE, "RTOE" }, | ||
360 | }, pcicstat_tbl[] = { | ||
361 | { TX4927_PCIC_PCICSTATUS_PME, "PME" }, | ||
362 | { TX4927_PCIC_PCICSTATUS_TLB, "TLB" }, | ||
363 | { TX4927_PCIC_PCICSTATUS_NIB, "NIB" }, | ||
364 | { TX4927_PCIC_PCICSTATUS_ZIB, "ZIB" }, | ||
365 | { TX4927_PCIC_PCICSTATUS_PERR, "PERR" }, | ||
366 | { TX4927_PCIC_PCICSTATUS_SERR, "SERR" }, | ||
367 | { TX4927_PCIC_PCICSTATUS_GBE, "GBE" }, | ||
368 | { TX4927_PCIC_PCICSTATUS_IWB, "IWB" }, | ||
369 | }; | ||
370 | int i, cont; | ||
201 | 371 | ||
202 | /* | 372 | printk(KERN_ERR ""); |
203 | * h/w only supports devices 0x00 to 0x14 | 373 | if (pcistatus & TX4927_PCIC_PCISTATUS_ALL) { |
204 | */ | 374 | printk(KERN_CONT "pcistat:%04x(", pcistatus); |
205 | struct pci_controller tx4927_controller = { | 375 | for (i = 0, cont = 0; i < ARRAY_SIZE(pcistat_tbl); i++) |
206 | .pci_ops = &tx4927_pci_ops, | 376 | if (pcistatus & pcistat_tbl[i].flag) |
207 | .io_resource = &pci_io_resource, | 377 | printk(KERN_CONT "%s%s", |
208 | .mem_resource = &pci_mem_resource, | 378 | cont++ ? " " : "", pcistat_tbl[i].str); |
209 | }; | 379 | printk(KERN_CONT ") "); |
380 | } | ||
381 | if (g2pstatus & TX4927_PCIC_G2PSTATUS_ALL) { | ||
382 | printk(KERN_CONT "g2pstatus:%08x(", g2pstatus); | ||
383 | for (i = 0, cont = 0; i < ARRAY_SIZE(g2pstat_tbl); i++) | ||
384 | if (g2pstatus & g2pstat_tbl[i].flag) | ||
385 | printk(KERN_CONT "%s%s", | ||
386 | cont++ ? " " : "", g2pstat_tbl[i].str); | ||
387 | printk(KERN_CONT ") "); | ||
388 | } | ||
389 | if (pcicstatus & TX4927_PCIC_PCICSTATUS_ALL) { | ||
390 | printk(KERN_CONT "pcicstatus:%08x(", pcicstatus); | ||
391 | for (i = 0, cont = 0; i < ARRAY_SIZE(pcicstat_tbl); i++) | ||
392 | if (pcicstatus & pcicstat_tbl[i].flag) | ||
393 | printk(KERN_CONT "%s%s", | ||
394 | cont++ ? " " : "", pcicstat_tbl[i].str); | ||
395 | printk(KERN_CONT ")"); | ||
396 | } | ||
397 | printk(KERN_CONT "\n"); | ||
398 | } | ||
399 | |||
400 | void tx4927_report_pcic_status(void) | ||
401 | { | ||
402 | int i; | ||
403 | |||
404 | for (i = 0; i < ARRAY_SIZE(pcicptrs); i++) { | ||
405 | if (pcicptrs[i].pcicptr) | ||
406 | tx4927_report_pcic_status1(pcicptrs[i].pcicptr); | ||
407 | } | ||
408 | } | ||
diff --git a/arch/mips/pci/ops-tx4938.c b/arch/mips/pci/ops-tx4938.c deleted file mode 100644 index a450c4062031..000000000000 --- a/arch/mips/pci/ops-tx4938.c +++ /dev/null | |||
@@ -1,214 +0,0 @@ | |||
1 | /* | ||
2 | * Define the pci_ops for the Toshiba rbtx4938 | ||
3 | * Copyright (C) 2000-2001 Toshiba Corporation | ||
4 | * | ||
5 | * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the | ||
6 | * terms of the GNU General Public License version 2. This program is | ||
7 | * licensed "as is" without any warranty of any kind, whether express | ||
8 | * or implied. | ||
9 | * | ||
10 | * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) | ||
11 | */ | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/pci.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/init.h> | ||
16 | |||
17 | #include <asm/addrspace.h> | ||
18 | #include <asm/tx4938/rbtx4938.h> | ||
19 | |||
20 | /* initialize in setup */ | ||
21 | struct resource pci_io_resource = { | ||
22 | .name = "pci IO space", | ||
23 | .start = 0, | ||
24 | .end = 0, | ||
25 | .flags = IORESOURCE_IO | ||
26 | }; | ||
27 | |||
28 | /* initialize in setup */ | ||
29 | struct resource pci_mem_resource = { | ||
30 | .name = "pci memory space", | ||
31 | .start = 0, | ||
32 | .end = 0, | ||
33 | .flags = IORESOURCE_MEM | ||
34 | }; | ||
35 | |||
36 | struct resource tx4938_pcic1_pci_io_resource = { | ||
37 | .name = "PCI1 IO", | ||
38 | .start = 0, | ||
39 | .end = 0, | ||
40 | .flags = IORESOURCE_IO | ||
41 | }; | ||
42 | struct resource tx4938_pcic1_pci_mem_resource = { | ||
43 | .name = "PCI1 mem", | ||
44 | .start = 0, | ||
45 | .end = 0, | ||
46 | .flags = IORESOURCE_MEM | ||
47 | }; | ||
48 | |||
49 | static int mkaddr(int bus, int dev_fn, int where, | ||
50 | struct tx4938_pcic_reg *pcicptr) | ||
51 | { | ||
52 | if (bus > 0) { | ||
53 | /* Type 1 configuration */ | ||
54 | pcicptr->g2pcfgadrs = ((bus & 0xff) << 0x10) | | ||
55 | ((dev_fn & 0xff) << 0x08) | (where & 0xfc) | 1; | ||
56 | } else { | ||
57 | if (dev_fn >= PCI_DEVFN(TX4938_PCIC_MAX_DEVNU, 0)) | ||
58 | return -1; | ||
59 | |||
60 | /* Type 0 configuration */ | ||
61 | pcicptr->g2pcfgadrs = ((bus & 0xff) << 0x10) | | ||
62 | ((dev_fn & 0xff) << 0x08) | (where & 0xfc); | ||
63 | } | ||
64 | /* clear M_ABORT and Disable M_ABORT Int. */ | ||
65 | pcicptr->pcistatus = | ||
66 | (pcicptr->pcistatus & 0x0000ffff) | | ||
67 | (PCI_STATUS_REC_MASTER_ABORT << 16); | ||
68 | pcicptr->pcimask &= ~PCI_STATUS_REC_MASTER_ABORT; | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static int check_abort(struct tx4938_pcic_reg *pcicptr) | ||
74 | { | ||
75 | int code = PCIBIOS_SUCCESSFUL; | ||
76 | /* wait write cycle completion before checking error status */ | ||
77 | while (pcicptr->pcicstatus & TX4938_PCIC_PCICSTATUS_IWB) | ||
78 | ; | ||
79 | if (pcicptr->pcistatus & (PCI_STATUS_REC_MASTER_ABORT << 16)) { | ||
80 | pcicptr->pcistatus = | ||
81 | (pcicptr-> | ||
82 | pcistatus & 0x0000ffff) | (PCI_STATUS_REC_MASTER_ABORT | ||
83 | << 16); | ||
84 | pcicptr->pcimask |= PCI_STATUS_REC_MASTER_ABORT; | ||
85 | code = PCIBIOS_DEVICE_NOT_FOUND; | ||
86 | } | ||
87 | return code; | ||
88 | } | ||
89 | |||
90 | extern struct pci_controller tx4938_pci_controller[]; | ||
91 | extern struct tx4938_pcic_reg *get_tx4938_pcicptr(int ch); | ||
92 | |||
93 | static struct tx4938_pcic_reg *pci_bus_to_pcicptr(struct pci_bus *bus) | ||
94 | { | ||
95 | struct pci_controller *channel = bus->sysdata; | ||
96 | return get_tx4938_pcicptr(channel - &tx4938_pci_controller[0]); | ||
97 | } | ||
98 | |||
99 | static int tx4938_pcibios_read_config(struct pci_bus *bus, unsigned int devfn, | ||
100 | int where, int size, u32 * val) | ||
101 | { | ||
102 | int retval, dev, busno, func; | ||
103 | struct tx4938_pcic_reg *pcicptr = pci_bus_to_pcicptr(bus); | ||
104 | void __iomem *cfgdata = | ||
105 | (void __iomem *)(unsigned long)&pcicptr->g2pcfgdata; | ||
106 | |||
107 | dev = PCI_SLOT(devfn); | ||
108 | func = PCI_FUNC(devfn); | ||
109 | |||
110 | /* check if the bus is top-level */ | ||
111 | if (bus->parent != NULL) | ||
112 | busno = bus->number; | ||
113 | else { | ||
114 | busno = 0; | ||
115 | } | ||
116 | |||
117 | if (mkaddr(busno, devfn, where, pcicptr)) | ||
118 | return -1; | ||
119 | |||
120 | switch (size) { | ||
121 | case 1: | ||
122 | #ifdef __BIG_ENDIAN | ||
123 | cfgdata += (where & 3) ^ 3; | ||
124 | #else | ||
125 | cfgdata += where & 3; | ||
126 | #endif | ||
127 | *val = __raw_readb(cfgdata); | ||
128 | break; | ||
129 | case 2: | ||
130 | #ifdef __BIG_ENDIAN | ||
131 | cfgdata += (where & 2) ^ 2; | ||
132 | #else | ||
133 | cfgdata += where & 2; | ||
134 | #endif | ||
135 | *val = __raw_readw(cfgdata); | ||
136 | break; | ||
137 | case 4: | ||
138 | *val = __raw_readl(cfgdata); | ||
139 | break; | ||
140 | } | ||
141 | |||
142 | retval = check_abort(pcicptr); | ||
143 | if (retval == PCIBIOS_DEVICE_NOT_FOUND) | ||
144 | *val = 0xffffffff; | ||
145 | |||
146 | return retval; | ||
147 | } | ||
148 | |||
149 | static int tx4938_pcibios_write_config(struct pci_bus *bus, unsigned int devfn, int where, | ||
150 | int size, u32 val) | ||
151 | { | ||
152 | int dev, busno, func; | ||
153 | struct tx4938_pcic_reg *pcicptr = pci_bus_to_pcicptr(bus); | ||
154 | void __iomem *cfgdata = | ||
155 | (void __iomem *)(unsigned long)&pcicptr->g2pcfgdata; | ||
156 | |||
157 | busno = bus->number; | ||
158 | dev = PCI_SLOT(devfn); | ||
159 | func = PCI_FUNC(devfn); | ||
160 | |||
161 | /* check if the bus is top-level */ | ||
162 | if (bus->parent != NULL) { | ||
163 | busno = bus->number; | ||
164 | } else { | ||
165 | busno = 0; | ||
166 | } | ||
167 | |||
168 | if (mkaddr(busno, devfn, where, pcicptr)) | ||
169 | return -1; | ||
170 | |||
171 | switch (size) { | ||
172 | case 1: | ||
173 | #ifdef __BIG_ENDIAN | ||
174 | cfgdata += (where & 3) ^ 3; | ||
175 | #else | ||
176 | cfgdata += where & 3; | ||
177 | #endif | ||
178 | __raw_writeb(val, cfgdata); | ||
179 | break; | ||
180 | case 2: | ||
181 | #ifdef __BIG_ENDIAN | ||
182 | cfgdata += (where & 2) ^ 2; | ||
183 | #else | ||
184 | cfgdata += where & 2; | ||
185 | #endif | ||
186 | __raw_writew(val, cfgdata); | ||
187 | break; | ||
188 | case 4: | ||
189 | __raw_writel(val, cfgdata); | ||
190 | break; | ||
191 | } | ||
192 | |||
193 | return check_abort(pcicptr); | ||
194 | } | ||
195 | |||
196 | struct pci_ops tx4938_pci_ops = { | ||
197 | tx4938_pcibios_read_config, | ||
198 | tx4938_pcibios_write_config | ||
199 | }; | ||
200 | |||
201 | struct pci_controller tx4938_pci_controller[] = { | ||
202 | /* h/w only supports devices 0x00 to 0x14 */ | ||
203 | { | ||
204 | .pci_ops = &tx4938_pci_ops, | ||
205 | .io_resource = &pci_io_resource, | ||
206 | .mem_resource = &pci_mem_resource, | ||
207 | }, | ||
208 | /* h/w only supports devices 0x00 to 0x14 */ | ||
209 | { | ||
210 | .pci_ops = &tx4938_pci_ops, | ||
211 | .io_resource = &tx4938_pcic1_pci_io_resource, | ||
212 | .mem_resource = &tx4938_pcic1_pci_mem_resource, | ||
213 | } | ||
214 | }; | ||
diff --git a/arch/mips/pci/pci-bcm1480.c b/arch/mips/pci/pci-bcm1480.c index 87e2c8f54e2d..a9060c771840 100644 --- a/arch/mips/pci/pci-bcm1480.c +++ b/arch/mips/pci/pci-bcm1480.c | |||
@@ -202,7 +202,6 @@ static int __init bcm1480_pcibios_init(void) | |||
202 | { | 202 | { |
203 | uint32_t cmdreg; | 203 | uint32_t cmdreg; |
204 | uint64_t reg; | 204 | uint64_t reg; |
205 | extern int pci_probe_only; | ||
206 | 205 | ||
207 | /* CFE will assign PCI resources */ | 206 | /* CFE will assign PCI resources */ |
208 | pci_probe_only = 1; | 207 | pci_probe_only = 1; |
@@ -254,8 +253,6 @@ static int __init bcm1480_pcibios_init(void) | |||
254 | ioremap(A_BCM1480_PHYS_PCI_IO_MATCH_BYTES, 65536); | 253 | ioremap(A_BCM1480_PHYS_PCI_IO_MATCH_BYTES, 65536); |
255 | bcm1480_controller.io_map_base -= bcm1480_controller.io_offset; | 254 | bcm1480_controller.io_map_base -= bcm1480_controller.io_offset; |
256 | set_io_port_base(bcm1480_controller.io_map_base); | 255 | set_io_port_base(bcm1480_controller.io_map_base); |
257 | isa_slot_offset = (unsigned long) | ||
258 | ioremap(A_BCM1480_PHYS_PCI_MEM_MATCH_BYTES, 1024*1024); | ||
259 | 256 | ||
260 | register_pci_controller(&bcm1480_controller); | 257 | register_pci_controller(&bcm1480_controller); |
261 | 258 | ||
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c index a18516925cdd..ce92f82b16d2 100644 --- a/arch/mips/pci/pci-ip27.c +++ b/arch/mips/pci/pci-ip27.c | |||
@@ -47,7 +47,6 @@ int __cpuinit bridge_probe(nasid_t nasid, int widget_id, int masterwid) | |||
47 | static int num_bridges = 0; | 47 | static int num_bridges = 0; |
48 | bridge_t *bridge; | 48 | bridge_t *bridge; |
49 | int slot; | 49 | int slot; |
50 | extern int pci_probe_only; | ||
51 | 50 | ||
52 | pci_probe_only = 1; | 51 | pci_probe_only = 1; |
53 | 52 | ||
diff --git a/arch/mips/pci/pci-jmr3927.c b/arch/mips/pci/pci-jmr3927.c deleted file mode 100644 index cb84f4e8ccae..000000000000 --- a/arch/mips/pci/pci-jmr3927.c +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2001 MontaVista Software Inc. | ||
3 | * Author: MontaVista Software, Inc. | ||
4 | * ahennessy@mvista.com | ||
5 | * | ||
6 | * Copyright (C) 2000-2001 Toshiba Corporation | ||
7 | * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | #include <linux/types.h> | ||
30 | #include <linux/pci.h> | ||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/init.h> | ||
33 | |||
34 | #include <asm/jmr3927/jmr3927.h> | ||
35 | #include <asm/debug.h> | ||
36 | |||
37 | struct resource pci_io_resource = { | ||
38 | .name = "IO MEM", | ||
39 | .start = 0x1000, /* reserve regacy I/O space */ | ||
40 | .end = 0x1000 + JMR3927_PCIIO_SIZE - 1, | ||
41 | .flags = IORESOURCE_IO | ||
42 | }; | ||
43 | |||
44 | struct resource pci_mem_resource = { | ||
45 | .name = "PCI MEM", | ||
46 | .start = JMR3927_PCIMEM, | ||
47 | .end = JMR3927_PCIMEM + JMR3927_PCIMEM_SIZE - 1, | ||
48 | .flags = IORESOURCE_MEM | ||
49 | }; | ||
50 | |||
51 | extern struct pci_ops jmr3927_pci_ops; | ||
52 | |||
53 | struct pci_controller jmr3927_controller = { | ||
54 | .pci_ops = &jmr3927_pci_ops, | ||
55 | .io_resource = &pci_io_resource, | ||
56 | .mem_resource = &pci_mem_resource, | ||
57 | .mem_offset = JMR3927_PCIMEM | ||
58 | }; | ||
diff --git a/arch/mips/pci/pci-lasat.c b/arch/mips/pci/pci-lasat.c index e70ae3236e0b..a98e543a514a 100644 --- a/arch/mips/pci/pci-lasat.c +++ b/arch/mips/pci/pci-lasat.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <linux/pci.h> | 10 | #include <linux/pci.h> |
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | 12 | ||
13 | #include <asm/bootinfo.h> | 13 | #include <asm/lasat/lasat.h> |
14 | 14 | ||
15 | #include <irq.h> | 15 | #include <irq.h> |
16 | 16 | ||
@@ -39,16 +39,10 @@ static int __init lasat_pci_setup(void) | |||
39 | { | 39 | { |
40 | printk(KERN_DEBUG "PCI: starting\n"); | 40 | printk(KERN_DEBUG "PCI: starting\n"); |
41 | 41 | ||
42 | switch (mips_machtype) { | 42 | if (IS_LASAT_200()) |
43 | case MACH_LASAT_100: | ||
44 | lasat_pci_controller.pci_ops = >64xxx_pci0_ops; | ||
45 | break; | ||
46 | case MACH_LASAT_200: | ||
47 | lasat_pci_controller.pci_ops = &nile4_pci_ops; | 43 | lasat_pci_controller.pci_ops = &nile4_pci_ops; |
48 | break; | 44 | else |
49 | default: | 45 | lasat_pci_controller.pci_ops = >64xxx_pci0_ops; |
50 | panic("pcibios_init: mips_machtype incorrect"); | ||
51 | } | ||
52 | 46 | ||
53 | register_pci_controller(&lasat_pci_controller); | 47 | register_pci_controller(&lasat_pci_controller); |
54 | 48 | ||
diff --git a/arch/mips/pci/pci-sb1250.c b/arch/mips/pci/pci-sb1250.c index 2a09ad91ec8c..bf639590b8b2 100644 --- a/arch/mips/pci/pci-sb1250.c +++ b/arch/mips/pci/pci-sb1250.c | |||
@@ -210,7 +210,6 @@ static int __init sb1250_pcibios_init(void) | |||
210 | void __iomem *io_map_base; | 210 | void __iomem *io_map_base; |
211 | uint32_t cmdreg; | 211 | uint32_t cmdreg; |
212 | uint64_t reg; | 212 | uint64_t reg; |
213 | extern int pci_probe_only; | ||
214 | 213 | ||
215 | /* CFE will assign PCI resources */ | 214 | /* CFE will assign PCI resources */ |
216 | pci_probe_only = 1; | 215 | pci_probe_only = 1; |
@@ -254,9 +253,6 @@ static int __init sb1250_pcibios_init(void) | |||
254 | * works correctly with most of Linux's drivers. | 253 | * works correctly with most of Linux's drivers. |
255 | * XXX ehs: Should this happen in PCI Device mode? | 254 | * XXX ehs: Should this happen in PCI Device mode? |
256 | */ | 255 | */ |
257 | isa_slot_offset = (unsigned long) | ||
258 | ioremap(A_PHYS_LDTPCI_IO_MATCH_BYTES_32, 1024 * 1024); | ||
259 | |||
260 | io_map_base = ioremap(A_PHYS_LDTPCI_IO_MATCH_BYTES, 1024 * 1024); | 256 | io_map_base = ioremap(A_PHYS_LDTPCI_IO_MATCH_BYTES, 1024 * 1024); |
261 | sb1250_controller.io_map_base = io_map_base; | 257 | sb1250_controller.io_map_base = io_map_base; |
262 | set_io_port_base((unsigned long)io_map_base); | 258 | set_io_port_base((unsigned long)io_map_base); |
diff --git a/arch/mips/pci/pci-tx4927.c b/arch/mips/pci/pci-tx4927.c new file mode 100644 index 000000000000..27e86a09dd41 --- /dev/null +++ b/arch/mips/pci/pci-tx4927.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * linux/arch/mips/pci/pci-tx4927.c | ||
3 | * | ||
4 | * Based on linux/arch/mips/txx9/rbtx4938/setup.c, | ||
5 | * and RBTX49xx patch from CELF patch archive. | ||
6 | * | ||
7 | * Copyright 2001, 2003-2005 MontaVista Software Inc. | ||
8 | * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org) | ||
9 | * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007 | ||
10 | * | ||
11 | * This file is subject to the terms and conditions of the GNU General Public | ||
12 | * License. See the file "COPYING" in the main directory of this archive | ||
13 | * for more details. | ||
14 | */ | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/pci.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <asm/txx9/generic.h> | ||
19 | #include <asm/txx9/tx4927.h> | ||
20 | |||
21 | int __init tx4927_report_pciclk(void) | ||
22 | { | ||
23 | int pciclk = 0; | ||
24 | |||
25 | printk(KERN_INFO "PCIC --%s PCICLK:", | ||
26 | (__raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCI66) ? | ||
27 | " PCI66" : ""); | ||
28 | if (__raw_readq(&tx4927_ccfgptr->pcfg) & TX4927_PCFG_PCICLKEN_ALL) { | ||
29 | u64 ccfg = __raw_readq(&tx4927_ccfgptr->ccfg); | ||
30 | switch ((unsigned long)ccfg & | ||
31 | TX4927_CCFG_PCIDIVMODE_MASK) { | ||
32 | case TX4927_CCFG_PCIDIVMODE_2_5: | ||
33 | pciclk = txx9_cpu_clock * 2 / 5; break; | ||
34 | case TX4927_CCFG_PCIDIVMODE_3: | ||
35 | pciclk = txx9_cpu_clock / 3; break; | ||
36 | case TX4927_CCFG_PCIDIVMODE_5: | ||
37 | pciclk = txx9_cpu_clock / 5; break; | ||
38 | case TX4927_CCFG_PCIDIVMODE_6: | ||
39 | pciclk = txx9_cpu_clock / 6; break; | ||
40 | } | ||
41 | printk("Internal(%u.%uMHz)", | ||
42 | (pciclk + 50000) / 1000000, | ||
43 | ((pciclk + 50000) / 100000) % 10); | ||
44 | } else { | ||
45 | printk("External"); | ||
46 | pciclk = -1; | ||
47 | } | ||
48 | printk("\n"); | ||
49 | return pciclk; | ||
50 | } | ||
51 | |||
52 | int __init tx4927_pciclk66_setup(void) | ||
53 | { | ||
54 | int pciclk; | ||
55 | |||
56 | /* Assert M66EN */ | ||
57 | tx4927_ccfg_set(TX4927_CCFG_PCI66); | ||
58 | /* Double PCICLK (if possible) */ | ||
59 | if (__raw_readq(&tx4927_ccfgptr->pcfg) & TX4927_PCFG_PCICLKEN_ALL) { | ||
60 | unsigned int pcidivmode = 0; | ||
61 | u64 ccfg = __raw_readq(&tx4927_ccfgptr->ccfg); | ||
62 | pcidivmode = (unsigned long)ccfg & | ||
63 | TX4927_CCFG_PCIDIVMODE_MASK; | ||
64 | switch (pcidivmode) { | ||
65 | case TX4927_CCFG_PCIDIVMODE_5: | ||
66 | case TX4927_CCFG_PCIDIVMODE_2_5: | ||
67 | pcidivmode = TX4927_CCFG_PCIDIVMODE_2_5; | ||
68 | pciclk = txx9_cpu_clock * 2 / 5; | ||
69 | break; | ||
70 | case TX4927_CCFG_PCIDIVMODE_6: | ||
71 | case TX4927_CCFG_PCIDIVMODE_3: | ||
72 | default: | ||
73 | pcidivmode = TX4927_CCFG_PCIDIVMODE_3; | ||
74 | pciclk = txx9_cpu_clock / 3; | ||
75 | } | ||
76 | tx4927_ccfg_change(TX4927_CCFG_PCIDIVMODE_MASK, | ||
77 | pcidivmode); | ||
78 | printk(KERN_DEBUG "PCICLK: ccfg:%08lx\n", | ||
79 | (unsigned long)__raw_readq(&tx4927_ccfgptr->ccfg)); | ||
80 | } else | ||
81 | pciclk = -1; | ||
82 | return pciclk; | ||
83 | } | ||
diff --git a/arch/mips/pci/pci-tx4938.c b/arch/mips/pci/pci-tx4938.c new file mode 100644 index 000000000000..e5375511c2b7 --- /dev/null +++ b/arch/mips/pci/pci-tx4938.c | |||
@@ -0,0 +1,134 @@ | |||
1 | /* | ||
2 | * linux/arch/mips/pci/pci-tx4938.c | ||
3 | * | ||
4 | * Based on linux/arch/mips/txx9/rbtx4938/setup.c, | ||
5 | * and RBTX49xx patch from CELF patch archive. | ||
6 | * | ||
7 | * Copyright 2001, 2003-2005 MontaVista Software Inc. | ||
8 | * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org) | ||
9 | * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007 | ||
10 | * | ||
11 | * This file is subject to the terms and conditions of the GNU General Public | ||
12 | * License. See the file "COPYING" in the main directory of this archive | ||
13 | * for more details. | ||
14 | */ | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/pci.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <asm/txx9/generic.h> | ||
19 | #include <asm/txx9/tx4938.h> | ||
20 | |||
21 | int __init tx4938_report_pciclk(void) | ||
22 | { | ||
23 | int pciclk = 0; | ||
24 | |||
25 | printk(KERN_INFO "PCIC --%s PCICLK:", | ||
26 | (__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCI66) ? | ||
27 | " PCI66" : ""); | ||
28 | if (__raw_readq(&tx4938_ccfgptr->pcfg) & TX4938_PCFG_PCICLKEN_ALL) { | ||
29 | u64 ccfg = __raw_readq(&tx4938_ccfgptr->ccfg); | ||
30 | switch ((unsigned long)ccfg & | ||
31 | TX4938_CCFG_PCIDIVMODE_MASK) { | ||
32 | case TX4938_CCFG_PCIDIVMODE_4: | ||
33 | pciclk = txx9_cpu_clock / 4; break; | ||
34 | case TX4938_CCFG_PCIDIVMODE_4_5: | ||
35 | pciclk = txx9_cpu_clock * 2 / 9; break; | ||
36 | case TX4938_CCFG_PCIDIVMODE_5: | ||
37 | pciclk = txx9_cpu_clock / 5; break; | ||
38 | case TX4938_CCFG_PCIDIVMODE_5_5: | ||
39 | pciclk = txx9_cpu_clock * 2 / 11; break; | ||
40 | case TX4938_CCFG_PCIDIVMODE_8: | ||
41 | pciclk = txx9_cpu_clock / 8; break; | ||
42 | case TX4938_CCFG_PCIDIVMODE_9: | ||
43 | pciclk = txx9_cpu_clock / 9; break; | ||
44 | case TX4938_CCFG_PCIDIVMODE_10: | ||
45 | pciclk = txx9_cpu_clock / 10; break; | ||
46 | case TX4938_CCFG_PCIDIVMODE_11: | ||
47 | pciclk = txx9_cpu_clock / 11; break; | ||
48 | } | ||
49 | printk("Internal(%u.%uMHz)", | ||
50 | (pciclk + 50000) / 1000000, | ||
51 | ((pciclk + 50000) / 100000) % 10); | ||
52 | } else { | ||
53 | printk("External"); | ||
54 | pciclk = -1; | ||
55 | } | ||
56 | printk("\n"); | ||
57 | return pciclk; | ||
58 | } | ||
59 | |||
60 | void __init tx4938_report_pci1clk(void) | ||
61 | { | ||
62 | __u64 ccfg = __raw_readq(&tx4938_ccfgptr->ccfg); | ||
63 | unsigned int pciclk = | ||
64 | txx9_gbus_clock / ((ccfg & TX4938_CCFG_PCI1DMD) ? 4 : 2); | ||
65 | |||
66 | printk(KERN_INFO "PCIC1 -- %sPCICLK:%u.%uMHz\n", | ||
67 | (ccfg & TX4938_CCFG_PCI1_66) ? "PCI66 " : "", | ||
68 | (pciclk + 50000) / 1000000, | ||
69 | ((pciclk + 50000) / 100000) % 10); | ||
70 | } | ||
71 | |||
72 | int __init tx4938_pciclk66_setup(void) | ||
73 | { | ||
74 | int pciclk; | ||
75 | |||
76 | /* Assert M66EN */ | ||
77 | tx4938_ccfg_set(TX4938_CCFG_PCI66); | ||
78 | /* Double PCICLK (if possible) */ | ||
79 | if (__raw_readq(&tx4938_ccfgptr->pcfg) & TX4938_PCFG_PCICLKEN_ALL) { | ||
80 | unsigned int pcidivmode = 0; | ||
81 | u64 ccfg = __raw_readq(&tx4938_ccfgptr->ccfg); | ||
82 | pcidivmode = (unsigned long)ccfg & | ||
83 | TX4938_CCFG_PCIDIVMODE_MASK; | ||
84 | switch (pcidivmode) { | ||
85 | case TX4938_CCFG_PCIDIVMODE_8: | ||
86 | case TX4938_CCFG_PCIDIVMODE_4: | ||
87 | pcidivmode = TX4938_CCFG_PCIDIVMODE_4; | ||
88 | pciclk = txx9_cpu_clock / 4; | ||
89 | break; | ||
90 | case TX4938_CCFG_PCIDIVMODE_9: | ||
91 | case TX4938_CCFG_PCIDIVMODE_4_5: | ||
92 | pcidivmode = TX4938_CCFG_PCIDIVMODE_4_5; | ||
93 | pciclk = txx9_cpu_clock * 2 / 9; | ||
94 | break; | ||
95 | case TX4938_CCFG_PCIDIVMODE_10: | ||
96 | case TX4938_CCFG_PCIDIVMODE_5: | ||
97 | pcidivmode = TX4938_CCFG_PCIDIVMODE_5; | ||
98 | pciclk = txx9_cpu_clock / 5; | ||
99 | break; | ||
100 | case TX4938_CCFG_PCIDIVMODE_11: | ||
101 | case TX4938_CCFG_PCIDIVMODE_5_5: | ||
102 | default: | ||
103 | pcidivmode = TX4938_CCFG_PCIDIVMODE_5_5; | ||
104 | pciclk = txx9_cpu_clock * 2 / 11; | ||
105 | break; | ||
106 | } | ||
107 | tx4938_ccfg_change(TX4938_CCFG_PCIDIVMODE_MASK, | ||
108 | pcidivmode); | ||
109 | printk(KERN_DEBUG "PCICLK: ccfg:%08lx\n", | ||
110 | (unsigned long)__raw_readq(&tx4938_ccfgptr->ccfg)); | ||
111 | } else | ||
112 | pciclk = -1; | ||
113 | return pciclk; | ||
114 | } | ||
115 | |||
116 | int tx4938_pcic1_map_irq(const struct pci_dev *dev, u8 slot) | ||
117 | { | ||
118 | if (get_tx4927_pcicptr(dev->bus->sysdata) == tx4938_pcic1ptr) { | ||
119 | switch (slot) { | ||
120 | case TX4927_PCIC_IDSEL_AD_TO_SLOT(31): | ||
121 | if (__raw_readq(&tx4938_ccfgptr->pcfg) & | ||
122 | TX4938_PCFG_ETH0_SEL) | ||
123 | return TXX9_IRQ_BASE + TX4938_IR_ETH0; | ||
124 | break; | ||
125 | case TX4927_PCIC_IDSEL_AD_TO_SLOT(30): | ||
126 | if (__raw_readq(&tx4938_ccfgptr->pcfg) & | ||
127 | TX4938_PCFG_ETH1_SEL) | ||
128 | return TXX9_IRQ_BASE + TX4938_IR_ETH1; | ||
129 | break; | ||
130 | } | ||
131 | return 0; | ||
132 | } | ||
133 | return -1; | ||
134 | } | ||
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c index 358ad6210949..d7d6cb063d26 100644 --- a/arch/mips/pci/pci.c +++ b/arch/mips/pci/pci.c | |||
@@ -29,8 +29,7 @@ unsigned int pci_probe = PCI_ASSIGN_ALL_BUSSES; | |||
29 | * The PCI controller list. | 29 | * The PCI controller list. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | struct pci_controller *hose_head, **hose_tail = &hose_head; | 32 | static struct pci_controller *hose_head, **hose_tail = &hose_head; |
33 | struct pci_controller *pci_isa_hose; | ||
34 | 33 | ||
35 | unsigned long PCIBIOS_MIN_IO = 0x0000; | 34 | unsigned long PCIBIOS_MIN_IO = 0x0000; |
36 | unsigned long PCIBIOS_MIN_MEM = 0; | 35 | unsigned long PCIBIOS_MIN_MEM = 0; |