Skip to content

Commit ca38ff1

Browse files
larsclausenVinod Koul
authored andcommitted
dma: pl330: Implement device_slave_caps
Implement the device_slave_caps() callback for the pl330 driver. This allows dmaengine users like the generic ALSA dmaengine PCM driver to query the capabilities of the driver. The PL330 supports all buswidths and both mem-to-dev as well as dev-to-mem transfers. In theory there is no limit on the number of segments that can be transferred (in practice you'll run out of memory eventually) and the number of bytes per segment is limited by the size of the PL330 program buffer. Due to the nature of the PL330 the maximum number of bytes per segment depends on the burstsize, the driver sets it to the value for a 1-byte burstsize, since it is the smallest. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
1 parent 221a27c commit ca38ff1

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎drivers/dma/pl330.c‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,6 +2855,32 @@ static irqreturn_t pl330_irq_handler(int irq, void *data)
28552855
return IRQ_NONE;
28562856
}
28572857

2858+
#define PL330_DMA_BUSWIDTHS \
2859+
BIT(DMA_SLAVE_BUSWIDTH_UNDEFINED) | \
2860+
BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | \
2861+
BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \
2862+
BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) | \
2863+
BIT(DMA_SLAVE_BUSWIDTH_8_BYTES)
2864+
2865+
static int pl330_dma_device_slave_caps(struct dma_chan *dchan,
2866+
struct dma_slave_caps *caps)
2867+
{
2868+
caps->src_addr_widths = PL330_DMA_BUSWIDTHS;
2869+
caps->dstn_addr_widths = PL330_DMA_BUSWIDTHS;
2870+
caps->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
2871+
caps->cmd_pause = false;
2872+
caps->cmd_terminate = true;
2873+
2874+
/*
2875+
* This is the limit for transfers with a buswidth of 1, larger
2876+
* buswidths will have larger limits.
2877+
*/
2878+
caps->max_sg_len = 1900800;
2879+
caps->max_sg_nr = 0;
2880+
2881+
return 0;
2882+
}
2883+
28582884
static int
28592885
pl330_probe(struct amba_device *adev, const struct amba_id *id)
28602886
{
@@ -2959,6 +2985,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
29592985
pd->device_prep_slave_sg = pl330_prep_slave_sg;
29602986
pd->device_control = pl330_control;
29612987
pd->device_issue_pending = pl330_issue_pending;
2988+
pd->device_slave_caps = pl330_dma_device_slave_caps;
29622989

29632990
ret = dma_async_device_register(pd);
29642991
if (ret) {

0 commit comments

Comments
 (0)