From 10b4dc520811fdfc5a31f6067be2b0cd0753998d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 28 Nov 2018 19:17:49 +0100 Subject: [PATCH] dma: move dma_ops to dma-uclass.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Move dma_ops to a separate header file, following other uclass implementations. While doing so, this patch also improves dma_ops documentation. Reviewed-by: Tom Rini Reviewed-by: Simon Glass Signed-off-by: Álvaro Fernández Rojas Signed-off-by: Grygorii Strashko --- drivers/dma/dma-uclass.c | 2 +- drivers/dma/ti-edma3.c | 2 +- include/dma-uclass.h | 39 +++++++++++++++++++++++++++++++++++++++ include/dma.h | 22 ---------------------- 4 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 include/dma-uclass.h diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c index a33f7d52da..6c3506c302 100644 --- a/drivers/dma/dma-uclass.c +++ b/drivers/dma/dma-uclass.c @@ -9,10 +9,10 @@ */ #include -#include #include #include #include +#include #include int dma_get_device(u32 transfer_type, struct udevice **devp) diff --git a/drivers/dma/ti-edma3.c b/drivers/dma/ti-edma3.c index 2131e10a40..7e11b13e45 100644 --- a/drivers/dma/ti-edma3.c +++ b/drivers/dma/ti-edma3.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/dma-uclass.h b/include/dma-uclass.h new file mode 100644 index 0000000000..7bec5d3399 --- /dev/null +++ b/include/dma-uclass.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2018 Álvaro Fernández Rojas + * Copyright (C) 2015 Texas Instruments Incorporated + * Written by Mugunthan V N + * + */ + +#ifndef _DMA_UCLASS_H +#define _DMA_UCLASS_H + +/* See dma.h for background documentation. */ + +#include + +/* + * struct dma_ops - Driver model DMA operations + * + * The uclass interface is implemented by all DMA devices which use + * driver model. + */ +struct dma_ops { + /** + * transfer() - Issue a DMA transfer. The implementation must + * wait until the transfer is done. + * + * @dev: The DMA device + * @direction: direction of data transfer (should be one from + * enum dma_direction) + * @dst: The destination pointer. + * @src: The source pointer. + * @len: Length of the data to be copied (number of bytes). + * @return zero on success, or -ve error code. + */ + int (*transfer)(struct udevice *dev, int direction, void *dst, + void *src, size_t len); +}; + +#endif /* _DMA_UCLASS_H */ diff --git a/include/dma.h b/include/dma.h index 50e965241c..97fa0cf695 100644 --- a/include/dma.h +++ b/include/dma.h @@ -26,28 +26,6 @@ enum dma_direction { #define DMA_SUPPORTS_DEV_TO_MEM BIT(2) #define DMA_SUPPORTS_DEV_TO_DEV BIT(3) -/* - * struct dma_ops - Driver model DMA operations - * - * The uclass interface is implemented by all DMA devices which use - * driver model. - */ -struct dma_ops { - /* - * Get the current timer count - * - * @dev: The DMA device - * @direction: direction of data transfer should be one from - enum dma_direction - * @dst: Destination pointer - * @src: Source pointer - * @len: Length of the data to be copied. - * @return: 0 if OK, -ve on error - */ - int (*transfer)(struct udevice *dev, int direction, void *dst, - void *src, size_t len); -}; - /* * struct dma_dev_priv - information about a device used by the uclass * -- 2.39.5