lkml.org 
[lkml]   [2022]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v4 4/8] bux/cdx: support dma configuration for CDX devices
Date
With CDX bus supported in SMMU, devices on CDX bus can be
configured to support DMA configuration. This change adds
the dma configure callback for CDX bus.

Signed-off-by: Nipun Gupta <nipun.gupta@amd.com>
---
drivers/bus/cdx/cdx.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 5a366f4ae69c..b2a7e0b34df8 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -57,6 +57,7 @@

#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/of_device.h>
#include <linux/slab.h>
#include <linux/cdx/cdx_bus.h>

@@ -180,10 +181,26 @@ static void cdx_remove(struct device *dev)
cdx_drv->remove(cdx_dev);
}

+static int cdx_dma_configure(struct device *dev)
+{
+ struct cdx_device *cdx_dev = to_cdx_device(dev);
+ u32 input_id = cdx_dev->req_id;
+ int ret;
+
+ ret = of_dma_configure_id(dev, dev->parent->of_node, 0, &input_id);
+ if (ret) {
+ dev_err(dev, "of_dma_configure_id() failed\n");
+ return ret;
+ }
+
+ return 0;
+}
+
struct bus_type cdx_bus_type = {
.name = "cdx",
.match = cdx_bus_match,
.remove = cdx_remove,
+ .dma_configure = cdx_dma_configure,
};
EXPORT_SYMBOL_GPL(cdx_bus_type);

--
2.25.1
\
 
 \ /
  Last update: 2022-10-14 06:43    [W:0.538 / U:1.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site