[PATCH RFC 3/6] dmaengine: qcom: gpi: Accept protocol ID hints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>

Client drivers may now pass hints to dmaengine drivers. GPI DMA's only
consumers (GENI SEs) need to pass a protocol (I2C, I3C, SPI, etc.) ID
to the DMA engine driver, for it to take different actions.

Currently, that's done through passing that ID through device tree,
with each Serial Engine expressed NUM_PROTOCOL times, resulting in
terrible dt-bindings that are full of useless copypasta.

To help get rid of that, accept the driver cookie instead, while
keeping backwards compatibility.

Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
---
 drivers/dma/qcom/gpi.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c
index 51d19494099dae09f4579ba8c3eddfa0487bf487..de9e564dc21b2230c9446dfb881135003721a750 100644
--- a/drivers/dma/qcom/gpi.c
+++ b/drivers/dma/qcom/gpi.c
@@ -17,6 +17,8 @@
 #include "../dmaengine.h"
 #include "../virt-dma.h"
 
+#include <linux/soc/qcom/geni-se.h>
+
 #define TRE_TYPE_DMA		0x10
 #define TRE_TYPE_IMMEDIATE_DMA	0x11
 #define TRE_TYPE_GO		0x20
@@ -2109,15 +2111,19 @@ static int gpi_find_avail_gpii(struct gpi_dev *gpi_dev, u32 seid)
 /* gpi_of_dma_xlate: open client requested channel */
 static struct dma_chan *gpi_of_dma_xlate(struct of_phandle_args *args,
 					 struct of_dma *of_dma,
-					 void *data)
+					 void *proto)
 {
 	struct gpi_dev *gpi_dev = (struct gpi_dev *)of_dma->of_dma_data;
 	u32 seid, chid;
 	int gpii;
 	struct gchan *gchan;
 
-	if (args->args_count < 3) {
-		dev_err(gpi_dev->dev, "gpii require minimum 2 args, client passed:%d args\n",
+	/* The protocol ID has been historically stored in the third cell */
+	if (!proto && args->args_count < 3)
+		return NULL;
+
+	if (args->args_count < 2) {
+		dev_err(gpi_dev->dev, "gpii requires minimum 2 args, client passed:%d args\n",
 			args->args_count);
 		return NULL;
 	}
@@ -2145,7 +2151,8 @@ static struct dma_chan *gpi_of_dma_xlate(struct of_phandle_args *args,
 	}
 
 	gchan->seid = seid;
-	gchan->protocol = args->args[2];
+	/* The protocol ID is in the teens range, simply ignore the higher bits */
+	gchan->protocol = (u32)((u64)proto);
 
 	return dma_get_slave_channel(&gchan->vc.chan);
 }

-- 
2.50.1





[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux