[U-Boot] [PATCH 1/7] fdt: Introduce fdt_translate_dma_address()

Fabien Dessenne fabien.dessenne at st.com
Wed May 22 08:06:43 UTC 2019


Add the fdt_translate_dma_address() function to translate DMA address to
CPU address.
This function works the same way as fdt_translate_address(), with the
difference that the translation relies on the "dma-ranges" property
instead of the "ranges" property.

Signed-off-by: Fabien Dessenne <fabien.dessenne at st.com>
---
 common/fdt_support.c  | 6 ++++++
 include/fdt_support.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 4e7cf6e..6ec0742 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1279,6 +1279,12 @@ u64 fdt_translate_address(const void *blob, int node_offset,
 	return __of_translate_address(blob, node_offset, in_addr, "ranges");
 }
 
+u64 fdt_translate_dma_address(const void *blob, int node_offset,
+			      const fdt32_t *in_addr)
+{
+	return __of_translate_address(blob, node_offset, in_addr, "dma-ranges");
+}
+
 /**
  * fdt_node_offset_by_compat_reg: Find a node that matches compatiable and
  * who's reg property matches a physical cpu address
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 27fe564..b92d8c0 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -220,6 +220,8 @@ static inline void fdt_fixup_mtdparts(void *fdt,
 void fdt_del_node_and_alias(void *blob, const char *alias);
 u64 fdt_translate_address(const void *blob, int node_offset,
 			  const __be32 *in_addr);
+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);
-- 
2.7.4



More information about the U-Boot mailing list