Skip to contentSkip to conversation

dma: Support for multiple PTDMA

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

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 dma: Support for multiple PTDMA

From: Sanjay R Mehta <[email protected]>

Enable management of multiple PTDMA engine in a system. Each device will get a unique identifier, as well as uniquely named resources. Treat each PTDMA as an orthogonal unit and register resources individually.

---
 drivers/dma/ptdma/ptdma-dev.c |   7 +--
 drivers/dma/ptdma/ptdma-ops.c | 111 ++++++++++++++++++++++++++++++++++++++----
 drivers/dma/ptdma/ptdma.h     |   5 ++
 3 files changed, 110 insertions(+), 13 deletions(-)
drivers/dma/ptdma/ptdma-dev.c +4 -3
index ce3e85d..e69999b 100644
@@ -245,7 +245,7 @@ int pt_core_init(struct pt_device *pt)
 	iowrite32(CMD_CONFIG_REQID, pt->io_regs + CMD_REQID_CONFIG_OFFSET);
 
 	/* Allocate a dma pool for the queue */
-	snprintf(dma_pool_name, sizeof(dma_pool_name), "pt_q");
+	snprintf(dma_pool_name, sizeof(dma_pool_name), "%s_q", pt->name);
 	dma_pool = dma_pool_create(dma_pool_name, dev,
 				   PT_DMAPOOL_MAX_SIZE,
 				   PT_DMAPOOL_ALIGN, 0);
@@ -311,7 +311,7 @@ int pt_core_init(struct pt_device *pt)
 
 	dev_dbg(dev, "Requesting an IRQ...\n");
 	/* Request an irq */
-	ret = request_irq(pt->pt_irq, pt_core_irq_handler, 0, "pt", pt);
+	ret = request_irq(pt->pt_irq, pt_core_irq_handler, 0, pt->name, pt);
 	if (ret) {
 		dev_err(dev, "unable to allocate an IRQ\n");
 		goto e_pool;
@@ -338,7 +338,8 @@ int pt_core_init(struct pt_device *pt)
 	dev_dbg(dev, "Starting threads...\n");
 	/* Create a kthread for command queue */
 
-	kthread = kthread_create(pt_cmd_queue_thread, cmd_q, "pt-q");
+	kthread = kthread_create(pt_cmd_queue_thread, cmd_q,
+				 "%s-q", pt->name);
 	if (IS_ERR(kthread)) {
 		dev_err(dev, "error creating queue thread (%ld)\n",
 			PTR_ERR(kthread));
drivers/dma/ptdma/ptdma-ops.c +101 -10

160 lines not on this page · raw message

drivers/dma/ptdma/ptdma.h +5 -0
index 75b8e25..4e89517 100644
@@ -26,6 +26,7 @@
 #include <linux/wait.h>
 #include <linux/dmapool.h>
 
+#define MAX_PT_NAME_LEN			16
 #define MAX_DMAPOOL_NAME_LEN		32
 
 #define MAX_HW_QUEUES			1
@@ -280,7 +281,11 @@ struct pt_cmd_queue {
 } ____cacheline_aligned;
 
 struct pt_device {
+	struct list_head entry;
+
 	unsigned int version;
+	unsigned int ord;
+	char name[MAX_PT_NAME_LEN];
 
 	struct device *dev;
 
Signature · 1 line
2.7.4