blob: 29658c0ee71ff10122760214d04ee2bab01709fd [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Sebastian Andrzej Siewior04bea682011-01-24 09:58:55 +05302#ifndef __OF_PCI_H
3#define __OF_PCI_H
4
Krzysztof Wilczynskibbd8810d2019-09-03 13:30:59 +02005#include <linux/types.h>
6#include <linux/errno.h>
Sebastian Andrzej Siewior04bea682011-01-24 09:58:55 +05307
8struct pci_dev;
Benjamin Herrenschmidt98d9f30c82011-04-11 11:37:07 +10009struct device_node;
Arnd Bergmann64c5c752014-06-04 04:40:19 -050010
Rob Herring4670d612018-01-17 17:36:39 -060011#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PCI)
Benjamin Herrenschmidt98d9f30c82011-04-11 11:37:07 +100012struct device_node *of_pci_find_child_device(struct device_node *parent,
13 unsigned int devfn);
Thierry Reding45ab9702013-05-16 17:55:18 +020014int of_pci_get_devfn(struct device_node *np);
Marc Zyngierf81c11a2015-09-04 17:50:08 +010015void of_pci_check_probe_only(void);
Arnd Bergmann64c5c752014-06-04 04:40:19 -050016#else
Arnd Bergmann64c5c752014-06-04 04:40:19 -050017static inline struct device_node *of_pci_find_child_device(struct device_node *parent,
18 unsigned int devfn)
19{
20 return NULL;
21}
22
23static inline int of_pci_get_devfn(struct device_node *np)
24{
25 return -EINVAL;
26}
27
Marc Zyngierf81c11a2015-09-04 17:50:08 +010028static inline void of_pci_check_probe_only(void) { }
Arnd Bergmann64c5c752014-06-04 04:40:19 -050029#endif
Benjamin Herrenschmidt98d9f30c82011-04-11 11:37:07 +100030
Guenter Roecka6f10862018-03-05 15:22:30 -080031#if IS_ENABLED(CONFIG_OF_IRQ)
32int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
33#else
34static inline int
35of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
36{
37 return 0;
38}
39#endif
40
Sebastian Andrzej Siewior04bea682011-01-24 09:58:55 +053041#endif