summaryrefslogtreecommitdiff
path: root/include/fdt_support.h
diff options
context:
space:
mode:
authorFabien Dessenne <fabien.dessenne@st.com>2019-05-31 15:11:30 +0200
committerPatrick Delaunay <patrick.delaunay@st.com>2019-07-22 09:21:28 +0200
commit641067fb0c64dec8b6da962eb1d9fc49a6c7b499 (patch)
tree594af009ab9d03084047c09310018efe257cf926 /include/fdt_support.h
parent0de815356474912ef5bef9a69f0327a5a93bb2c2 (diff)
downloadu-boot-socfpga-641067fb0c64dec8b6da962eb1d9fc49a6c7b499.tar.gz
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/fdt_support.h')
-rw-r--r--include/fdt_support.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 27fe564f0b..cefb2b2cce 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -218,8 +218,32 @@ static inline void fdt_fixup_mtdparts(void *fdt,
#endif
void fdt_del_node_and_alias(void *blob, const char *alias);
+
+/**
+ * Translate an address from the DT into a CPU physical address
+ *
+ * The translation relies on the "ranges" property.
+ *
+ * @param blob Pointer to device tree blob
+ * @param node_offset Node DT offset
+ * @param in_addr Pointer to the address to translate
+ * @return translated address or OF_BAD_ADDR on error
+ */
u64 fdt_translate_address(const void *blob, int node_offset,
const __be32 *in_addr);
+/**
+ * Translate a DMA address from the DT into a CPU physical address
+ *
+ * The translation relies on the "dma-ranges" property.
+ *
+ * @param blob Pointer to device tree blob
+ * @param node_offset Node DT offset
+ * @param in_addr Pointer to the DMA address to translate
+ * @return translated DMA address or OF_BAD_ADDR on error
+ */
+u64 fdt_translate_dma_address(const void *blob, int node_offset,
+ const __be32 *in_addr);
+
int fdt_node_offset_by_compat_reg(void *blob, const char *compat,
phys_addr_t compat_off);
int fdt_alloc_phandle(void *blob);