[PATCH 4/8] dm: Introduce xxx_get_dma_range()

Simon Glass sjg at chromium.org
Sat Dec 12 16:39:47 CET 2020


Hi Nicolas,

On Thu, 19 Nov 2020 at 10:49, Nicolas Saenz Julienne
<nsaenzjulienne at suse.de> wrote:
>
> Add the follwing 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 at suse.de>
> ---
>  common/fdt_support.c   | 72 ++++++++++++++++++++++++++++++++++++++++++
>  drivers/core/of_addr.c | 68 +++++++++++++++++++++++++++++++++++++++
>  drivers/core/ofnode.c  |  9 ++++++
>  drivers/core/read.c    |  5 +++
>  include/dm/of_addr.h   | 17 ++++++++++
>  include/dm/ofnode.h    | 16 ++++++++++
>  include/dm/read.h      |  6 ++++
>  include/fdt_support.h  | 14 ++++++++
>  8 files changed, 207 insertions(+)

Please add sandbox tests for this, e.g. if you add some tests in a new
test/dm/read.c file that call the read() API that should be enough to
test your flattree and livetree calls.

Without tests we'll never know if the code works, or be able to change
it safely later.

Also, -ENODEV means there is no device and is reserved for driver
model. How about -ENOENT?

Regards,
Simon


More information about the U-Boot mailing list