Skip to content

Commit 1d1d7d6

Browse files
pelwellpopcornmix
authored andcommitted
misc: rp1-pio: Get burst size from DMA capabilities
Although the PIO throughput benefits from larger burst sizes, only the first two DMA channels support a burst size of 8 - the others are capped at 4. To avoid misconfiguring the PIO hardware, retrieve the actual max_burst value from the DMA channel's capabilities. Signed-off-by: Phil Elwell <phil@raspberrypi.com>
1 parent c61c130 commit 1d1d7d6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/misc/rp1-pio.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ static int rp1_pio_sm_config_xfer_internal(struct rp1_pio_client *client, uint s
611611
struct platform_device *pdev = pio->pdev;
612612
struct device *dev = &pdev->dev;
613613
struct dma_slave_config config = {};
614+
struct dma_slave_caps dma_caps;
614615
phys_addr_t fifo_addr;
615616
struct dma_info *dma;
616617
uint32_t dma_mask;
@@ -676,10 +677,12 @@ static int rp1_pio_sm_config_xfer_internal(struct rp1_pio_client *client, uint s
676677
config.src_addr = fifo_addr;
677678
config.dst_addr = fifo_addr;
678679
config.direction = (dir == RP1_PIO_DIR_TO_SM) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
680+
dma_caps.max_burst = 4;
681+
dma_get_slave_caps(dma->chan, &dma_caps);
679682
if (dir == RP1_PIO_DIR_TO_SM)
680-
config.dst_maxburst = 8;
683+
config.dst_maxburst = dma_caps.max_burst;
681684
else
682-
config.src_maxburst = 8;
685+
config.src_maxburst = dma_caps.max_burst;
683686

684687
ret = dmaengine_slave_config(dma->chan, &config);
685688
if (ret)

0 commit comments

Comments
 (0)