aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/of_address.h
diff options
context:
space:
mode:
authorLiviu Dudau <Liviu.Dudau@arm.com>2014-09-29 10:29:21 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-09-30 11:42:45 -0400
commit41f8bba7f5552d033583777dede2df7c36e7853d (patch)
tree5ee6fe856a1cee69e751393fd4068c1a6b5e25e1 /include/linux/of_address.h
parent112eeaa7f87bbd2925e919486bb504f8954fa675 (diff)
of/pci: Add pci_register_io_range() and pci_pio_to_address()
Some architectures do not have a simple view of the PCI I/O space and instead use a range of CPU addresses that map to bus addresses. For some architectures these ranges will be expressed by OF bindings in a device tree file. This patch introduces a pci_register_io_range() helper function with a generic implementation that can be used by such architectures to keep track of the I/O ranges described by the PCI bindings. If the PCI_IOBASE macro is not defined, that signals lack of support for PCI and we return an error. In order to retrieve the CPU address associated with an I/O port, a new helper function pci_pio_to_address() is introduced. This will search in the list of ranges registered with pci_register_io_range() and return the CPU address that corresponds to the given port. [arnd: add dummy !CONFIG_OF pci_pio_to_address() to fix build errors] Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Rob Herring <robh@kernel.org> CC: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'include/linux/of_address.h')
-rw-r--r--include/linux/of_address.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index fb7b7221e063..497a04356ff8 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -55,7 +55,9 @@ extern void __iomem *of_iomap(struct device_node *device, int index);
55extern const __be32 *of_get_address(struct device_node *dev, int index, 55extern const __be32 *of_get_address(struct device_node *dev, int index,
56 u64 *size, unsigned int *flags); 56 u64 *size, unsigned int *flags);
57 57
58extern int pci_register_io_range(phys_addr_t addr, resource_size_t size);
58extern unsigned long pci_address_to_pio(phys_addr_t addr); 59extern unsigned long pci_address_to_pio(phys_addr_t addr);
60extern phys_addr_t pci_pio_to_address(unsigned long pio);
59 61
60extern int of_pci_range_parser_init(struct of_pci_range_parser *parser, 62extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
61 struct device_node *node); 63 struct device_node *node);
@@ -80,6 +82,11 @@ static inline const __be32 *of_get_address(struct device_node *dev, int index,
80 return NULL; 82 return NULL;
81} 83}
82 84
85static inline phys_addr_t pci_pio_to_address(unsigned long pio)
86{
87 return 0;
88}
89
83static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser, 90static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser,
84 struct device_node *node) 91 struct device_node *node)
85{ 92{