From: Fabien Dessenne Date: Wed, 22 May 2019 10:06:43 +0200 Subject: [U-Boot] [PATCH 1/7] fdt: Introduce fdt_translate_dma_address() In-Reply-To: <1558512409-32376-1-git-send-email-fabien.dessenne@st.com> References: <1558512409-32376-1-git-send-email-fabien.dessenne@st.com> Message-ID: <1558512409-32376-2-git-send-email-fabien.dessenne@st.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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