| 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify it |
| 3 | * under the terms of the GNU General Public License version 2 as published |
| 4 | * by the Free Software Foundation. |
| 5 | * |
| 6 | * Copyright (C) 2012 John Crispin <blogic@openwrt.org> |
| 7 | */ |
| 8 | |
| 9 | #include <linux/of_irq.h> |
| 10 | #include <linux/of_pci.h> |
| 11 | |
| 12 | int (*ltqpci_map_irq)(const struct pci_dev *dev, u8 slot, u8 pin) = NULL; |
| 13 | int (*ltqpci_plat_arch_init)(struct pci_dev *dev) = NULL; |
| 14 | int (*ltqpci_plat_dev_init)(struct pci_dev *dev) = NULL; |
| 15 | int *ltq_pci_irq_map; |
| 16 | |
| 17 | int pcibios_plat_dev_init(struct pci_dev *dev) |
| 18 | { |
| 19 | if (ltqpci_plat_arch_init) |
| 20 | return ltqpci_plat_arch_init(dev); |
| 21 | |
| 22 | if (ltqpci_plat_dev_init) |
| 23 | return ltqpci_plat_dev_init(dev); |
| 24 | |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
| 29 | { |
| 30 | if (ltqpci_map_irq) |
| 31 | return ltqpci_map_irq(dev, slot, pin); |
| 32 | if (ltq_pci_irq_map[slot]) { |
| 33 | dev_info(&dev->dev, "SLOT:%d PIN:%d IRQ:%d\n", slot, pin, ltq_pci_irq_map[slot]); |
| 34 | return ltq_pci_irq_map[slot]; |
| 35 | } |
| 36 | printk(KERN_ERR "lq_pci: trying to map irq for unknown slot %d\n", |
| 37 | slot); |
| 38 | |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | |
| 43 | |