Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: dw-axi-dmac: Add support for CV1800B DMA

As the DMA controller on Sophgo CV1800 series SoC only has 8 channels,
the SoC provides a dma multiplexer to reuse the DMA channel. However,
the dma multiplexer also controls the DMA interrupt multiplexer, which
means that the dma multiplexer needs to know the channel number.

Allow the driver to use DMA phandle args as the channel number, so the
DMA multiplexer can route the DMA interrupt correctly.

Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260120013706.436742-3-inochiama@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Inochi Amaoto and committed by
Vinod Koul
b49c7027 be3e2a04

+22 -4
+21 -4
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
··· 50 50 #define AXI_DMA_FLAG_HAS_APB_REGS BIT(0) 51 51 #define AXI_DMA_FLAG_HAS_RESETS BIT(1) 52 52 #define AXI_DMA_FLAG_USE_CFG2 BIT(2) 53 + #define AXI_DMA_FLAG_ARG0_AS_CHAN BIT(3) 53 54 54 55 static inline void 55 56 axi_dma_iowrite32(struct axi_dma_chip *chip, u32 reg, u32 val) ··· 1358 1357 static struct dma_chan *dw_axi_dma_of_xlate(struct of_phandle_args *dma_spec, 1359 1358 struct of_dma *ofdma) 1360 1359 { 1360 + unsigned int handshake = dma_spec->args[0]; 1361 1361 struct dw_axi_dma *dw = ofdma->of_dma_data; 1362 - struct axi_dma_chan *chan; 1362 + struct axi_dma_chan *chan = NULL; 1363 1363 struct dma_chan *dchan; 1364 1364 1365 - dchan = dma_get_any_slave_channel(&dw->dma); 1365 + if (dw->hdata->use_handshake_as_channel_number) { 1366 + if (handshake >= dw->hdata->nr_channels) 1367 + return NULL; 1368 + 1369 + chan = &dw->chan[handshake]; 1370 + dchan = dma_get_slave_channel(&chan->vc.chan); 1371 + } else { 1372 + dchan = dma_get_any_slave_channel(&dw->dma); 1373 + } 1374 + 1366 1375 if (!dchan) 1367 1376 return NULL; 1368 1377 1369 - chan = dchan_to_axi_dma_chan(dchan); 1370 - chan->hw_handshake_num = dma_spec->args[0]; 1378 + if (!chan) 1379 + chan = dchan_to_axi_dma_chan(dchan); 1380 + chan->hw_handshake_num = handshake; 1371 1381 return dchan; 1372 1382 } 1373 1383 ··· 1516 1504 if (ret) 1517 1505 return ret; 1518 1506 } 1507 + 1508 + chip->dw->hdata->use_handshake_as_channel_number = !!(flags & AXI_DMA_FLAG_ARG0_AS_CHAN); 1519 1509 1520 1510 chip->dw->hdata->use_cfg2 = !!(flags & AXI_DMA_FLAG_USE_CFG2); 1521 1511 ··· 1674 1660 }, { 1675 1661 .compatible = "intel,kmb-axi-dma", 1676 1662 .data = (void *)AXI_DMA_FLAG_HAS_APB_REGS, 1663 + }, { 1664 + .compatible = "sophgo,cv1800b-axi-dma", 1665 + .data = (void *)AXI_DMA_FLAG_ARG0_AS_CHAN, 1677 1666 }, { 1678 1667 .compatible = "starfive,jh7110-axi-dma", 1679 1668 .data = (void *)(AXI_DMA_FLAG_HAS_RESETS | AXI_DMA_FLAG_USE_CFG2),
+1
drivers/dma/dw-axi-dmac/dw-axi-dmac.h
··· 34 34 bool reg_map_8_channels; 35 35 bool restrict_axi_burst_len; 36 36 bool use_cfg2; 37 + bool use_handshake_as_channel_number; 37 38 }; 38 39 39 40 struct axi_dma_chan {