diff options
author | Nicolas Saenz Julienne <nsaenzjulienne@suse.de> | 2021-01-12 13:55:22 +0100 |
---|---|---|
committer | Matthias Brugger <mbrugger@suse.com> | 2021-02-18 11:56:25 +0100 |
commit | 51bdb50904b1ffffc1caa8dd92f5abea78e33a0b (patch) | |
tree | 861d5e3a57adaed2bd04df0489eed3df1af99369 /include/fdt_support.h | |
parent | c709243ee0e1c3e1f8aaa750efb5b738493502c7 (diff) | |
download | u-boot-51bdb50904b1ffffc1caa8dd92f5abea78e33a0b.tar.gz u-boot-51bdb50904b1ffffc1caa8dd92f5abea78e33a0b.tar.bz2 u-boot-51bdb50904b1ffffc1caa8dd92f5abea78e33a0b.zip |
dm: Introduce xxx_get_dma_range()
Add the following functions to get a specific device's DMA ranges:
- dev_get_dma_range()
- ofnode_get_dma_range()
- of_get_dma_range()
- fdt_get_dma_range()
They are specially useful in oder to be able validate a physical address
space range into a bus's and to convert addresses from and to address
spaces.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Diffstat (limited to 'include/fdt_support.h')
-rw-r--r-- | include/fdt_support.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/fdt_support.h b/include/fdt_support.h index dbbac0fb6a..46eb1dbbb2 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -260,6 +260,20 @@ u64 fdt_translate_address(const void *blob, int node_offset, u64 fdt_translate_dma_address(const void *blob, int node_offset, const __be32 *in_addr); +/** + * Get DMA ranges for a specifc node, this is useful to perform bus->cpu and + * cpu->bus address translations + * + * @param blob Pointer to device tree blob + * @param node_offset Node DT offset + * @param cpu Pointer to variable storing the range's cpu address + * @param bus Pointer to variable storing the range's bus address + * @param size Pointer to variable storing the range's size + * @return translated DMA address or OF_BAD_ADDR on error + */ +int fdt_get_dma_range(const void *blob, int node_offset, phys_addr_t *cpu, + dma_addr_t *bus, u64 *size); + int fdt_node_offset_by_compat_reg(void *blob, const char *compat, phys_addr_t compat_off); int fdt_alloc_phandle(void *blob); |