[U-Boot] [RFC 3/4] dm: add DMA_SUPPORTS_DEV_TO_MEM type to DMA_UCLASS

Marek Vasut
2016-10-14T15:20:47Z

On 10/10/2016 05:52 PM, Dinh Nguyen wrote:
> From: Dinh Nguyen <dinguyen@opensource.altera.com>
>
> Add DMA_SUPPORTS_DEV_TO_MEM type to the DMA uclass.
>
> Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> ---
> drivers/dma/dma-uclass.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c
> index ea21fd9..a021395 100644
> --- a/drivers/dma/dma-uclass.c
> +++ b/drivers/dma/dma-uclass.c
> @@ -49,7 +49,8 @@ int dma_memcpy(void *dst, void *src, size_t len)
> const struct dma_ops *ops;
> int ret;
>
> - ret = dma_get_device(DMA_SUPPORTS_MEM_TO_MEM, &dev);
> + ret = dma_get_device(DMA_SUPPORTS_MEM_TO_MEM |
> + DMA_SUPPORTS_DEV_TO_MEM, &dev);
> if (ret < 0)
> return ret;
>
>

The memcpy() is not used for doing dev-to-mem transfers, it's only used
for mem-to-mem transfers, so this patch is wrong. I believe the driver
needs to be corrected if it supports mem2mem transfers but doesn't
advertise them.

--
Best regards,
Marek Vasut