Skip to contentSkip to conversation

dmaengine: pl330: Set DMA_INTERRUPT capability and add related callback

PATCH In review Vivek Gautam 2 participants 3 messages Jun 29, 2022 – Jun 30, 2022 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: pl330: Set DMA_INTERRUPT capability and add related callback

With the verification for DMA_INTERRUPT capability added to the dmatest module, the dmatest fails to start for various channels of pl330 dma controller. So, set the DMA_INTERRUPT capability and add the required callback method to set the transaction descriptor flags.

---
 drivers/dma/pl330.c | 24 ++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/dma/pl330.c +24 -0
index 858400e42ec0..b80e48f0970b 100644
@@ -2757,6 +2757,28 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
 	return &desc->txd;
 }
 
+static struct dma_async_tx_descriptor *
+pl330_dma_prep_interrupt(struct dma_chan *chan, unsigned long flags)
+{
+	struct dma_pl330_chan *pch = to_pchan(chan);
+	struct dma_pl330_desc *desc;
+
+	if (unlikely(!pch))
+		return NULL;
+
+	desc = pl330_get_desc(pch);
+	if (!desc) {
+		dev_err(pch->dmac->ddma.dev, "%s:%d Unable to fetch desc\n",
+			__func__, __LINE__);
+		return NULL;
+	}
+
+	/* Set the flags that are passed downstream */
+	desc->txd.flags = flags;
+
+	return &desc->txd;
+}
+
 static struct dma_async_tx_descriptor *
 pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,
 		dma_addr_t src, size_t len, unsigned long flags)
@@ -3111,6 +3133,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 	}
 
 	dma_cap_set(DMA_MEMCPY, pd->cap_mask);
+	dma_cap_set(DMA_INTERRUPT, pd->cap_mask);
 	if (pcfg->num_peri) {
 		dma_cap_set(DMA_SLAVE, pd->cap_mask);
 		dma_cap_set(DMA_CYCLIC, pd->cap_mask);
@@ -3121,6 +3144,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 	pd->device_free_chan_resources = pl330_free_chan_resources;
 	pd->device_prep_dma_memcpy = pl330_prep_dma_memcpy;
 	pd->device_prep_dma_cyclic = pl330_prep_dma_cyclic;
+	pd->device_prep_dma_interrupt = pl330_dma_prep_interrupt;
 	pd->device_tx_status = pl330_tx_status;
 	pd->device_prep_slave_sg = pl330_prep_slave_sg;
 	pd->device_config = pl330_config;
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 4 lines · Vivek Gautam

With the verification for DMA_INTERRUPT capability added to the dmatest module, the dmatest fails to start for various channels of pl330 dma controller. So, set the DMA_INTERRUPT capability and add the required callback method to set the transaction descriptor flags.

Are you sire you want that? See 646728dff254 in linux-next

Thanks

Quoted 57 lines
---
 drivers/dma/pl330.c | 24 ++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/dma/pl330.c +24 -0
index 858400e42ec0..b80e48f0970b 100644
@@ -2757,6 +2757,28 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
 	return &desc->txd;
 }
 
+static struct dma_async_tx_descriptor *
+pl330_dma_prep_interrupt(struct dma_chan *chan, unsigned long flags)
+{
+	struct dma_pl330_chan *pch = to_pchan(chan);
+	struct dma_pl330_desc *desc;
+
+	if (unlikely(!pch))
+		return NULL;
+
+	desc = pl330_get_desc(pch);
+	if (!desc) {
+		dev_err(pch->dmac->ddma.dev, "%s:%d Unable to fetch desc\n",
+			__func__, __LINE__);
+		return NULL;
+	}
+
+	/* Set the flags that are passed downstream */
+	desc->txd.flags = flags;
+
+	return &desc->txd;
+}
+
 static struct dma_async_tx_descriptor *
 pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,
 		dma_addr_t src, size_t len, unsigned long flags)
@@ -3111,6 +3133,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 	}
 
 	dma_cap_set(DMA_MEMCPY, pd->cap_mask);
+	dma_cap_set(DMA_INTERRUPT, pd->cap_mask);
 	if (pcfg->num_peri) {
 		dma_cap_set(DMA_SLAVE, pd->cap_mask);
 		dma_cap_set(DMA_CYCLIC, pd->cap_mask);
@@ -3121,6 +3144,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 	pd->device_free_chan_resources = pl330_free_chan_resources;
 	pd->device_prep_dma_memcpy = pl330_prep_dma_memcpy;
 	pd->device_prep_dma_cyclic = pl330_prep_dma_cyclic;
+	pd->device_prep_dma_interrupt = pl330_dma_prep_interrupt;
 	pd->device_tx_status = pl330_tx_status;
 	pd->device_prep_slave_sg = pl330_prep_slave_sg;
 	pd->device_config = pl330_config;
Signature · 1 line
2.17.1
Signature · 1 line
~Vinod
#2 lore raw

Hi Vinod,

Quoted 7 lines · Vinod Koul
Quoted 4 lines · Vivek Gautam

With the verification for DMA_INTERRUPT capability added to the dmatest module, the dmatest fails to start for various channels of pl330 dma controller. So, set the DMA_INTERRUPT capability and add the required callback method to set the transaction descriptor flags.

Are you sire you want that? See 646728dff254 in linux-next

Thanks for pointing to this. My bad that I missed to notice this patch in lkml.
My patch can be dropped. Sorry for the noise.

Best regards
Vivek

[snip]
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.