diff options
author | Nicolas Saenz Julienne | 2021-01-12 13:55:22 +0100 |
---|---|---|
committer | Matthias Brugger | 2021-02-18 11:56:25 +0100 |
commit | 51bdb50904b1ffffc1caa8dd92f5abea78e33a0b (patch) | |
tree | 861d5e3a57adaed2bd04df0489eed3df1af99369 /drivers/core/ofnode.c | |
parent | c709243ee0e1c3e1f8aaa750efb5b738493502c7 (diff) |
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 'drivers/core/ofnode.c')
-rw-r--r-- | drivers/core/ofnode.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 26c9d040564..fa0bd2a9c44 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -927,6 +927,15 @@ u64 ofnode_translate_dma_address(ofnode node, const fdt32_t *in_addr) return fdt_translate_dma_address(gd->fdt_blob, ofnode_to_offset(node), in_addr); } +int ofnode_get_dma_range(ofnode node, phys_addr_t *cpu, dma_addr_t *bus, u64 *size) +{ + if (ofnode_is_np(node)) + return of_get_dma_range(ofnode_to_np(node), cpu, bus, size); + else + return fdt_get_dma_range(gd->fdt_blob, ofnode_to_offset(node), + cpu, bus, size); +} + int ofnode_device_is_compatible(ofnode node, const char *compat) { if (ofnode_is_np(node)) |