diff options
Diffstat (limited to 'arch/mips/pci')
-rw-r--r-- | arch/mips/pci/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/pci/ops-bcm63xx.c | 2 | ||||
-rw-r--r-- | arch/mips/pci/ops-nile4.c | 12 | ||||
-rw-r--r-- | arch/mips/pci/ops-pmcmsp.c | 12 | ||||
-rw-r--r-- | arch/mips/pci/pci-ar2315.c | 511 | ||||
-rw-r--r-- | arch/mips/pci/pci-ar71xx.c | 13 | ||||
-rw-r--r-- | arch/mips/pci/pci-ar724x.c | 23 | ||||
-rw-r--r-- | arch/mips/pci/pci-octeon.c | 2 | ||||
-rw-r--r-- | arch/mips/pci/pci-rt2880.c | 285 | ||||
-rw-r--r-- | arch/mips/pci/pci-rt3883.c | 9 | ||||
-rw-r--r-- | arch/mips/pci/pci-tx4939.c | 2 |
11 files changed, 802 insertions, 71 deletions
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile index 6523d558ff5a..300591c6278d 100644 --- a/arch/mips/pci/Makefile +++ b/arch/mips/pci/Makefile | |||
@@ -19,6 +19,7 @@ obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o | |||
19 | obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o fixup-bcm63xx.o \ | 19 | obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o fixup-bcm63xx.o \ |
20 | ops-bcm63xx.o | 20 | ops-bcm63xx.o |
21 | obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o | 21 | obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o |
22 | obj-$(CONFIG_PCI_AR2315) += pci-ar2315.o | ||
22 | obj-$(CONFIG_SOC_AR71XX) += pci-ar71xx.o | 23 | obj-$(CONFIG_SOC_AR71XX) += pci-ar71xx.o |
23 | obj-$(CONFIG_PCI_AR724X) += pci-ar724x.o | 24 | obj-$(CONFIG_PCI_AR724X) += pci-ar724x.o |
24 | obj-$(CONFIG_MIPS_PCI_VIRTIO) += pci-virtio-guest.o | 25 | obj-$(CONFIG_MIPS_PCI_VIRTIO) += pci-virtio-guest.o |
@@ -42,6 +43,7 @@ obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1480.o pci-bcm1480ht.o | |||
42 | obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o | 43 | obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o |
43 | obj-$(CONFIG_LANTIQ) += fixup-lantiq.o | 44 | obj-$(CONFIG_LANTIQ) += fixup-lantiq.o |
44 | obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o ops-lantiq.o | 45 | obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o ops-lantiq.o |
46 | obj-$(CONFIG_SOC_RT2880) += pci-rt2880.o | ||
45 | obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o | 47 | obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o |
46 | obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o | 48 | obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o |
47 | obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o | 49 | obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o |
diff --git a/arch/mips/pci/ops-bcm63xx.c b/arch/mips/pci/ops-bcm63xx.c index 13eea696bbe7..d02eb9d16b55 100644 --- a/arch/mips/pci/ops-bcm63xx.c +++ b/arch/mips/pci/ops-bcm63xx.c | |||
@@ -469,7 +469,7 @@ static int bcm63xx_pcie_can_access(struct pci_bus *bus, int devfn) | |||
469 | { | 469 | { |
470 | switch (bus->number) { | 470 | switch (bus->number) { |
471 | case PCIE_BUS_BRIDGE: | 471 | case PCIE_BUS_BRIDGE: |
472 | return (PCI_SLOT(devfn) == 0); | 472 | return PCI_SLOT(devfn) == 0; |
473 | case PCIE_BUS_DEVICE: | 473 | case PCIE_BUS_DEVICE: |
474 | if (PCI_SLOT(devfn) == 0) | 474 | if (PCI_SLOT(devfn) == 0) |
475 | return bcm_pcie_readl(PCIE_DLSTATUS_REG) | 475 | return bcm_pcie_readl(PCIE_DLSTATUS_REG) |
diff --git a/arch/mips/pci/ops-nile4.c b/arch/mips/pci/ops-nile4.c index a1a7c9f4096e..b9d1fd0ff7e2 100644 --- a/arch/mips/pci/ops-nile4.c +++ b/arch/mips/pci/ops-nile4.c | |||
@@ -13,8 +13,6 @@ | |||
13 | 13 | ||
14 | volatile unsigned long *const vrc_pciregs = (void *) Vrc5074_BASE; | 14 | volatile unsigned long *const vrc_pciregs = (void *) Vrc5074_BASE; |
15 | 15 | ||
16 | static DEFINE_SPINLOCK(nile4_pci_lock); | ||
17 | |||
18 | static int nile4_pcibios_config_access(unsigned char access_type, | 16 | static int nile4_pcibios_config_access(unsigned char access_type, |
19 | struct pci_bus *bus, unsigned int devfn, int where, u32 *val) | 17 | struct pci_bus *bus, unsigned int devfn, int where, u32 *val) |
20 | { | 18 | { |
@@ -76,7 +74,6 @@ static int nile4_pcibios_config_access(unsigned char access_type, | |||
76 | static int nile4_pcibios_read(struct pci_bus *bus, unsigned int devfn, | 74 | static int nile4_pcibios_read(struct pci_bus *bus, unsigned int devfn, |
77 | int where, int size, u32 *val) | 75 | int where, int size, u32 *val) |
78 | { | 76 | { |
79 | unsigned long flags; | ||
80 | u32 data = 0; | 77 | u32 data = 0; |
81 | int err; | 78 | int err; |
82 | 79 | ||
@@ -85,11 +82,8 @@ static int nile4_pcibios_read(struct pci_bus *bus, unsigned int devfn, | |||
85 | else if ((size == 4) && (where & 3)) | 82 | else if ((size == 4) && (where & 3)) |
86 | return PCIBIOS_BAD_REGISTER_NUMBER; | 83 | return PCIBIOS_BAD_REGISTER_NUMBER; |
87 | 84 | ||
88 | spin_lock_irqsave(&nile4_pci_lock, flags); | ||
89 | err = nile4_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where, | 85 | err = nile4_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where, |
90 | &data); | 86 | &data); |
91 | spin_unlock_irqrestore(&nile4_pci_lock, flags); | ||
92 | |||
93 | if (err) | 87 | if (err) |
94 | return err; | 88 | return err; |
95 | 89 | ||
@@ -106,7 +100,6 @@ static int nile4_pcibios_read(struct pci_bus *bus, unsigned int devfn, | |||
106 | static int nile4_pcibios_write(struct pci_bus *bus, unsigned int devfn, | 100 | static int nile4_pcibios_write(struct pci_bus *bus, unsigned int devfn, |
107 | int where, int size, u32 val) | 101 | int where, int size, u32 val) |
108 | { | 102 | { |
109 | unsigned long flags; | ||
110 | u32 data = 0; | 103 | u32 data = 0; |
111 | int err; | 104 | int err; |
112 | 105 | ||
@@ -115,11 +108,8 @@ static int nile4_pcibios_write(struct pci_bus *bus, unsigned int devfn, | |||
115 | else if ((size == 4) && (where & 3)) | 108 | else if ((size == 4) && (where & 3)) |
116 | return PCIBIOS_BAD_REGISTER_NUMBER; | 109 | return PCIBIOS_BAD_REGISTER_NUMBER; |
117 | 110 | ||
118 | spin_lock_irqsave(&nile4_pci_lock, flags); | ||
119 | err = nile4_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where, | 111 | err = nile4_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where, |
120 | &data); | 112 | &data); |
121 | spin_unlock_irqrestore(&nile4_pci_lock, flags); | ||
122 | |||
123 | if (err) | 113 | if (err) |
124 | return err; | 114 | return err; |
125 | 115 | ||
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c index 50034f985be1..dd2d9f7e9412 100644 --- a/arch/mips/pci/ops-pmcmsp.c +++ b/arch/mips/pci/ops-pmcmsp.c | |||
@@ -193,8 +193,6 @@ static void pci_proc_init(void) | |||
193 | } | 193 | } |
194 | #endif /* CONFIG_PROC_FS && PCI_COUNTERS */ | 194 | #endif /* CONFIG_PROC_FS && PCI_COUNTERS */ |
195 | 195 | ||
196 | static DEFINE_SPINLOCK(bpci_lock); | ||
197 | |||
198 | /***************************************************************************** | 196 | /***************************************************************************** |
199 | * | 197 | * |
200 | * STRUCT: pci_io_resource | 198 | * STRUCT: pci_io_resource |
@@ -368,7 +366,6 @@ int msp_pcibios_config_access(unsigned char access_type, | |||
368 | struct msp_pci_regs *preg = (void *)PCI_BASE_REG; | 366 | struct msp_pci_regs *preg = (void *)PCI_BASE_REG; |
369 | unsigned char bus_num = bus->number; | 367 | unsigned char bus_num = bus->number; |
370 | unsigned char dev_fn = (unsigned char)devfn; | 368 | unsigned char dev_fn = (unsigned char)devfn; |
371 | unsigned long flags; | ||
372 | unsigned long intr; | 369 | unsigned long intr; |
373 | unsigned long value; | 370 | unsigned long value; |
374 | static char pciirqflag; | 371 | static char pciirqflag; |
@@ -401,10 +398,7 @@ int msp_pcibios_config_access(unsigned char access_type, | |||
401 | } | 398 | } |
402 | 399 | ||
403 | #if defined(CONFIG_PMC_MSP7120_GW) || defined(CONFIG_PMC_MSP7120_EVAL) | 400 | #if defined(CONFIG_PMC_MSP7120_GW) || defined(CONFIG_PMC_MSP7120_EVAL) |
404 | local_irq_save(flags); | ||
405 | vpe_status = dvpe(); | 401 | vpe_status = dvpe(); |
406 | #else | ||
407 | spin_lock_irqsave(&bpci_lock, flags); | ||
408 | #endif | 402 | #endif |
409 | 403 | ||
410 | /* | 404 | /* |
@@ -457,9 +451,6 @@ int msp_pcibios_config_access(unsigned char access_type, | |||
457 | 451 | ||
458 | #if defined(CONFIG_PMC_MSP7120_GW) || defined(CONFIG_PMC_MSP7120_EVAL) | 452 | #if defined(CONFIG_PMC_MSP7120_GW) || defined(CONFIG_PMC_MSP7120_EVAL) |
459 | evpe(vpe_status); | 453 | evpe(vpe_status); |
460 | local_irq_restore(flags); | ||
461 | #else | ||
462 | spin_unlock_irqrestore(&bpci_lock, flags); | ||
463 | #endif | 454 | #endif |
464 | 455 | ||
465 | return -1; | 456 | return -1; |
@@ -467,9 +458,6 @@ int msp_pcibios_config_access(unsigned char access_type, | |||
467 | 458 | ||
468 | #if defined(CONFIG_PMC_MSP7120_GW) || defined(CONFIG_PMC_MSP7120_EVAL) | 459 | #if defined(CONFIG_PMC_MSP7120_GW) || defined(CONFIG_PMC_MSP7120_EVAL) |
469 | evpe(vpe_status); | 460 | evpe(vpe_status); |
470 | local_irq_restore(flags); | ||
471 | #else | ||
472 | spin_unlock_irqrestore(&bpci_lock, flags); | ||
473 | #endif | 461 | #endif |
474 | 462 | ||
475 | return PCIBIOS_SUCCESSFUL; | 463 | return PCIBIOS_SUCCESSFUL; |
diff --git a/arch/mips/pci/pci-ar2315.c b/arch/mips/pci/pci-ar2315.c new file mode 100644 index 000000000000..bd2b3b60da83 --- /dev/null +++ b/arch/mips/pci/pci-ar2315.c | |||
@@ -0,0 +1,511 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or | ||
3 | * modify it under the terms of the GNU General Public License | ||
4 | * as published by the Free Software Foundation; either version 2 | ||
5 | * of the License, or (at your option) any later version. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU General Public License for more details. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License | ||
13 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
14 | */ | ||
15 | |||
16 | /** | ||
17 | * Both AR2315 and AR2316 chips have PCI interface unit, which supports DMA | ||
18 | * and interrupt. PCI interface supports MMIO access method, but does not | ||
19 | * seem to support I/O ports. | ||
20 | * | ||
21 | * Read/write operation in the region 0x80000000-0xBFFFFFFF causes | ||
22 | * a memory read/write command on the PCI bus. 30 LSBs of address on | ||
23 | * the bus are taken from memory read/write request and 2 MSBs are | ||
24 | * determined by PCI unit configuration. | ||
25 | * | ||
26 | * To work with the configuration space instead of memory is necessary set | ||
27 | * the CFG_SEL bit in the PCI_MISC_CONFIG register. | ||
28 | * | ||
29 | * Devices on the bus can perform DMA requests via chip BAR1. PCI host | ||
30 | * controller BARs are programmend as if an external device is programmed. | ||
31 | * Which means that during configuration, IDSEL pin of the chip should be | ||
32 | * asserted. | ||
33 | * | ||
34 | * We know (and support) only one board that uses the PCI interface - | ||
35 | * Fonera 2.0g (FON2202). It has a USB EHCI controller connected to the | ||
36 | * AR2315 PCI bus. IDSEL pin of USB controller is connected to AD[13] line | ||
37 | * and IDSEL pin of AR2315 is connected to AD[16] line. | ||
38 | */ | ||
39 | |||
40 | #include <linux/types.h> | ||
41 | #include <linux/pci.h> | ||
42 | #include <linux/platform_device.h> | ||
43 | #include <linux/kernel.h> | ||
44 | #include <linux/init.h> | ||
45 | #include <linux/mm.h> | ||
46 | #include <linux/delay.h> | ||
47 | #include <linux/bitops.h> | ||
48 | #include <linux/irq.h> | ||
49 | #include <linux/irqdomain.h> | ||
50 | #include <linux/io.h> | ||
51 | #include <asm/paccess.h> | ||
52 | |||
53 | /* | ||
54 | * PCI Bus Interface Registers | ||
55 | */ | ||
56 | #define AR2315_PCI_1MS_REG 0x0008 | ||
57 | |||
58 | #define AR2315_PCI_1MS_MASK 0x3FFFF /* # of AHB clk cycles in 1ms */ | ||
59 | |||
60 | #define AR2315_PCI_MISC_CONFIG 0x000c | ||
61 | |||
62 | #define AR2315_PCIMISC_TXD_EN 0x00000001 /* Enable TXD for fragments */ | ||
63 | #define AR2315_PCIMISC_CFG_SEL 0x00000002 /* Mem or Config cycles */ | ||
64 | #define AR2315_PCIMISC_GIG_MASK 0x0000000C /* bits 31-30 for pci req */ | ||
65 | #define AR2315_PCIMISC_RST_MODE 0x00000030 | ||
66 | #define AR2315_PCIRST_INPUT 0x00000000 /* 4:5=0 rst is input */ | ||
67 | #define AR2315_PCIRST_LOW 0x00000010 /* 4:5=1 rst to GND */ | ||
68 | #define AR2315_PCIRST_HIGH 0x00000020 /* 4:5=2 rst to VDD */ | ||
69 | #define AR2315_PCIGRANT_EN 0x00000000 /* 6:7=0 early grant en */ | ||
70 | #define AR2315_PCIGRANT_FRAME 0x00000040 /* 6:7=1 grant waits 4 frame */ | ||
71 | #define AR2315_PCIGRANT_IDLE 0x00000080 /* 6:7=2 grant waits 4 idle */ | ||
72 | #define AR2315_PCIGRANT_GAP 0x00000000 /* 6:7=2 grant waits 4 idle */ | ||
73 | #define AR2315_PCICACHE_DIS 0x00001000 /* PCI external access cache | ||
74 | * disable */ | ||
75 | |||
76 | #define AR2315_PCI_OUT_TSTAMP 0x0010 | ||
77 | |||
78 | #define AR2315_PCI_UNCACHE_CFG 0x0014 | ||
79 | |||
80 | #define AR2315_PCI_IN_EN 0x0100 | ||
81 | |||
82 | #define AR2315_PCI_IN_EN0 0x01 /* Enable chain 0 */ | ||
83 | #define AR2315_PCI_IN_EN1 0x02 /* Enable chain 1 */ | ||
84 | #define AR2315_PCI_IN_EN2 0x04 /* Enable chain 2 */ | ||
85 | #define AR2315_PCI_IN_EN3 0x08 /* Enable chain 3 */ | ||
86 | |||
87 | #define AR2315_PCI_IN_DIS 0x0104 | ||
88 | |||
89 | #define AR2315_PCI_IN_DIS0 0x01 /* Disable chain 0 */ | ||
90 | #define AR2315_PCI_IN_DIS1 0x02 /* Disable chain 1 */ | ||
91 | #define AR2315_PCI_IN_DIS2 0x04 /* Disable chain 2 */ | ||
92 | #define AR2315_PCI_IN_DIS3 0x08 /* Disable chain 3 */ | ||
93 | |||
94 | #define AR2315_PCI_IN_PTR 0x0200 | ||
95 | |||
96 | #define AR2315_PCI_OUT_EN 0x0400 | ||
97 | |||
98 | #define AR2315_PCI_OUT_EN0 0x01 /* Enable chain 0 */ | ||
99 | |||
100 | #define AR2315_PCI_OUT_DIS 0x0404 | ||
101 | |||
102 | #define AR2315_PCI_OUT_DIS0 0x01 /* Disable chain 0 */ | ||
103 | |||
104 | #define AR2315_PCI_OUT_PTR 0x0408 | ||
105 | |||
106 | /* PCI interrupt status (write one to clear) */ | ||
107 | #define AR2315_PCI_ISR 0x0500 | ||
108 | |||
109 | #define AR2315_PCI_INT_TX 0x00000001 /* Desc In Completed */ | ||
110 | #define AR2315_PCI_INT_TXOK 0x00000002 /* Desc In OK */ | ||
111 | #define AR2315_PCI_INT_TXERR 0x00000004 /* Desc In ERR */ | ||
112 | #define AR2315_PCI_INT_TXEOL 0x00000008 /* Desc In End-of-List */ | ||
113 | #define AR2315_PCI_INT_RX 0x00000010 /* Desc Out Completed */ | ||
114 | #define AR2315_PCI_INT_RXOK 0x00000020 /* Desc Out OK */ | ||
115 | #define AR2315_PCI_INT_RXERR 0x00000040 /* Desc Out ERR */ | ||
116 | #define AR2315_PCI_INT_RXEOL 0x00000080 /* Desc Out EOL */ | ||
117 | #define AR2315_PCI_INT_TXOOD 0x00000200 /* Desc In Out-of-Desc */ | ||
118 | #define AR2315_PCI_INT_DESCMASK 0x0000FFFF /* Desc Mask */ | ||
119 | #define AR2315_PCI_INT_EXT 0x02000000 /* Extern PCI INTA */ | ||
120 | #define AR2315_PCI_INT_ABORT 0x04000000 /* PCI bus abort event */ | ||
121 | |||
122 | /* PCI interrupt mask */ | ||
123 | #define AR2315_PCI_IMR 0x0504 | ||
124 | |||
125 | /* Global PCI interrupt enable */ | ||
126 | #define AR2315_PCI_IER 0x0508 | ||
127 | |||
128 | #define AR2315_PCI_IER_DISABLE 0x00 /* disable pci interrupts */ | ||
129 | #define AR2315_PCI_IER_ENABLE 0x01 /* enable pci interrupts */ | ||
130 | |||
131 | #define AR2315_PCI_HOST_IN_EN 0x0800 | ||
132 | #define AR2315_PCI_HOST_IN_DIS 0x0804 | ||
133 | #define AR2315_PCI_HOST_IN_PTR 0x0810 | ||
134 | #define AR2315_PCI_HOST_OUT_EN 0x0900 | ||
135 | #define AR2315_PCI_HOST_OUT_DIS 0x0904 | ||
136 | #define AR2315_PCI_HOST_OUT_PTR 0x0908 | ||
137 | |||
138 | /* | ||
139 | * PCI interrupts, which share IP5 | ||
140 | * Keep ordered according to AR2315_PCI_INT_XXX bits | ||
141 | */ | ||
142 | #define AR2315_PCI_IRQ_EXT 25 | ||
143 | #define AR2315_PCI_IRQ_ABORT 26 | ||
144 | #define AR2315_PCI_IRQ_COUNT 27 | ||
145 | |||
146 | /* Arbitrary size of memory region to access the configuration space */ | ||
147 | #define AR2315_PCI_CFG_SIZE 0x00100000 | ||
148 | |||
149 | #define AR2315_PCI_HOST_SLOT 3 | ||
150 | #define AR2315_PCI_HOST_DEVID ((0xff18 << 16) | PCI_VENDOR_ID_ATHEROS) | ||
151 | |||
152 | /* ??? access BAR */ | ||
153 | #define AR2315_PCI_HOST_MBAR0 0x10000000 | ||
154 | /* RAM access BAR */ | ||
155 | #define AR2315_PCI_HOST_MBAR1 AR2315_PCI_HOST_SDRAM_BASEADDR | ||
156 | /* ??? access BAR */ | ||
157 | #define AR2315_PCI_HOST_MBAR2 0x30000000 | ||
158 | |||
159 | struct ar2315_pci_ctrl { | ||
160 | void __iomem *cfg_mem; | ||
161 | void __iomem *mmr_mem; | ||
162 | unsigned irq; | ||
163 | unsigned irq_ext; | ||
164 | struct irq_domain *domain; | ||
165 | struct pci_controller pci_ctrl; | ||
166 | struct resource mem_res; | ||
167 | struct resource io_res; | ||
168 | }; | ||
169 | |||
170 | static inline struct ar2315_pci_ctrl *ar2315_pci_bus_to_apc(struct pci_bus *bus) | ||
171 | { | ||
172 | struct pci_controller *hose = bus->sysdata; | ||
173 | |||
174 | return container_of(hose, struct ar2315_pci_ctrl, pci_ctrl); | ||
175 | } | ||
176 | |||
177 | static inline u32 ar2315_pci_reg_read(struct ar2315_pci_ctrl *apc, u32 reg) | ||
178 | { | ||
179 | return __raw_readl(apc->mmr_mem + reg); | ||
180 | } | ||
181 | |||
182 | static inline void ar2315_pci_reg_write(struct ar2315_pci_ctrl *apc, u32 reg, | ||
183 | u32 val) | ||
184 | { | ||
185 | __raw_writel(val, apc->mmr_mem + reg); | ||
186 | } | ||
187 | |||
188 | static inline void ar2315_pci_reg_mask(struct ar2315_pci_ctrl *apc, u32 reg, | ||
189 | u32 mask, u32 val) | ||
190 | { | ||
191 | u32 ret = ar2315_pci_reg_read(apc, reg); | ||
192 | |||
193 | ret &= ~mask; | ||
194 | ret |= val; | ||
195 | ar2315_pci_reg_write(apc, reg, ret); | ||
196 | } | ||
197 | |||
198 | static int ar2315_pci_cfg_access(struct ar2315_pci_ctrl *apc, unsigned devfn, | ||
199 | int where, int size, u32 *ptr, bool write) | ||
200 | { | ||
201 | int func = PCI_FUNC(devfn); | ||
202 | int dev = PCI_SLOT(devfn); | ||
203 | u32 addr = (1 << (13 + dev)) | (func << 8) | (where & ~3); | ||
204 | u32 mask = 0xffffffff >> 8 * (4 - size); | ||
205 | u32 sh = (where & 3) * 8; | ||
206 | u32 value, isr; | ||
207 | |||
208 | /* Prevent access past the remapped area */ | ||
209 | if (addr >= AR2315_PCI_CFG_SIZE || dev > 18) | ||
210 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
211 | |||
212 | /* Clear pending errors */ | ||
213 | ar2315_pci_reg_write(apc, AR2315_PCI_ISR, AR2315_PCI_INT_ABORT); | ||
214 | /* Select Configuration access */ | ||
215 | ar2315_pci_reg_mask(apc, AR2315_PCI_MISC_CONFIG, 0, | ||
216 | AR2315_PCIMISC_CFG_SEL); | ||
217 | |||
218 | mb(); /* PCI must see space change before we begin */ | ||
219 | |||
220 | value = __raw_readl(apc->cfg_mem + addr); | ||
221 | |||
222 | isr = ar2315_pci_reg_read(apc, AR2315_PCI_ISR); | ||
223 | |||
224 | if (isr & AR2315_PCI_INT_ABORT) | ||
225 | goto exit_err; | ||
226 | |||
227 | if (write) { | ||
228 | value = (value & ~(mask << sh)) | *ptr << sh; | ||
229 | __raw_writel(value, apc->cfg_mem + addr); | ||
230 | isr = ar2315_pci_reg_read(apc, AR2315_PCI_ISR); | ||
231 | if (isr & AR2315_PCI_INT_ABORT) | ||
232 | goto exit_err; | ||
233 | } else { | ||
234 | *ptr = (value >> sh) & mask; | ||
235 | } | ||
236 | |||
237 | goto exit; | ||
238 | |||
239 | exit_err: | ||
240 | ar2315_pci_reg_write(apc, AR2315_PCI_ISR, AR2315_PCI_INT_ABORT); | ||
241 | if (!write) | ||
242 | *ptr = 0xffffffff; | ||
243 | |||
244 | exit: | ||
245 | /* Select Memory access */ | ||
246 | ar2315_pci_reg_mask(apc, AR2315_PCI_MISC_CONFIG, AR2315_PCIMISC_CFG_SEL, | ||
247 | 0); | ||
248 | |||
249 | return isr & AR2315_PCI_INT_ABORT ? PCIBIOS_DEVICE_NOT_FOUND : | ||
250 | PCIBIOS_SUCCESSFUL; | ||
251 | } | ||
252 | |||
253 | static inline int ar2315_pci_local_cfg_rd(struct ar2315_pci_ctrl *apc, | ||
254 | unsigned devfn, int where, u32 *val) | ||
255 | { | ||
256 | return ar2315_pci_cfg_access(apc, devfn, where, sizeof(u32), val, | ||
257 | false); | ||
258 | } | ||
259 | |||
260 | static inline int ar2315_pci_local_cfg_wr(struct ar2315_pci_ctrl *apc, | ||
261 | unsigned devfn, int where, u32 val) | ||
262 | { | ||
263 | return ar2315_pci_cfg_access(apc, devfn, where, sizeof(u32), &val, | ||
264 | true); | ||
265 | } | ||
266 | |||
267 | static int ar2315_pci_cfg_read(struct pci_bus *bus, unsigned devfn, int where, | ||
268 | int size, u32 *value) | ||
269 | { | ||
270 | struct ar2315_pci_ctrl *apc = ar2315_pci_bus_to_apc(bus); | ||
271 | |||
272 | if (PCI_SLOT(devfn) == AR2315_PCI_HOST_SLOT) | ||
273 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
274 | |||
275 | return ar2315_pci_cfg_access(apc, devfn, where, size, value, false); | ||
276 | } | ||
277 | |||
278 | static int ar2315_pci_cfg_write(struct pci_bus *bus, unsigned devfn, int where, | ||
279 | int size, u32 value) | ||
280 | { | ||
281 | struct ar2315_pci_ctrl *apc = ar2315_pci_bus_to_apc(bus); | ||
282 | |||
283 | if (PCI_SLOT(devfn) == AR2315_PCI_HOST_SLOT) | ||
284 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
285 | |||
286 | return ar2315_pci_cfg_access(apc, devfn, where, size, &value, true); | ||
287 | } | ||
288 | |||
289 | static struct pci_ops ar2315_pci_ops = { | ||
290 | .read = ar2315_pci_cfg_read, | ||
291 | .write = ar2315_pci_cfg_write, | ||
292 | }; | ||
293 | |||
294 | static int ar2315_pci_host_setup(struct ar2315_pci_ctrl *apc) | ||
295 | { | ||
296 | unsigned devfn = PCI_DEVFN(AR2315_PCI_HOST_SLOT, 0); | ||
297 | int res; | ||
298 | u32 id; | ||
299 | |||
300 | res = ar2315_pci_local_cfg_rd(apc, devfn, PCI_VENDOR_ID, &id); | ||
301 | if (res != PCIBIOS_SUCCESSFUL || id != AR2315_PCI_HOST_DEVID) | ||
302 | return -ENODEV; | ||
303 | |||
304 | /* Program MBARs */ | ||
305 | ar2315_pci_local_cfg_wr(apc, devfn, PCI_BASE_ADDRESS_0, | ||
306 | AR2315_PCI_HOST_MBAR0); | ||
307 | ar2315_pci_local_cfg_wr(apc, devfn, PCI_BASE_ADDRESS_1, | ||
308 | AR2315_PCI_HOST_MBAR1); | ||
309 | ar2315_pci_local_cfg_wr(apc, devfn, PCI_BASE_ADDRESS_2, | ||
310 | AR2315_PCI_HOST_MBAR2); | ||
311 | |||
312 | /* Run */ | ||
313 | ar2315_pci_local_cfg_wr(apc, devfn, PCI_COMMAND, PCI_COMMAND_MEMORY | | ||
314 | PCI_COMMAND_MASTER | PCI_COMMAND_SPECIAL | | ||
315 | PCI_COMMAND_INVALIDATE | PCI_COMMAND_PARITY | | ||
316 | PCI_COMMAND_SERR | PCI_COMMAND_FAST_BACK); | ||
317 | |||
318 | return 0; | ||
319 | } | ||
320 | |||
321 | static void ar2315_pci_irq_handler(unsigned irq, struct irq_desc *desc) | ||
322 | { | ||
323 | struct ar2315_pci_ctrl *apc = irq_get_handler_data(irq); | ||
324 | u32 pending = ar2315_pci_reg_read(apc, AR2315_PCI_ISR) & | ||
325 | ar2315_pci_reg_read(apc, AR2315_PCI_IMR); | ||
326 | unsigned pci_irq = 0; | ||
327 | |||
328 | if (pending) | ||
329 | pci_irq = irq_find_mapping(apc->domain, __ffs(pending)); | ||
330 | |||
331 | if (pci_irq) | ||
332 | generic_handle_irq(pci_irq); | ||
333 | else | ||
334 | spurious_interrupt(); | ||
335 | } | ||
336 | |||
337 | static void ar2315_pci_irq_mask(struct irq_data *d) | ||
338 | { | ||
339 | struct ar2315_pci_ctrl *apc = irq_data_get_irq_chip_data(d); | ||
340 | |||
341 | ar2315_pci_reg_mask(apc, AR2315_PCI_IMR, BIT(d->hwirq), 0); | ||
342 | } | ||
343 | |||
344 | static void ar2315_pci_irq_mask_ack(struct irq_data *d) | ||
345 | { | ||
346 | struct ar2315_pci_ctrl *apc = irq_data_get_irq_chip_data(d); | ||
347 | u32 m = BIT(d->hwirq); | ||
348 | |||
349 | ar2315_pci_reg_mask(apc, AR2315_PCI_IMR, m, 0); | ||
350 | ar2315_pci_reg_write(apc, AR2315_PCI_ISR, m); | ||
351 | } | ||
352 | |||
353 | static void ar2315_pci_irq_unmask(struct irq_data *d) | ||
354 | { | ||
355 | struct ar2315_pci_ctrl *apc = irq_data_get_irq_chip_data(d); | ||
356 | |||
357 | ar2315_pci_reg_mask(apc, AR2315_PCI_IMR, 0, BIT(d->hwirq)); | ||
358 | } | ||
359 | |||
360 | static struct irq_chip ar2315_pci_irq_chip = { | ||
361 | .name = "AR2315-PCI", | ||
362 | .irq_mask = ar2315_pci_irq_mask, | ||
363 | .irq_mask_ack = ar2315_pci_irq_mask_ack, | ||
364 | .irq_unmask = ar2315_pci_irq_unmask, | ||
365 | }; | ||
366 | |||
367 | static int ar2315_pci_irq_map(struct irq_domain *d, unsigned irq, | ||
368 | irq_hw_number_t hw) | ||
369 | { | ||
370 | irq_set_chip_and_handler(irq, &ar2315_pci_irq_chip, handle_level_irq); | ||
371 | irq_set_chip_data(irq, d->host_data); | ||
372 | return 0; | ||
373 | } | ||
374 | |||
375 | static struct irq_domain_ops ar2315_pci_irq_domain_ops = { | ||
376 | .map = ar2315_pci_irq_map, | ||
377 | }; | ||
378 | |||
379 | static void ar2315_pci_irq_init(struct ar2315_pci_ctrl *apc) | ||
380 | { | ||
381 | ar2315_pci_reg_mask(apc, AR2315_PCI_IER, AR2315_PCI_IER_ENABLE, 0); | ||
382 | ar2315_pci_reg_mask(apc, AR2315_PCI_IMR, (AR2315_PCI_INT_ABORT | | ||
383 | AR2315_PCI_INT_EXT), 0); | ||
384 | |||
385 | apc->irq_ext = irq_create_mapping(apc->domain, AR2315_PCI_IRQ_EXT); | ||
386 | |||
387 | irq_set_chained_handler(apc->irq, ar2315_pci_irq_handler); | ||
388 | irq_set_handler_data(apc->irq, apc); | ||
389 | |||
390 | /* Clear any pending Abort or external Interrupts | ||
391 | * and enable interrupt processing */ | ||
392 | ar2315_pci_reg_write(apc, AR2315_PCI_ISR, AR2315_PCI_INT_ABORT | | ||
393 | AR2315_PCI_INT_EXT); | ||
394 | ar2315_pci_reg_mask(apc, AR2315_PCI_IER, 0, AR2315_PCI_IER_ENABLE); | ||
395 | } | ||
396 | |||
397 | static int ar2315_pci_probe(struct platform_device *pdev) | ||
398 | { | ||
399 | struct ar2315_pci_ctrl *apc; | ||
400 | struct device *dev = &pdev->dev; | ||
401 | struct resource *res; | ||
402 | int irq, err; | ||
403 | |||
404 | apc = devm_kzalloc(dev, sizeof(*apc), GFP_KERNEL); | ||
405 | if (!apc) | ||
406 | return -ENOMEM; | ||
407 | |||
408 | irq = platform_get_irq(pdev, 0); | ||
409 | if (irq < 0) | ||
410 | return -EINVAL; | ||
411 | apc->irq = irq; | ||
412 | |||
413 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | ||
414 | "ar2315-pci-ctrl"); | ||
415 | apc->mmr_mem = devm_ioremap_resource(dev, res); | ||
416 | if (IS_ERR(apc->mmr_mem)) | ||
417 | return PTR_ERR(apc->mmr_mem); | ||
418 | |||
419 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | ||
420 | "ar2315-pci-ext"); | ||
421 | if (!res) | ||
422 | return -EINVAL; | ||
423 | |||
424 | apc->mem_res.name = "AR2315 PCI mem space"; | ||
425 | apc->mem_res.parent = res; | ||
426 | apc->mem_res.start = res->start; | ||
427 | apc->mem_res.end = res->end; | ||
428 | apc->mem_res.flags = IORESOURCE_MEM; | ||
429 | |||
430 | /* Remap PCI config space */ | ||
431 | apc->cfg_mem = devm_ioremap_nocache(dev, res->start, | ||
432 | AR2315_PCI_CFG_SIZE); | ||
433 | if (!apc->cfg_mem) { | ||
434 | dev_err(dev, "failed to remap PCI config space\n"); | ||
435 | return -ENOMEM; | ||
436 | } | ||
437 | |||
438 | /* Reset the PCI bus by setting bits 5-4 in PCI_MCFG */ | ||
439 | ar2315_pci_reg_mask(apc, AR2315_PCI_MISC_CONFIG, | ||
440 | AR2315_PCIMISC_RST_MODE, | ||
441 | AR2315_PCIRST_LOW); | ||
442 | msleep(100); | ||
443 | |||
444 | /* Bring the PCI out of reset */ | ||
445 | ar2315_pci_reg_mask(apc, AR2315_PCI_MISC_CONFIG, | ||
446 | AR2315_PCIMISC_RST_MODE, | ||
447 | AR2315_PCIRST_HIGH | AR2315_PCICACHE_DIS | 0x8); | ||
448 | |||
449 | ar2315_pci_reg_write(apc, AR2315_PCI_UNCACHE_CFG, | ||
450 | 0x1E | /* 1GB uncached */ | ||
451 | (1 << 5) | /* Enable uncached */ | ||
452 | (0x2 << 30) /* Base: 0x80000000 */); | ||
453 | ar2315_pci_reg_read(apc, AR2315_PCI_UNCACHE_CFG); | ||
454 | |||
455 | msleep(500); | ||
456 | |||
457 | err = ar2315_pci_host_setup(apc); | ||
458 | if (err) | ||
459 | return err; | ||
460 | |||
461 | apc->domain = irq_domain_add_linear(NULL, AR2315_PCI_IRQ_COUNT, | ||
462 | &ar2315_pci_irq_domain_ops, apc); | ||
463 | if (!apc->domain) { | ||
464 | dev_err(dev, "failed to add IRQ domain\n"); | ||
465 | return -ENOMEM; | ||
466 | } | ||
467 | |||
468 | ar2315_pci_irq_init(apc); | ||
469 | |||
470 | /* PCI controller does not support I/O ports */ | ||
471 | apc->io_res.name = "AR2315 IO space"; | ||
472 | apc->io_res.start = 0; | ||
473 | apc->io_res.end = 0; | ||
474 | apc->io_res.flags = IORESOURCE_IO, | ||
475 | |||
476 | apc->pci_ctrl.pci_ops = &ar2315_pci_ops; | ||
477 | apc->pci_ctrl.mem_resource = &apc->mem_res, | ||
478 | apc->pci_ctrl.io_resource = &apc->io_res, | ||
479 | |||
480 | register_pci_controller(&apc->pci_ctrl); | ||
481 | |||
482 | dev_info(dev, "register PCI controller\n"); | ||
483 | |||
484 | return 0; | ||
485 | } | ||
486 | |||
487 | static struct platform_driver ar2315_pci_driver = { | ||
488 | .probe = ar2315_pci_probe, | ||
489 | .driver = { | ||
490 | .name = "ar2315-pci", | ||
491 | .owner = THIS_MODULE, | ||
492 | }, | ||
493 | }; | ||
494 | |||
495 | static int __init ar2315_pci_init(void) | ||
496 | { | ||
497 | return platform_driver_register(&ar2315_pci_driver); | ||
498 | } | ||
499 | arch_initcall(ar2315_pci_init); | ||
500 | |||
501 | int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
502 | { | ||
503 | struct ar2315_pci_ctrl *apc = ar2315_pci_bus_to_apc(dev->bus); | ||
504 | |||
505 | return slot ? 0 : apc->irq_ext; | ||
506 | } | ||
507 | |||
508 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
509 | { | ||
510 | return 0; | ||
511 | } | ||
diff --git a/arch/mips/pci/pci-ar71xx.c b/arch/mips/pci/pci-ar71xx.c index d471a26dd5f8..2b534aea20e4 100644 --- a/arch/mips/pci/pci-ar71xx.c +++ b/arch/mips/pci/pci-ar71xx.c | |||
@@ -50,7 +50,6 @@ | |||
50 | 50 | ||
51 | struct ar71xx_pci_controller { | 51 | struct ar71xx_pci_controller { |
52 | void __iomem *cfg_base; | 52 | void __iomem *cfg_base; |
53 | spinlock_t lock; | ||
54 | int irq; | 53 | int irq; |
55 | int irq_base; | 54 | int irq_base; |
56 | struct pci_controller pci_ctrl; | 55 | struct pci_controller pci_ctrl; |
@@ -182,7 +181,6 @@ static int ar71xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, | |||
182 | { | 181 | { |
183 | struct ar71xx_pci_controller *apc = pci_bus_to_ar71xx_controller(bus); | 182 | struct ar71xx_pci_controller *apc = pci_bus_to_ar71xx_controller(bus); |
184 | void __iomem *base = apc->cfg_base; | 183 | void __iomem *base = apc->cfg_base; |
185 | unsigned long flags; | ||
186 | u32 data; | 184 | u32 data; |
187 | int err; | 185 | int err; |
188 | int ret; | 186 | int ret; |
@@ -190,8 +188,6 @@ static int ar71xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, | |||
190 | ret = PCIBIOS_SUCCESSFUL; | 188 | ret = PCIBIOS_SUCCESSFUL; |
191 | data = ~0; | 189 | data = ~0; |
192 | 190 | ||
193 | spin_lock_irqsave(&apc->lock, flags); | ||
194 | |||
195 | err = ar71xx_pci_set_cfgaddr(bus, devfn, where, size, | 191 | err = ar71xx_pci_set_cfgaddr(bus, devfn, where, size, |
196 | AR71XX_PCI_CFG_CMD_READ); | 192 | AR71XX_PCI_CFG_CMD_READ); |
197 | if (err) | 193 | if (err) |
@@ -199,8 +195,6 @@ static int ar71xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, | |||
199 | else | 195 | else |
200 | data = __raw_readl(base + AR71XX_PCI_REG_CFG_RDDATA); | 196 | data = __raw_readl(base + AR71XX_PCI_REG_CFG_RDDATA); |
201 | 197 | ||
202 | spin_unlock_irqrestore(&apc->lock, flags); | ||
203 | |||
204 | *value = (data >> (8 * (where & 3))) & ar71xx_pci_read_mask[size & 7]; | 198 | *value = (data >> (8 * (where & 3))) & ar71xx_pci_read_mask[size & 7]; |
205 | 199 | ||
206 | return ret; | 200 | return ret; |
@@ -211,15 +205,12 @@ static int ar71xx_pci_write_config(struct pci_bus *bus, unsigned int devfn, | |||
211 | { | 205 | { |
212 | struct ar71xx_pci_controller *apc = pci_bus_to_ar71xx_controller(bus); | 206 | struct ar71xx_pci_controller *apc = pci_bus_to_ar71xx_controller(bus); |
213 | void __iomem *base = apc->cfg_base; | 207 | void __iomem *base = apc->cfg_base; |
214 | unsigned long flags; | ||
215 | int err; | 208 | int err; |
216 | int ret; | 209 | int ret; |
217 | 210 | ||
218 | value = value << (8 * (where & 3)); | 211 | value = value << (8 * (where & 3)); |
219 | ret = PCIBIOS_SUCCESSFUL; | 212 | ret = PCIBIOS_SUCCESSFUL; |
220 | 213 | ||
221 | spin_lock_irqsave(&apc->lock, flags); | ||
222 | |||
223 | err = ar71xx_pci_set_cfgaddr(bus, devfn, where, size, | 214 | err = ar71xx_pci_set_cfgaddr(bus, devfn, where, size, |
224 | AR71XX_PCI_CFG_CMD_WRITE); | 215 | AR71XX_PCI_CFG_CMD_WRITE); |
225 | if (err) | 216 | if (err) |
@@ -227,8 +218,6 @@ static int ar71xx_pci_write_config(struct pci_bus *bus, unsigned int devfn, | |||
227 | else | 218 | else |
228 | __raw_writel(value, base + AR71XX_PCI_REG_CFG_WRDATA); | 219 | __raw_writel(value, base + AR71XX_PCI_REG_CFG_WRDATA); |
229 | 220 | ||
230 | spin_unlock_irqrestore(&apc->lock, flags); | ||
231 | |||
232 | return ret; | 221 | return ret; |
233 | } | 222 | } |
234 | 223 | ||
@@ -360,8 +349,6 @@ static int ar71xx_pci_probe(struct platform_device *pdev) | |||
360 | if (!apc) | 349 | if (!apc) |
361 | return -ENOMEM; | 350 | return -ENOMEM; |
362 | 351 | ||
363 | spin_lock_init(&apc->lock); | ||
364 | |||
365 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base"); | 352 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base"); |
366 | apc->cfg_base = devm_ioremap_resource(&pdev->dev, res); | 353 | apc->cfg_base = devm_ioremap_resource(&pdev->dev, res); |
367 | if (IS_ERR(apc->cfg_base)) | 354 | if (IS_ERR(apc->cfg_base)) |
diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c index 785b2659b519..b7a6fcbb8852 100644 --- a/arch/mips/pci/pci-ar724x.c +++ b/arch/mips/pci/pci-ar724x.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * by the Free Software Foundation. | 9 | * by the Free Software Foundation. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/spinlock.h> | ||
13 | #include <linux/irq.h> | 12 | #include <linux/irq.h> |
14 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
15 | #include <linux/module.h> | 14 | #include <linux/module.h> |
@@ -48,8 +47,6 @@ struct ar724x_pci_controller { | |||
48 | bool bar0_is_cached; | 47 | bool bar0_is_cached; |
49 | u32 bar0_value; | 48 | u32 bar0_value; |
50 | 49 | ||
51 | spinlock_t lock; | ||
52 | |||
53 | struct pci_controller pci_controller; | 50 | struct pci_controller pci_controller; |
54 | struct resource io_res; | 51 | struct resource io_res; |
55 | struct resource mem_res; | 52 | struct resource mem_res; |
@@ -75,7 +72,6 @@ pci_bus_to_ar724x_controller(struct pci_bus *bus) | |||
75 | static int ar724x_pci_local_write(struct ar724x_pci_controller *apc, | 72 | static int ar724x_pci_local_write(struct ar724x_pci_controller *apc, |
76 | int where, int size, u32 value) | 73 | int where, int size, u32 value) |
77 | { | 74 | { |
78 | unsigned long flags; | ||
79 | void __iomem *base; | 75 | void __iomem *base; |
80 | u32 data; | 76 | u32 data; |
81 | int s; | 77 | int s; |
@@ -86,8 +82,6 @@ static int ar724x_pci_local_write(struct ar724x_pci_controller *apc, | |||
86 | return PCIBIOS_DEVICE_NOT_FOUND; | 82 | return PCIBIOS_DEVICE_NOT_FOUND; |
87 | 83 | ||
88 | base = apc->crp_base; | 84 | base = apc->crp_base; |
89 | |||
90 | spin_lock_irqsave(&apc->lock, flags); | ||
91 | data = __raw_readl(base + (where & ~3)); | 85 | data = __raw_readl(base + (where & ~3)); |
92 | 86 | ||
93 | switch (size) { | 87 | switch (size) { |
@@ -105,14 +99,12 @@ static int ar724x_pci_local_write(struct ar724x_pci_controller *apc, | |||
105 | data = value; | 99 | data = value; |
106 | break; | 100 | break; |
107 | default: | 101 | default: |
108 | spin_unlock_irqrestore(&apc->lock, flags); | ||
109 | return PCIBIOS_BAD_REGISTER_NUMBER; | 102 | return PCIBIOS_BAD_REGISTER_NUMBER; |
110 | } | 103 | } |
111 | 104 | ||
112 | __raw_writel(data, base + (where & ~3)); | 105 | __raw_writel(data, base + (where & ~3)); |
113 | /* flush write */ | 106 | /* flush write */ |
114 | __raw_readl(base + (where & ~3)); | 107 | __raw_readl(base + (where & ~3)); |
115 | spin_unlock_irqrestore(&apc->lock, flags); | ||
116 | 108 | ||
117 | return PCIBIOS_SUCCESSFUL; | 109 | return PCIBIOS_SUCCESSFUL; |
118 | } | 110 | } |
@@ -121,7 +113,6 @@ static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where, | |||
121 | int size, uint32_t *value) | 113 | int size, uint32_t *value) |
122 | { | 114 | { |
123 | struct ar724x_pci_controller *apc; | 115 | struct ar724x_pci_controller *apc; |
124 | unsigned long flags; | ||
125 | void __iomem *base; | 116 | void __iomem *base; |
126 | u32 data; | 117 | u32 data; |
127 | 118 | ||
@@ -133,8 +124,6 @@ static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where, | |||
133 | return PCIBIOS_DEVICE_NOT_FOUND; | 124 | return PCIBIOS_DEVICE_NOT_FOUND; |
134 | 125 | ||
135 | base = apc->devcfg_base; | 126 | base = apc->devcfg_base; |
136 | |||
137 | spin_lock_irqsave(&apc->lock, flags); | ||
138 | data = __raw_readl(base + (where & ~3)); | 127 | data = __raw_readl(base + (where & ~3)); |
139 | 128 | ||
140 | switch (size) { | 129 | switch (size) { |
@@ -153,13 +142,9 @@ static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where, | |||
153 | case 4: | 142 | case 4: |
154 | break; | 143 | break; |
155 | default: | 144 | default: |
156 | spin_unlock_irqrestore(&apc->lock, flags); | ||
157 | |||
158 | return PCIBIOS_BAD_REGISTER_NUMBER; | 145 | return PCIBIOS_BAD_REGISTER_NUMBER; |
159 | } | 146 | } |
160 | 147 | ||
161 | spin_unlock_irqrestore(&apc->lock, flags); | ||
162 | |||
163 | if (where == PCI_BASE_ADDRESS_0 && size == 4 && | 148 | if (where == PCI_BASE_ADDRESS_0 && size == 4 && |
164 | apc->bar0_is_cached) { | 149 | apc->bar0_is_cached) { |
165 | /* use the cached value */ | 150 | /* use the cached value */ |
@@ -175,7 +160,6 @@ static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where, | |||
175 | int size, uint32_t value) | 160 | int size, uint32_t value) |
176 | { | 161 | { |
177 | struct ar724x_pci_controller *apc; | 162 | struct ar724x_pci_controller *apc; |
178 | unsigned long flags; | ||
179 | void __iomem *base; | 163 | void __iomem *base; |
180 | u32 data; | 164 | u32 data; |
181 | int s; | 165 | int s; |
@@ -209,8 +193,6 @@ static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where, | |||
209 | } | 193 | } |
210 | 194 | ||
211 | base = apc->devcfg_base; | 195 | base = apc->devcfg_base; |
212 | |||
213 | spin_lock_irqsave(&apc->lock, flags); | ||
214 | data = __raw_readl(base + (where & ~3)); | 196 | data = __raw_readl(base + (where & ~3)); |
215 | 197 | ||
216 | switch (size) { | 198 | switch (size) { |
@@ -228,15 +210,12 @@ static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where, | |||
228 | data = value; | 210 | data = value; |
229 | break; | 211 | break; |
230 | default: | 212 | default: |
231 | spin_unlock_irqrestore(&apc->lock, flags); | ||
232 | |||
233 | return PCIBIOS_BAD_REGISTER_NUMBER; | 213 | return PCIBIOS_BAD_REGISTER_NUMBER; |
234 | } | 214 | } |
235 | 215 | ||
236 | __raw_writel(data, base + (where & ~3)); | 216 | __raw_writel(data, base + (where & ~3)); |
237 | /* flush write */ | 217 | /* flush write */ |
238 | __raw_readl(base + (where & ~3)); | 218 | __raw_readl(base + (where & ~3)); |
239 | spin_unlock_irqrestore(&apc->lock, flags); | ||
240 | 219 | ||
241 | return PCIBIOS_SUCCESSFUL; | 220 | return PCIBIOS_SUCCESSFUL; |
242 | } | 221 | } |
@@ -380,8 +359,6 @@ static int ar724x_pci_probe(struct platform_device *pdev) | |||
380 | if (apc->irq < 0) | 359 | if (apc->irq < 0) |
381 | return -EINVAL; | 360 | return -EINVAL; |
382 | 361 | ||
383 | spin_lock_init(&apc->lock); | ||
384 | |||
385 | res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base"); | 362 | res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base"); |
386 | if (!res) | 363 | if (!res) |
387 | return -EINVAL; | 364 | return -EINVAL; |
diff --git a/arch/mips/pci/pci-octeon.c b/arch/mips/pci/pci-octeon.c index 59cccd95688b..d07e04121cc6 100644 --- a/arch/mips/pci/pci-octeon.c +++ b/arch/mips/pci/pci-octeon.c | |||
@@ -708,7 +708,7 @@ static int __init octeon_pci_setup(void) | |||
708 | 708 | ||
709 | if (IS_ERR(platform_device_register_simple("octeon_pci_edac", | 709 | if (IS_ERR(platform_device_register_simple("octeon_pci_edac", |
710 | -1, NULL, 0))) | 710 | -1, NULL, 0))) |
711 | pr_err("Registation of co_pci_edac failed!\n"); | 711 | pr_err("Registration of co_pci_edac failed!\n"); |
712 | 712 | ||
713 | octeon_pci_dma_init(); | 713 | octeon_pci_dma_init(); |
714 | 714 | ||
diff --git a/arch/mips/pci/pci-rt2880.c b/arch/mips/pci/pci-rt2880.c new file mode 100644 index 000000000000..a4574947e698 --- /dev/null +++ b/arch/mips/pci/pci-rt2880.c | |||
@@ -0,0 +1,285 @@ | |||
1 | /* | ||
2 | * Ralink RT288x SoC PCI register definitions | ||
3 | * | ||
4 | * Copyright (C) 2009 John Crispin <blogic@openwrt.org> | ||
5 | * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org> | ||
6 | * | ||
7 | * Parts of this file are based on Ralink's 2.6.21 BSP | ||
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 version 2 as published | ||
11 | * by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | #include <linux/pci.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/of_platform.h> | ||
20 | #include <linux/of_irq.h> | ||
21 | #include <linux/of_pci.h> | ||
22 | |||
23 | #include <asm/mach-ralink/rt288x.h> | ||
24 | |||
25 | #define RT2880_PCI_BASE 0x00440000 | ||
26 | #define RT288X_CPU_IRQ_PCI 4 | ||
27 | |||
28 | #define RT2880_PCI_MEM_BASE 0x20000000 | ||
29 | #define RT2880_PCI_MEM_SIZE 0x10000000 | ||
30 | #define RT2880_PCI_IO_BASE 0x00460000 | ||
31 | #define RT2880_PCI_IO_SIZE 0x00010000 | ||
32 | |||
33 | #define RT2880_PCI_REG_PCICFG_ADDR 0x00 | ||
34 | #define RT2880_PCI_REG_PCIMSK_ADDR 0x0c | ||
35 | #define RT2880_PCI_REG_BAR0SETUP_ADDR 0x10 | ||
36 | #define RT2880_PCI_REG_IMBASEBAR0_ADDR 0x18 | ||
37 | #define RT2880_PCI_REG_CONFIG_ADDR 0x20 | ||
38 | #define RT2880_PCI_REG_CONFIG_DATA 0x24 | ||
39 | #define RT2880_PCI_REG_MEMBASE 0x28 | ||
40 | #define RT2880_PCI_REG_IOBASE 0x2c | ||
41 | #define RT2880_PCI_REG_ID 0x30 | ||
42 | #define RT2880_PCI_REG_CLASS 0x34 | ||
43 | #define RT2880_PCI_REG_SUBID 0x38 | ||
44 | #define RT2880_PCI_REG_ARBCTL 0x80 | ||
45 | |||
46 | static void __iomem *rt2880_pci_base; | ||
47 | static DEFINE_SPINLOCK(rt2880_pci_lock); | ||
48 | |||
49 | static u32 rt2880_pci_reg_read(u32 reg) | ||
50 | { | ||
51 | return readl(rt2880_pci_base + reg); | ||
52 | } | ||
53 | |||
54 | static void rt2880_pci_reg_write(u32 val, u32 reg) | ||
55 | { | ||
56 | writel(val, rt2880_pci_base + reg); | ||
57 | } | ||
58 | |||
59 | static inline u32 rt2880_pci_get_cfgaddr(unsigned int bus, unsigned int slot, | ||
60 | unsigned int func, unsigned int where) | ||
61 | { | ||
62 | return ((bus << 16) | (slot << 11) | (func << 8) | (where & 0xfc) | | ||
63 | 0x80000000); | ||
64 | } | ||
65 | |||
66 | static int rt2880_pci_config_read(struct pci_bus *bus, unsigned int devfn, | ||
67 | int where, int size, u32 *val) | ||
68 | { | ||
69 | unsigned long flags; | ||
70 | u32 address; | ||
71 | u32 data; | ||
72 | |||
73 | address = rt2880_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), | ||
74 | PCI_FUNC(devfn), where); | ||
75 | |||
76 | spin_lock_irqsave(&rt2880_pci_lock, flags); | ||
77 | rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); | ||
78 | data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA); | ||
79 | spin_unlock_irqrestore(&rt2880_pci_lock, flags); | ||
80 | |||
81 | switch (size) { | ||
82 | case 1: | ||
83 | *val = (data >> ((where & 3) << 3)) & 0xff; | ||
84 | break; | ||
85 | case 2: | ||
86 | *val = (data >> ((where & 3) << 3)) & 0xffff; | ||
87 | break; | ||
88 | case 4: | ||
89 | *val = data; | ||
90 | break; | ||
91 | } | ||
92 | |||
93 | return PCIBIOS_SUCCESSFUL; | ||
94 | } | ||
95 | |||
96 | static int rt2880_pci_config_write(struct pci_bus *bus, unsigned int devfn, | ||
97 | int where, int size, u32 val) | ||
98 | { | ||
99 | unsigned long flags; | ||
100 | u32 address; | ||
101 | u32 data; | ||
102 | |||
103 | address = rt2880_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), | ||
104 | PCI_FUNC(devfn), where); | ||
105 | |||
106 | spin_lock_irqsave(&rt2880_pci_lock, flags); | ||
107 | rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); | ||
108 | data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA); | ||
109 | |||
110 | switch (size) { | ||
111 | case 1: | ||
112 | data = (data & ~(0xff << ((where & 3) << 3))) | | ||
113 | (val << ((where & 3) << 3)); | ||
114 | break; | ||
115 | case 2: | ||
116 | data = (data & ~(0xffff << ((where & 3) << 3))) | | ||
117 | (val << ((where & 3) << 3)); | ||
118 | break; | ||
119 | case 4: | ||
120 | data = val; | ||
121 | break; | ||
122 | } | ||
123 | |||
124 | rt2880_pci_reg_write(data, RT2880_PCI_REG_CONFIG_DATA); | ||
125 | spin_unlock_irqrestore(&rt2880_pci_lock, flags); | ||
126 | |||
127 | return PCIBIOS_SUCCESSFUL; | ||
128 | } | ||
129 | |||
130 | static struct pci_ops rt2880_pci_ops = { | ||
131 | .read = rt2880_pci_config_read, | ||
132 | .write = rt2880_pci_config_write, | ||
133 | }; | ||
134 | |||
135 | static struct resource rt2880_pci_mem_resource = { | ||
136 | .name = "PCI MEM space", | ||
137 | .start = RT2880_PCI_MEM_BASE, | ||
138 | .end = RT2880_PCI_MEM_BASE + RT2880_PCI_MEM_SIZE - 1, | ||
139 | .flags = IORESOURCE_MEM, | ||
140 | }; | ||
141 | |||
142 | static struct resource rt2880_pci_io_resource = { | ||
143 | .name = "PCI IO space", | ||
144 | .start = RT2880_PCI_IO_BASE, | ||
145 | .end = RT2880_PCI_IO_BASE + RT2880_PCI_IO_SIZE - 1, | ||
146 | .flags = IORESOURCE_IO, | ||
147 | }; | ||
148 | |||
149 | static struct pci_controller rt2880_pci_controller = { | ||
150 | .pci_ops = &rt2880_pci_ops, | ||
151 | .mem_resource = &rt2880_pci_mem_resource, | ||
152 | .io_resource = &rt2880_pci_io_resource, | ||
153 | }; | ||
154 | |||
155 | static inline u32 rt2880_pci_read_u32(unsigned long reg) | ||
156 | { | ||
157 | unsigned long flags; | ||
158 | u32 address; | ||
159 | u32 ret; | ||
160 | |||
161 | address = rt2880_pci_get_cfgaddr(0, 0, 0, reg); | ||
162 | |||
163 | spin_lock_irqsave(&rt2880_pci_lock, flags); | ||
164 | rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); | ||
165 | ret = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA); | ||
166 | spin_unlock_irqrestore(&rt2880_pci_lock, flags); | ||
167 | |||
168 | return ret; | ||
169 | } | ||
170 | |||
171 | static inline void rt2880_pci_write_u32(unsigned long reg, u32 val) | ||
172 | { | ||
173 | unsigned long flags; | ||
174 | u32 address; | ||
175 | |||
176 | address = rt2880_pci_get_cfgaddr(0, 0, 0, reg); | ||
177 | |||
178 | spin_lock_irqsave(&rt2880_pci_lock, flags); | ||
179 | rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); | ||
180 | rt2880_pci_reg_write(val, RT2880_PCI_REG_CONFIG_DATA); | ||
181 | spin_unlock_irqrestore(&rt2880_pci_lock, flags); | ||
182 | } | ||
183 | |||
184 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
185 | { | ||
186 | u16 cmd; | ||
187 | int irq = -1; | ||
188 | |||
189 | if (dev->bus->number != 0) | ||
190 | return irq; | ||
191 | |||
192 | switch (PCI_SLOT(dev->devfn)) { | ||
193 | case 0x00: | ||
194 | rt2880_pci_write_u32(PCI_BASE_ADDRESS_0, 0x08000000); | ||
195 | (void) rt2880_pci_read_u32(PCI_BASE_ADDRESS_0); | ||
196 | break; | ||
197 | case 0x11: | ||
198 | irq = RT288X_CPU_IRQ_PCI; | ||
199 | break; | ||
200 | default: | ||
201 | pr_err("%s:%s[%d] trying to alloc unknown pci irq\n", | ||
202 | __FILE__, __func__, __LINE__); | ||
203 | BUG(); | ||
204 | break; | ||
205 | } | ||
206 | |||
207 | pci_write_config_byte((struct pci_dev *) dev, | ||
208 | PCI_CACHE_LINE_SIZE, 0x14); | ||
209 | pci_write_config_byte((struct pci_dev *) dev, PCI_LATENCY_TIMER, 0xFF); | ||
210 | pci_read_config_word((struct pci_dev *) dev, PCI_COMMAND, &cmd); | ||
211 | cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | | ||
212 | PCI_COMMAND_INVALIDATE | PCI_COMMAND_FAST_BACK | | ||
213 | PCI_COMMAND_SERR | PCI_COMMAND_WAIT | PCI_COMMAND_PARITY; | ||
214 | pci_write_config_word((struct pci_dev *) dev, PCI_COMMAND, cmd); | ||
215 | pci_write_config_byte((struct pci_dev *) dev, PCI_INTERRUPT_LINE, | ||
216 | dev->irq); | ||
217 | return irq; | ||
218 | } | ||
219 | |||
220 | static int rt288x_pci_probe(struct platform_device *pdev) | ||
221 | { | ||
222 | void __iomem *io_map_base; | ||
223 | int i; | ||
224 | |||
225 | rt2880_pci_base = ioremap_nocache(RT2880_PCI_BASE, PAGE_SIZE); | ||
226 | |||
227 | io_map_base = ioremap(RT2880_PCI_IO_BASE, RT2880_PCI_IO_SIZE); | ||
228 | rt2880_pci_controller.io_map_base = (unsigned long) io_map_base; | ||
229 | set_io_port_base((unsigned long) io_map_base); | ||
230 | |||
231 | ioport_resource.start = RT2880_PCI_IO_BASE; | ||
232 | ioport_resource.end = RT2880_PCI_IO_BASE + RT2880_PCI_IO_SIZE - 1; | ||
233 | |||
234 | rt2880_pci_reg_write(0, RT2880_PCI_REG_PCICFG_ADDR); | ||
235 | for (i = 0; i < 0xfffff; i++) | ||
236 | ; | ||
237 | |||
238 | rt2880_pci_reg_write(0x79, RT2880_PCI_REG_ARBCTL); | ||
239 | rt2880_pci_reg_write(0x07FF0001, RT2880_PCI_REG_BAR0SETUP_ADDR); | ||
240 | rt2880_pci_reg_write(RT2880_PCI_MEM_BASE, RT2880_PCI_REG_MEMBASE); | ||
241 | rt2880_pci_reg_write(RT2880_PCI_IO_BASE, RT2880_PCI_REG_IOBASE); | ||
242 | rt2880_pci_reg_write(0x08000000, RT2880_PCI_REG_IMBASEBAR0_ADDR); | ||
243 | rt2880_pci_reg_write(0x08021814, RT2880_PCI_REG_ID); | ||
244 | rt2880_pci_reg_write(0x00800001, RT2880_PCI_REG_CLASS); | ||
245 | rt2880_pci_reg_write(0x28801814, RT2880_PCI_REG_SUBID); | ||
246 | rt2880_pci_reg_write(0x000c0000, RT2880_PCI_REG_PCIMSK_ADDR); | ||
247 | |||
248 | rt2880_pci_write_u32(PCI_BASE_ADDRESS_0, 0x08000000); | ||
249 | (void) rt2880_pci_read_u32(PCI_BASE_ADDRESS_0); | ||
250 | |||
251 | register_pci_controller(&rt2880_pci_controller); | ||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
256 | { | ||
257 | return 0; | ||
258 | } | ||
259 | |||
260 | static const struct of_device_id rt288x_pci_match[] = { | ||
261 | { .compatible = "ralink,rt288x-pci" }, | ||
262 | {}, | ||
263 | }; | ||
264 | MODULE_DEVICE_TABLE(of, rt288x_pci_match); | ||
265 | |||
266 | static struct platform_driver rt288x_pci_driver = { | ||
267 | .probe = rt288x_pci_probe, | ||
268 | .driver = { | ||
269 | .name = "rt288x-pci", | ||
270 | .owner = THIS_MODULE, | ||
271 | .of_match_table = rt288x_pci_match, | ||
272 | }, | ||
273 | }; | ||
274 | |||
275 | int __init pcibios_init(void) | ||
276 | { | ||
277 | int ret = platform_driver_register(&rt288x_pci_driver); | ||
278 | |||
279 | if (ret) | ||
280 | pr_info("rt288x-pci: Error registering platform driver!"); | ||
281 | |||
282 | return ret; | ||
283 | } | ||
284 | |||
285 | arch_initcall(pcibios_init); | ||
diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c index 72919aeef42b..0bcc0b1cfddc 100644 --- a/arch/mips/pci/pci-rt3883.c +++ b/arch/mips/pci/pci-rt3883.c | |||
@@ -61,7 +61,6 @@ | |||
61 | 61 | ||
62 | struct rt3883_pci_controller { | 62 | struct rt3883_pci_controller { |
63 | void __iomem *base; | 63 | void __iomem *base; |
64 | spinlock_t lock; | ||
65 | 64 | ||
66 | struct device_node *intc_of_node; | 65 | struct device_node *intc_of_node; |
67 | struct irq_domain *irq_domain; | 66 | struct irq_domain *irq_domain; |
@@ -111,10 +110,8 @@ static u32 rt3883_pci_read_cfg32(struct rt3883_pci_controller *rpc, | |||
111 | 110 | ||
112 | address = rt3883_pci_get_cfgaddr(bus, slot, func, reg); | 111 | address = rt3883_pci_get_cfgaddr(bus, slot, func, reg); |
113 | 112 | ||
114 | spin_lock_irqsave(&rpc->lock, flags); | ||
115 | rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR); | 113 | rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR); |
116 | ret = rt3883_pci_r32(rpc, RT3883_PCI_REG_CFGDATA); | 114 | ret = rt3883_pci_r32(rpc, RT3883_PCI_REG_CFGDATA); |
117 | spin_unlock_irqrestore(&rpc->lock, flags); | ||
118 | 115 | ||
119 | return ret; | 116 | return ret; |
120 | } | 117 | } |
@@ -128,10 +125,8 @@ static void rt3883_pci_write_cfg32(struct rt3883_pci_controller *rpc, | |||
128 | 125 | ||
129 | address = rt3883_pci_get_cfgaddr(bus, slot, func, reg); | 126 | address = rt3883_pci_get_cfgaddr(bus, slot, func, reg); |
130 | 127 | ||
131 | spin_lock_irqsave(&rpc->lock, flags); | ||
132 | rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR); | 128 | rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR); |
133 | rt3883_pci_w32(rpc, val, RT3883_PCI_REG_CFGDATA); | 129 | rt3883_pci_w32(rpc, val, RT3883_PCI_REG_CFGDATA); |
134 | spin_unlock_irqrestore(&rpc->lock, flags); | ||
135 | } | 130 | } |
136 | 131 | ||
137 | static void rt3883_pci_irq_handler(unsigned int irq, struct irq_desc *desc) | 132 | static void rt3883_pci_irq_handler(unsigned int irq, struct irq_desc *desc) |
@@ -252,10 +247,8 @@ static int rt3883_pci_config_read(struct pci_bus *bus, unsigned int devfn, | |||
252 | address = rt3883_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), | 247 | address = rt3883_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), |
253 | PCI_FUNC(devfn), where); | 248 | PCI_FUNC(devfn), where); |
254 | 249 | ||
255 | spin_lock_irqsave(&rpc->lock, flags); | ||
256 | rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR); | 250 | rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR); |
257 | data = rt3883_pci_r32(rpc, RT3883_PCI_REG_CFGDATA); | 251 | data = rt3883_pci_r32(rpc, RT3883_PCI_REG_CFGDATA); |
258 | spin_unlock_irqrestore(&rpc->lock, flags); | ||
259 | 252 | ||
260 | switch (size) { | 253 | switch (size) { |
261 | case 1: | 254 | case 1: |
@@ -288,7 +281,6 @@ static int rt3883_pci_config_write(struct pci_bus *bus, unsigned int devfn, | |||
288 | address = rt3883_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), | 281 | address = rt3883_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), |
289 | PCI_FUNC(devfn), where); | 282 | PCI_FUNC(devfn), where); |
290 | 283 | ||
291 | spin_lock_irqsave(&rpc->lock, flags); | ||
292 | rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR); | 284 | rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR); |
293 | data = rt3883_pci_r32(rpc, RT3883_PCI_REG_CFGDATA); | 285 | data = rt3883_pci_r32(rpc, RT3883_PCI_REG_CFGDATA); |
294 | 286 | ||
@@ -307,7 +299,6 @@ static int rt3883_pci_config_write(struct pci_bus *bus, unsigned int devfn, | |||
307 | } | 299 | } |
308 | 300 | ||
309 | rt3883_pci_w32(rpc, data, RT3883_PCI_REG_CFGDATA); | 301 | rt3883_pci_w32(rpc, data, RT3883_PCI_REG_CFGDATA); |
310 | spin_unlock_irqrestore(&rpc->lock, flags); | ||
311 | 302 | ||
312 | return PCIBIOS_SUCCESSFUL; | 303 | return PCIBIOS_SUCCESSFUL; |
313 | } | 304 | } |
diff --git a/arch/mips/pci/pci-tx4939.c b/arch/mips/pci/pci-tx4939.c index c10fbf2a19dc..cd8ed09c4f53 100644 --- a/arch/mips/pci/pci-tx4939.c +++ b/arch/mips/pci/pci-tx4939.c | |||
@@ -103,5 +103,5 @@ void __init tx4939_setup_pcierr_irq(void) | |||
103 | tx4927_pcierr_interrupt, | 103 | tx4927_pcierr_interrupt, |
104 | 0, "PCI error", | 104 | 0, "PCI error", |
105 | (void *)TX4939_PCIC_REG)) | 105 | (void *)TX4939_PCIC_REG)) |
106 | pr_warning("Failed to request irq for PCIERR\n"); | 106 | pr_warn("Failed to request irq for PCIERR\n"); |
107 | } | 107 | } |