Skip to contentSkip to conversation

dmaengine: imx-sdma: Correct src_addr_widths and directions

PATCH Applied Nicolin Chen 3 participants 4 messages Sep 14, 2017 – Sep 21, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dmaengine: imx-sdma: Correct src_addr_widths and directions

The driver already supports DMA_DEV_TO_DEV in sdma_config(), DMA_SLAVE_BUSWIDTH_2_BYTES and DMA_SLAVE_BUSWIDTH_1_BYTE in sdma_prep_slave_sg(). So this patch adds them to the lists.

---
 drivers/dma/imx-sdma.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/dma/imx-sdma.c +11 -3
index a67ec1b..2184881 100644
@@ -178,6 +178,14 @@
 #define SDMA_WATERMARK_LEVEL_HWE	BIT(29)
 #define SDMA_WATERMARK_LEVEL_CONT	BIT(31)
 
+#define SDMA_DMA_BUSWIDTHS	(BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | \
+				 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \
+				 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES))
+
+#define SDMA_DMA_DIRECTIONS	(BIT(DMA_DEV_TO_MEM) | \
+				 BIT(DMA_MEM_TO_DEV) | \
+				 BIT(DMA_DEV_TO_DEV))
+
 /*
  * Mode/Count of data node descriptors - IPCv2
  */
@@ -1851,9 +1859,9 @@ static int sdma_probe(struct platform_device *pdev)
 	sdma->dma_device.device_prep_dma_cyclic = sdma_prep_dma_cyclic;
 	sdma->dma_device.device_config = sdma_config;
 	sdma->dma_device.device_terminate_all = sdma_disable_channel_with_delay;
-	sdma->dma_device.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
-	sdma->dma_device.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
-	sdma->dma_device.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
+	sdma->dma_device.src_addr_widths = SDMA_DMA_BUSWIDTHS;
+	sdma->dma_device.dst_addr_widths = SDMA_DMA_BUSWIDTHS;
+	sdma->dma_device.directions = SDMA_DMA_DIRECTIONS;
 	sdma->dma_device.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT;
 	sdma->dma_device.device_issue_pending = sdma_issue_pending;
 	sdma->dma_device.dev->dma_parms = &sdma->dma_parms;
Signature · 1 line
2.1.4
reviewer
#1 lore raw

Hi Nicolin,

Quoted 5 lines · Nicolin Chen

The driver already supports DMA_DEV_TO_DEV in sdma_config(), DMA_SLAVE_BUSWIDTH_2_BYTES and DMA_SLAVE_BUSWIDTH_1_BYTE in sdma_prep_slave_sg(). So this patch adds them to the lists.

Patch looks good.

Just curious: what is the specific usecase that triggered this change?

Thanks

#2 lore raw
Quoted 7 lines · Fabio Estevam

Hi Nicolin,

Quoted 4 lines · Nicolin Chen

The driver already supports DMA_DEV_TO_DEV in sdma_config(), DMA_SLAVE_BUSWIDTH_2_BYTES and DMA_SLAVE_BUSWIDTH_1_BYTE in sdma_prep_slave_sg(). So this patch adds them to the lists.

Quoted 5 lines
Quoted 1 line

Patch looks good.

Just curious: what is the specific usecase that triggered this change?

Any audio test case. The ASoC generic dmaengine gets the DMA cap (4_BYTES only) and apply it to hw->formats in ASoC core. SSI + WM8962 could have S8_LE, S16_LE and S24_LE formats but it turns out that it only has S24_LE now because of this.

I haven't seen any side effect by DMA_DEV_TO_DEV yet but it could potentially break ASRC once a similar constrain based on the "directions" is applied.

Applied
#3 lore raw
In reply to Nicolin Chen
Quoted 3 lines · Nicolin Chen

The driver already supports DMA_DEV_TO_DEV in sdma_config(), DMA_SLAVE_BUSWIDTH_2_BYTES and DMA_SLAVE_BUSWIDTH_1_BYTE in sdma_prep_slave_sg(). So this patch adds them to the lists.

Applied, thanks

Signature · 1 line
~Vinod