aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/pci/pci-xlr.c
diff options
context:
space:
mode:
authorJayachandran C <jayachandranc@netlogicmicro.com>2011-11-11 06:38:29 -0500
committerRalf Baechle <ralf@linux-mips.org>2011-12-07 17:04:55 -0500
commit0c9654072a6e15aa3da9b314f0c5c01e90938268 (patch)
tree865bbcf93aac081b15bf38604384e4bf7620024b /arch/mips/pci/pci-xlr.c
parent99fb2f7984726ba03d5634df8e6d26eb891f1ec3 (diff)
MIPS: Netlogic: Move code common with XLP to common/
- Move code that can be shared with XLP (irq.c, smp.c, time.c and xlr_console.c) to arch/mips/netlogic/common - Add asm/netlogic/haldefs.h and asm/netlogic/common.h for common and io functions shared with XLP - remove type 'nlm_reg_t *' and use uint64_t for mmio offsets - Move XLR specific code in smp.c to xlr/wakeup.c - Move XLR specific PCI code from irq.c to mips/pci/pci-xlr.c - Provide API for pic functions called from common/irq.c Signed-off-by: Jayachandran C <jayachandranc@netlogicmicro.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/2964/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/pci/pci-xlr.c')
-rw-r--r--arch/mips/pci/pci-xlr.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/arch/mips/pci/pci-xlr.c b/arch/mips/pci/pci-xlr.c
index 87404d0034d2..3d701a962ef4 100644
--- a/arch/mips/pci/pci-xlr.c
+++ b/arch/mips/pci/pci-xlr.c
@@ -45,6 +45,8 @@
45#include <asm/io.h> 45#include <asm/io.h>
46 46
47#include <asm/netlogic/interrupt.h> 47#include <asm/netlogic/interrupt.h>
48#include <asm/netlogic/haldefs.h>
49
48#include <asm/netlogic/xlr/msidef.h> 50#include <asm/netlogic/xlr/msidef.h>
49#include <asm/netlogic/xlr/iomap.h> 51#include <asm/netlogic/xlr/iomap.h>
50#include <asm/netlogic/xlr/pic.h> 52#include <asm/netlogic/xlr/pic.h>
@@ -226,6 +228,56 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
226} 228}
227#endif 229#endif
228 230
231/* Extra ACK needed for XLR on chip PCI controller */
232static void xlr_pci_ack(struct irq_data *d)
233{
234 uint64_t pcibase = nlm_mmio_base(NETLOGIC_IO_PCIX_OFFSET);
235
236 nlm_read_reg(pcibase, (0x140 >> 2));
237}
238
239/* Extra ACK needed for XLS on chip PCIe controller */
240static void xls_pcie_ack(struct irq_data *d)
241{
242 uint64_t pciebase_le = nlm_mmio_base(NETLOGIC_IO_PCIE_1_OFFSET);
243
244 switch (d->irq) {
245 case PIC_PCIE_LINK0_IRQ:
246 nlm_write_reg(pciebase_le, (0x90 >> 2), 0xffffffff);
247 break;
248 case PIC_PCIE_LINK1_IRQ:
249 nlm_write_reg(pciebase_le, (0x94 >> 2), 0xffffffff);
250 break;
251 case PIC_PCIE_LINK2_IRQ:
252 nlm_write_reg(pciebase_le, (0x190 >> 2), 0xffffffff);
253 break;
254 case PIC_PCIE_LINK3_IRQ:
255 nlm_write_reg(pciebase_le, (0x194 >> 2), 0xffffffff);
256 break;
257 }
258}
259
260/* For XLS B silicon, the 3,4 PCI interrupts are different */
261static void xls_pcie_ack_b(struct irq_data *d)
262{
263 uint64_t pciebase_le = nlm_mmio_base(NETLOGIC_IO_PCIE_1_OFFSET);
264
265 switch (d->irq) {
266 case PIC_PCIE_LINK0_IRQ:
267 nlm_write_reg(pciebase_le, (0x90 >> 2), 0xffffffff);
268 break;
269 case PIC_PCIE_LINK1_IRQ:
270 nlm_write_reg(pciebase_le, (0x94 >> 2), 0xffffffff);
271 break;
272 case PIC_PCIE_XLSB0_LINK2_IRQ:
273 nlm_write_reg(pciebase_le, (0x190 >> 2), 0xffffffff);
274 break;
275 case PIC_PCIE_XLSB0_LINK3_IRQ:
276 nlm_write_reg(pciebase_le, (0x194 >> 2), 0xffffffff);
277 break;
278 }
279}
280
229int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 281int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
230{ 282{
231 return get_irq_vector(dev); 283 return get_irq_vector(dev);
@@ -253,6 +305,31 @@ static int __init pcibios_init(void)
253 pr_info("Registering XLR/XLS PCIX/PCIE Controller.\n"); 305 pr_info("Registering XLR/XLS PCIX/PCIE Controller.\n");
254 register_pci_controller(&nlm_pci_controller); 306 register_pci_controller(&nlm_pci_controller);
255 307
308 /*
309 * For PCI interrupts, we need to ack the PCI controller too, overload
310 * irq handler data to do this
311 */
312 if (nlm_chip_is_xls()) {
313 if (nlm_chip_is_xls_b()) {
314 irq_set_handler_data(PIC_PCIE_LINK0_IRQ,
315 xls_pcie_ack_b);
316 irq_set_handler_data(PIC_PCIE_LINK1_IRQ,
317 xls_pcie_ack_b);
318 irq_set_handler_data(PIC_PCIE_XLSB0_LINK2_IRQ,
319 xls_pcie_ack_b);
320 irq_set_handler_data(PIC_PCIE_XLSB0_LINK3_IRQ,
321 xls_pcie_ack_b);
322 } else {
323 irq_set_handler_data(PIC_PCIE_LINK0_IRQ, xls_pcie_ack);
324 irq_set_handler_data(PIC_PCIE_LINK1_IRQ, xls_pcie_ack);
325 irq_set_handler_data(PIC_PCIE_LINK2_IRQ, xls_pcie_ack);
326 irq_set_handler_data(PIC_PCIE_LINK3_IRQ, xls_pcie_ack);
327 }
328 } else {
329 /* XLR PCI controller ACK */
330 irq_set_handler_data(PIC_PCIE_XLSB0_LINK3_IRQ, xlr_pci_ack);
331 }
332
256 return 0; 333 return 0;
257} 334}
258 335