aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/of/address.c9
-rw-r--r--include/linux/of_address.h20
2 files changed, 18 insertions, 11 deletions
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 758d4f04d4aa..327a57410797 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -295,6 +295,15 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
295} 295}
296EXPORT_SYMBOL_GPL(of_pci_range_parser_one); 296EXPORT_SYMBOL_GPL(of_pci_range_parser_one);
297 297
298void of_pci_range_to_resource(struct of_pci_range *range,
299 struct device_node *np, struct resource *res)
300{
301 res->flags = range->flags;
302 res->start = range->cpu_addr;
303 res->end = range->cpu_addr + range->size - 1;
304 res->parent = res->child = res->sibling = NULL;
305 res->name = np->full_name;
306}
298#endif /* CONFIG_PCI */ 307#endif /* CONFIG_PCI */
299 308
300/* 309/*
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 497a04356ff8..a38e1c846c23 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -23,17 +23,6 @@ struct of_pci_range {
23#define for_each_of_pci_range(parser, range) \ 23#define for_each_of_pci_range(parser, range) \
24 for (; of_pci_range_parser_one(parser, range);) 24 for (; of_pci_range_parser_one(parser, range);)
25 25
26static inline void of_pci_range_to_resource(struct of_pci_range *range,
27 struct device_node *np,
28 struct resource *res)
29{
30 res->flags = range->flags;
31 res->start = range->cpu_addr;
32 res->end = range->cpu_addr + range->size - 1;
33 res->parent = res->child = res->sibling = NULL;
34 res->name = np->full_name;
35}
36
37/* Translate a DMA address from device space to CPU space */ 26/* Translate a DMA address from device space to CPU space */
38extern u64 of_translate_dma_address(struct device_node *dev, 27extern u64 of_translate_dma_address(struct device_node *dev,
39 const __be32 *in_addr); 28 const __be32 *in_addr);
@@ -145,6 +134,9 @@ extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
145 u64 *size, unsigned int *flags); 134 u64 *size, unsigned int *flags);
146extern int of_pci_address_to_resource(struct device_node *dev, int bar, 135extern int of_pci_address_to_resource(struct device_node *dev, int bar,
147 struct resource *r); 136 struct resource *r);
137extern void of_pci_range_to_resource(struct of_pci_range *range,
138 struct device_node *np,
139 struct resource *res);
148#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */ 140#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
149static inline int of_pci_address_to_resource(struct device_node *dev, int bar, 141static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
150 struct resource *r) 142 struct resource *r)
@@ -157,6 +149,12 @@ static inline const __be32 *of_get_pci_address(struct device_node *dev,
157{ 149{
158 return NULL; 150 return NULL;
159} 151}
152static inline void of_pci_range_to_resource(struct of_pci_range *range,
153 struct device_node *np,
154 struct resource *res)
155{
156 return -ENOSYS;
157}
160#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ 158#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
161 159
162#endif /* __OF_ADDRESS_H */ 160#endif /* __OF_ADDRESS_H */