dma: move dma_ops to dma-uclass.h
authorÁlvaro Fernández Rojas <noltari@gmail.com>
Wed, 28 Nov 2018 18:17:49 +0000 (19:17 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 7 Dec 2018 13:13:45 +0000 (08:13 -0500)
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 <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
drivers/dma/dma-uclass.c
drivers/dma/ti-edma3.c
include/dma-uclass.h [new file with mode: 0644]
include/dma.h

index a33f7d52dace3b6824f51a6f6aa2e350c65ffa73..6c3506c302d0cae6c09da17c2fbce4a21f796792 100644 (file)
@@ -9,10 +9,10 @@
  */
 
 #include <common.h>
-#include <dma.h>
 #include <dm.h>
 #include <dm/uclass-internal.h>
 #include <dm/device-internal.h>
+#include <dma-uclass.h>
 #include <errno.h>
 
 int dma_get_device(u32 transfer_type, struct udevice **devp)
index 2131e10a408c8fcff113dbb1111d2e66afce2e5c..7e11b13e45c6c9332899e27c1117885f10a308bc 100644 (file)
@@ -11,7 +11,7 @@
 #include <asm/io.h>
 #include <common.h>
 #include <dm.h>
-#include <dma.h>
+#include <dma-uclass.h>
 #include <asm/omap_common.h>
 #include <asm/ti-common/ti-edma3.h>
 
diff --git a/include/dma-uclass.h b/include/dma-uclass.h
new file mode 100644 (file)
index 0000000..7bec5d3
--- /dev/null
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas <noltari@gmail.com>
+ * Copyright (C) 2015 Texas Instruments Incorporated <www.ti.com>
+ * Written by Mugunthan V N <mugunthanvnm@ti.com>
+ *
+ */
+
+#ifndef _DMA_UCLASS_H
+#define _DMA_UCLASS_H
+
+/* See dma.h for background documentation. */
+
+#include <dma.h>
+
+/*
+ * 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 */
index 50e965241c0d6a012a541afdc3e0978d8a2842b2..97fa0cf695ba2ba96becda5f0673b5ba5aa39a57 100644 (file)
@@ -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
  *