summaryrefslogtreecommitdiff
path: root/include/linux/of_address.h
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2020-02-06 17:01:05 +0300
committerRob Herring <robh@kernel.org>2020-02-14 23:25:26 +0300
commitbc5e522ec47174770a75df0a76d90f9ebb20132e (patch)
tree95d68604be1cbe3cc965f8ba62a2c906f55c4f8d /include/linux/of_address.h
parentc67f3df88ffca45531a12214e8faffbdab1fa422 (diff)
downloadlinux-bc5e522ec47174770a75df0a76d90f9ebb20132e.tar.xz
of/address: Rework of_pci_range parsing for non-PCI buses
The only PCI specific part of of_pci_range_parser_one() is the handling of the 3rd address cell. Rework it to work on regular 1 and 2 cell addresses. Use defines and a union to avoid a treewide renaming of the parsing helpers and struct. Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'include/linux/of_address.h')
-rw-r--r--include/linux/of_address.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 8d12bf18e80b..763022ed3456 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -10,20 +10,27 @@ struct of_pci_range_parser {
struct device_node *node;
const __be32 *range;
const __be32 *end;
- int np;
+ int na;
+ int ns;
int pna;
bool dma;
};
+#define of_range_parser of_pci_range_parser
struct of_pci_range {
- u64 pci_addr;
+ union {
+ u64 pci_addr;
+ u64 bus_addr;
+ };
u64 cpu_addr;
u64 size;
u32 flags;
};
+#define of_range of_pci_range
#define for_each_of_pci_range(parser, range) \
for (; of_pci_range_parser_one(parser, range);)
+#define for_each_of_range for_each_of_pci_range
/* Translate a DMA address from device space to CPU space */
extern u64 of_translate_dma_address(struct device_node *dev,
@@ -142,4 +149,3 @@ static inline int of_pci_range_to_resource(struct of_pci_range *range,
#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
#endif /* __OF_ADDRESS_H */
-