diff options
author | Jayachandran C <jchandra@broadcom.com> | 2012-11-15 04:45:55 -0500 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2012-11-20 02:33:50 -0500 |
commit | ea49b750d4d2038c8227dfb8bbf9a2ba3fd4c4c5 (patch) | |
tree | bff9cd3954cbff927b92928de3309acbf77f6f56 /arch/mips/pci | |
parent | e59b008e14c63572d4c643592e84bbd1b4088f39 (diff) |
MIPS: PCI: Update XLR/XLS PCI for the new PIC code
Use the nlm_set_pic_extra_ack() call to setup the extra interrupt
ACK needed by XLR PCI and XLS PCIe. Simplify the code by adding
nlm_pci_link_to_irq().
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Patchwork: http://patchwork.linux-mips.org/patch/4561
Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'arch/mips/pci')
-rw-r--r-- | arch/mips/pci/pci-xlr.c | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/arch/mips/pci/pci-xlr.c b/arch/mips/pci/pci-xlr.c index 18af021d289a..0c18ccc79623 100644 --- a/arch/mips/pci/pci-xlr.c +++ b/arch/mips/pci/pci-xlr.c | |||
@@ -47,6 +47,7 @@ | |||
47 | 47 | ||
48 | #include <asm/netlogic/interrupt.h> | 48 | #include <asm/netlogic/interrupt.h> |
49 | #include <asm/netlogic/haldefs.h> | 49 | #include <asm/netlogic/haldefs.h> |
50 | #include <asm/netlogic/common.h> | ||
50 | 51 | ||
51 | #include <asm/netlogic/xlr/msidef.h> | 52 | #include <asm/netlogic/xlr/msidef.h> |
52 | #include <asm/netlogic/xlr/iomap.h> | 53 | #include <asm/netlogic/xlr/iomap.h> |
@@ -174,22 +175,9 @@ static struct pci_dev *xls_get_pcie_link(const struct pci_dev *dev) | |||
174 | return p ? bus->self : NULL; | 175 | return p ? bus->self : NULL; |
175 | } | 176 | } |
176 | 177 | ||
177 | static int get_irq_vector(const struct pci_dev *dev) | 178 | static int nlm_pci_link_to_irq(int link) |
178 | { | 179 | { |
179 | struct pci_dev *lnk; | 180 | switch (link) { |
180 | |||
181 | if (!nlm_chip_is_xls()) | ||
182 | return PIC_PCIX_IRQ; /* for XLR just one IRQ */ | ||
183 | |||
184 | /* | ||
185 | * For XLS PCIe, there is an IRQ per Link, find out which | ||
186 | * link the device is on to assign interrupts | ||
187 | */ | ||
188 | lnk = xls_get_pcie_link(dev); | ||
189 | if (lnk == NULL) | ||
190 | return 0; | ||
191 | |||
192 | switch (PCI_SLOT(lnk->devfn)) { | ||
193 | case 0: | 181 | case 0: |
194 | return PIC_PCIE_LINK0_IRQ; | 182 | return PIC_PCIE_LINK0_IRQ; |
195 | case 1: | 183 | case 1: |
@@ -205,10 +193,26 @@ static int get_irq_vector(const struct pci_dev *dev) | |||
205 | else | 193 | else |
206 | return PIC_PCIE_LINK3_IRQ; | 194 | return PIC_PCIE_LINK3_IRQ; |
207 | } | 195 | } |
208 | WARN(1, "Unexpected devfn %d\n", lnk->devfn); | 196 | WARN(1, "Unexpected link %d\n", link); |
209 | return 0; | 197 | return 0; |
210 | } | 198 | } |
211 | 199 | ||
200 | static int get_irq_vector(const struct pci_dev *dev) | ||
201 | { | ||
202 | struct pci_dev *lnk; | ||
203 | int link; | ||
204 | |||
205 | if (!nlm_chip_is_xls()) | ||
206 | return PIC_PCIX_IRQ; /* for XLR just one IRQ */ | ||
207 | |||
208 | lnk = xls_get_pcie_link(dev); | ||
209 | if (lnk == NULL) | ||
210 | return 0; | ||
211 | |||
212 | link = PCI_SLOT(lnk->devfn); | ||
213 | return nlm_pci_link_to_irq(link); | ||
214 | } | ||
215 | |||
212 | #ifdef CONFIG_PCI_MSI | 216 | #ifdef CONFIG_PCI_MSI |
213 | void destroy_irq(unsigned int irq) | 217 | void destroy_irq(unsigned int irq) |
214 | { | 218 | { |
@@ -332,6 +336,9 @@ int pcibios_plat_dev_init(struct pci_dev *dev) | |||
332 | 336 | ||
333 | static int __init pcibios_init(void) | 337 | static int __init pcibios_init(void) |
334 | { | 338 | { |
339 | void (*extra_ack)(struct irq_data *); | ||
340 | int link, irq; | ||
341 | |||
335 | /* PSB assigns PCI resources */ | 342 | /* PSB assigns PCI resources */ |
336 | pci_set_flags(PCI_PROBE_ONLY); | 343 | pci_set_flags(PCI_PROBE_ONLY); |
337 | pci_config_base = ioremap(DEFAULT_PCI_CONFIG_BASE, 16 << 20); | 344 | pci_config_base = ioremap(DEFAULT_PCI_CONFIG_BASE, 16 << 20); |
@@ -350,27 +357,19 @@ static int __init pcibios_init(void) | |||
350 | * For PCI interrupts, we need to ack the PCI controller too, overload | 357 | * For PCI interrupts, we need to ack the PCI controller too, overload |
351 | * irq handler data to do this | 358 | * irq handler data to do this |
352 | */ | 359 | */ |
353 | if (nlm_chip_is_xls()) { | 360 | if (!nlm_chip_is_xls()) { |
354 | if (nlm_chip_is_xls_b()) { | ||
355 | irq_set_handler_data(PIC_PCIE_LINK0_IRQ, | ||
356 | xls_pcie_ack_b); | ||
357 | irq_set_handler_data(PIC_PCIE_LINK1_IRQ, | ||
358 | xls_pcie_ack_b); | ||
359 | irq_set_handler_data(PIC_PCIE_XLSB0_LINK2_IRQ, | ||
360 | xls_pcie_ack_b); | ||
361 | irq_set_handler_data(PIC_PCIE_XLSB0_LINK3_IRQ, | ||
362 | xls_pcie_ack_b); | ||
363 | } else { | ||
364 | irq_set_handler_data(PIC_PCIE_LINK0_IRQ, xls_pcie_ack); | ||
365 | irq_set_handler_data(PIC_PCIE_LINK1_IRQ, xls_pcie_ack); | ||
366 | irq_set_handler_data(PIC_PCIE_LINK2_IRQ, xls_pcie_ack); | ||
367 | irq_set_handler_data(PIC_PCIE_LINK3_IRQ, xls_pcie_ack); | ||
368 | } | ||
369 | } else { | ||
370 | /* XLR PCI controller ACK */ | 361 | /* XLR PCI controller ACK */ |
371 | irq_set_handler_data(PIC_PCIX_IRQ, xlr_pci_ack); | 362 | nlm_set_pic_extra_ack(0, PIC_PCIX_IRQ, xlr_pci_ack); |
363 | } else { | ||
364 | if (nlm_chip_is_xls_b()) | ||
365 | extra_ack = xls_pcie_ack_b; | ||
366 | else | ||
367 | extra_ack = xls_pcie_ack; | ||
368 | for (link = 0; link < 4; link++) { | ||
369 | irq = nlm_pci_link_to_irq(link); | ||
370 | nlm_set_pic_extra_ack(0, irq, extra_ack); | ||
371 | } | ||
372 | } | 372 | } |
373 | |||
374 | return 0; | 373 | return 0; |
375 | } | 374 | } |
376 | 375 | ||