Commit | Line | Data |
---|---|---|
57c8cb8f JC |
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 (*ltq_pci_plat_arch_init)(struct pci_dev *dev) = NULL; | |
13 | int (*ltq_pci_plat_dev_init)(struct pci_dev *dev) = NULL; | |
14 | ||
15 | int pcibios_plat_dev_init(struct pci_dev *dev) | |
16 | { | |
17 | if (ltq_pci_plat_arch_init) | |
18 | return ltq_pci_plat_arch_init(dev); | |
19 | ||
20 | if (ltq_pci_plat_dev_init) | |
21 | return ltq_pci_plat_dev_init(dev); | |
22 | ||
23 | return 0; | |
24 | } | |
25 | ||
26 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |
27 | { | |
530210c7 | 28 | struct of_phandle_args dev_irq; |
57c8cb8f JC |
29 | int irq; |
30 | ||
0c02c800 | 31 | if (of_irq_parse_pci(dev, &dev_irq)) { |
57c8cb8f JC |
32 | dev_err(&dev->dev, "trying to map irq for unknown slot:%d pin:%d\n", |
33 | slot, pin); | |
34 | return 0; | |
35 | } | |
e6d30ab1 | 36 | irq = irq_create_of_mapping(&dev_irq); |
57c8cb8f JC |
37 | dev_info(&dev->dev, "SLOT:%d PIN:%d IRQ:%d\n", slot, pin, irq); |
38 | return irq; | |
39 | } |