aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/of_address.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/of_address.h')
-rw-r--r--include/linux/of_address.h39
1 files changed, 22 insertions, 17 deletions
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 4c2e6f26432c..5f6ed6b182b8 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -34,6 +34,10 @@ static inline void of_pci_range_to_resource(struct of_pci_range *range,
34 res->name = np->full_name; 34 res->name = np->full_name;
35} 35}
36 36
37/* Translate a DMA address from device space to CPU space */
38extern u64 of_translate_dma_address(struct device_node *dev,
39 const __be32 *in_addr);
40
37#ifdef CONFIG_OF_ADDRESS 41#ifdef CONFIG_OF_ADDRESS
38extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 42extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
39extern bool of_can_translate_address(struct device_node *dev); 43extern bool of_can_translate_address(struct device_node *dev);
@@ -52,10 +56,7 @@ extern void __iomem *of_iomap(struct device_node *device, int index);
52extern const __be32 *of_get_address(struct device_node *dev, int index, 56extern const __be32 *of_get_address(struct device_node *dev, int index,
53 u64 *size, unsigned int *flags); 57 u64 *size, unsigned int *flags);
54 58
55#ifndef pci_address_to_pio 59extern unsigned long pci_address_to_pio(phys_addr_t addr);
56static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
57#define pci_address_to_pio pci_address_to_pio
58#endif
59 60
60extern int of_pci_range_parser_init(struct of_pci_range_parser *parser, 61extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
61 struct device_node *node); 62 struct device_node *node);
@@ -63,13 +64,6 @@ extern struct of_pci_range *of_pci_range_parser_one(
63 struct of_pci_range_parser *parser, 64 struct of_pci_range_parser *parser,
64 struct of_pci_range *range); 65 struct of_pci_range *range);
65#else /* CONFIG_OF_ADDRESS */ 66#else /* CONFIG_OF_ADDRESS */
66#ifndef of_address_to_resource
67static inline int of_address_to_resource(struct device_node *dev, int index,
68 struct resource *r)
69{
70 return -EINVAL;
71}
72#endif
73static inline struct device_node *of_find_matching_node_by_address( 67static inline struct device_node *of_find_matching_node_by_address(
74 struct device_node *from, 68 struct device_node *from,
75 const struct of_device_id *matches, 69 const struct of_device_id *matches,
@@ -77,12 +71,7 @@ static inline struct device_node *of_find_matching_node_by_address(
77{ 71{
78 return NULL; 72 return NULL;
79} 73}
80#ifndef of_iomap 74
81static inline void __iomem *of_iomap(struct device_node *device, int index)
82{
83 return NULL;
84}
85#endif
86static inline const __be32 *of_get_address(struct device_node *dev, int index, 75static inline const __be32 *of_get_address(struct device_node *dev, int index,
87 u64 *size, unsigned int *flags) 76 u64 *size, unsigned int *flags)
88{ 77{
@@ -103,6 +92,22 @@ static inline struct of_pci_range *of_pci_range_parser_one(
103} 92}
104#endif /* CONFIG_OF_ADDRESS */ 93#endif /* CONFIG_OF_ADDRESS */
105 94
95#ifdef CONFIG_OF
96extern int of_address_to_resource(struct device_node *dev, int index,
97 struct resource *r);
98void __iomem *of_iomap(struct device_node *node, int index);
99#else
100static inline int of_address_to_resource(struct device_node *dev, int index,
101 struct resource *r)
102{
103 return -EINVAL;
104}
105
106static inline void __iomem *of_iomap(struct device_node *device, int index)
107{
108 return NULL;
109}
110#endif
106 111
107#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) 112#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
108extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, 113extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,