xref: /OK3568_Linux_fs/kernel/include/linux/of_pci.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef __OF_PCI_H
3*4882a593Smuzhiyun #define __OF_PCI_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun #include <linux/types.h>
6*4882a593Smuzhiyun #include <linux/errno.h>
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun struct pci_dev;
9*4882a593Smuzhiyun struct device_node;
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PCI)
12*4882a593Smuzhiyun struct device_node *of_pci_find_child_device(struct device_node *parent,
13*4882a593Smuzhiyun 					     unsigned int devfn);
14*4882a593Smuzhiyun int of_pci_get_devfn(struct device_node *np);
15*4882a593Smuzhiyun void of_pci_check_probe_only(void);
16*4882a593Smuzhiyun #else
of_pci_find_child_device(struct device_node * parent,unsigned int devfn)17*4882a593Smuzhiyun static inline struct device_node *of_pci_find_child_device(struct device_node *parent,
18*4882a593Smuzhiyun 					     unsigned int devfn)
19*4882a593Smuzhiyun {
20*4882a593Smuzhiyun 	return NULL;
21*4882a593Smuzhiyun }
22*4882a593Smuzhiyun 
of_pci_get_devfn(struct device_node * np)23*4882a593Smuzhiyun static inline int of_pci_get_devfn(struct device_node *np)
24*4882a593Smuzhiyun {
25*4882a593Smuzhiyun 	return -EINVAL;
26*4882a593Smuzhiyun }
27*4882a593Smuzhiyun 
of_pci_check_probe_only(void)28*4882a593Smuzhiyun static inline void of_pci_check_probe_only(void) { }
29*4882a593Smuzhiyun #endif
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun #if IS_ENABLED(CONFIG_OF_IRQ)
32*4882a593Smuzhiyun int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
33*4882a593Smuzhiyun #else
34*4882a593Smuzhiyun static inline int
of_irq_parse_and_map_pci(const struct pci_dev * dev,u8 slot,u8 pin)35*4882a593Smuzhiyun of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
36*4882a593Smuzhiyun {
37*4882a593Smuzhiyun 	return 0;
38*4882a593Smuzhiyun }
39*4882a593Smuzhiyun #endif
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun #endif
42