diff options
author | Fabien Dessenne <fabien.dessenne@st.com> | 2019-05-31 15:11:30 +0200 |
---|---|---|
committer | Patrick Delaunay <patrick.delaunay@st.com> | 2019-07-22 09:21:28 +0200 |
commit | 641067fb0c64dec8b6da962eb1d9fc49a6c7b499 (patch) | |
tree | 594af009ab9d03084047c09310018efe257cf926 /include/dm/of_addr.h | |
parent | 0de815356474912ef5bef9a69f0327a5a93bb2c2 (diff) |
dm: core: Introduce xxx_translate_dma_address()
Add the following functions to translate DMA address to CPU address:
- dev_translate_dma_address()
- ofnode_translate_dma_address()
- of_translate_dma_address()
- fdt_translate_dma_address()
These functions work the same way as xxx_translate_address(), with the
difference that the translation relies on the "dma-ranges" property
instead of the "ranges" property.
Add related test. Test report:
=> ut dm fdt_translation
Test: dm_test_fdt_translation: test-fdt.c
Test: dm_test_fdt_translation: test-fdt.c (flat tree)
Failures: 0
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Diffstat (limited to 'include/dm/of_addr.h')
-rw-r--r-- | include/dm/of_addr.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/dm/of_addr.h b/include/dm/of_addr.h index 12b1a99a80..3fa1ffce81 100644 --- a/include/dm/of_addr.h +++ b/include/dm/of_addr.h @@ -27,6 +27,24 @@ u64 of_translate_address(const struct device_node *no, const __be32 *in_addr); /** + * of_translate_dma_address() - translate a device-tree DMA address to a CPU + * address + * + * Translate a DMA address from the device-tree into a CPU physical address, + * this walks up the tree and applies the various bus mappings on the way. + * + * Note: We consider that crossing any level with #size-cells == 0 to mean + * that translation is impossible (that is we are not dealing with a value + * that can be mapped to a cpu physical address). This is not really specified + * that way, but this is traditionally the way IBM at least do things + * + * @np: node to check + * @in_addr: pointer to input DMA address + * @return translated DMA address or OF_BAD_ADDR on error + */ +u64 of_translate_dma_address(const struct device_node *no, const __be32 *in_addr); + +/** * of_get_address() - obtain an address from a node * * Extract an address from a node, returns the region size and the address |