Skip to contentSkip to conversation

dmaengine: Register as a DMA resource

PATCH In review Mehta, Sanju 1 participant 1 message Sep 24, 2019 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 dmaengine: Register as a DMA resource

From: Sanjay R Mehta <[email protected]>

This Registers the ptdma to Linux dmaengine
framework as general purpose DMA channels.

---
 drivers/dma/ptdma/Kconfig           |   1 +
 drivers/dma/ptdma/Makefile          |   3 +-
 drivers/dma/ptdma/ptdma-dev.c       |   8 +
 drivers/dma/ptdma/ptdma-dmaengine.c | 700 ++++++++++++++++++++++++++++++++++++
 drivers/dma/ptdma/ptdma.h           |  43 +++
 5 files changed, 754 insertions(+), 1 deletion(-)
 create mode 100644 drivers/dma/ptdma/ptdma-dmaengine.c
drivers/dma/ptdma/Kconfig +1 -0
index a373431..3954501 100644
@@ -3,5 +3,6 @@ config AMD_PTDMA
 	tristate  "AMD Passthru DMA Engine"
 	default m
 	depends on X86_64 && PCI
+	select DMA_ENGINE
 	help
 	  Provides the support for AMD Passthru DMA engine.
drivers/dma/ptdma/Makefile +2 -1
index a5b4cef..5fc174a 100644
@@ -6,6 +6,7 @@
 obj-$(CONFIG_AMD_PTDMA) += ptdma.o
 
 ptdma-objs := ptdma-ops.o \
-	      ptdma-dev.o
+	      ptdma-dev.o \
+	      ptdma-dmaengine.o
 
 ptdma-$(CONFIG_PCI) += ptdma-pci.o
drivers/dma/ptdma/ptdma-dev.c +8 -0
index e69999b..1a7a982 100644
@@ -357,6 +357,11 @@ int pt_core_init(struct pt_device *pt)
 	/* Put this on the unit list to make it available */
 	pt_add_device(pt);
 
+	/* Register the DMA engine support */
+	ret = pt_dmaengine_register(pt);
+	if (ret)
+		goto e_kthread;
+
 	return 0;
 
 
@@ -382,6 +387,9 @@ void pt_core_destroy(struct pt_device *pt)
 	struct pt_cmd_queue *cmd_q = &pt->cmd_q;
 	struct pt_cmd *cmd;
 
+	/* Unregister the DMA engine */
+	pt_dmaengine_unregister(pt);
+
 	/* Remove this device from the list of available units first */
 	pt_del_device(pt);
 
drivers/dma/ptdma/ptdma-dmaengine.c new file +700 -0

700 lines not on this page · raw message

drivers/dma/ptdma/ptdma.h +43 -0

67 lines not on this page · raw message

Signature · 1 line
2.7.4