2 * Taken from Linux v4.9 drivers/of/address.c
5 * Copyright (c) 2017 Google, Inc
7 * SPDX-License-Identifier: GPL-2.0+
14 * of_translate_address() - translate a device-tree address to a CPU address
16 * Translate an address from the device-tree into a CPU physical address,
17 * this walks up the tree and applies the various bus mappings on the way.
19 * Note: We consider that crossing any level with #size-cells == 0 to mean
20 * that translation is impossible (that is we are not dealing with a value
21 * that can be mapped to a cpu physical address). This is not really specified
22 * that way, but this is traditionally the way IBM at least do things
25 * @in_addr: pointer to input address
26 * @return translated address or OF_BAD_ADDR on error
28 u64 of_translate_address(const struct device_node *no, const __be32 *in_addr);
31 * of_get_address() - obtain an address from a node
33 * Extract an address from a node, returns the region size and the address
34 * space flags too. The PCI version uses a BAR number instead of an absolute
38 * @index: Index of address to read (0 = first)
39 * @size: place to put size on success
40 * @flags: place to put flags on success
41 * @return pointer to address which can be read
43 const __be32 *of_get_address(const struct device_node *no, int index,
44 u64 *size, unsigned int *flags);
49 * of_address_to_resource() - translate device tree address to resource
51 * Note that if your address is a PIO address, the conversion will fail if
52 * the physical address can't be internally converted to an IO token with
53 * pci_address_to_pio(), that is because it's either called to early or it
54 * can't be matched to any host bridge IO space
57 * @index: index of address to read (0 = first)
58 * @r: place to put resource information
59 * @return 0 if OK, -ve on error
61 int of_address_to_resource(const struct device_node *no, int index,