mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
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>
This commit is contained in:
@@ -611,6 +611,7 @@ static int rp1_pio_sm_config_xfer_internal(struct rp1_pio_client *client, uint s
|
|||||||
struct platform_device *pdev = pio->pdev;
|
struct platform_device *pdev = pio->pdev;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct dma_slave_config config = {};
|
struct dma_slave_config config = {};
|
||||||
|
struct dma_slave_caps dma_caps;
|
||||||
phys_addr_t fifo_addr;
|
phys_addr_t fifo_addr;
|
||||||
struct dma_info *dma;
|
struct dma_info *dma;
|
||||||
uint32_t dma_mask;
|
uint32_t dma_mask;
|
||||||
@@ -676,10 +677,12 @@ static int rp1_pio_sm_config_xfer_internal(struct rp1_pio_client *client, uint s
|
|||||||
config.src_addr = fifo_addr;
|
config.src_addr = fifo_addr;
|
||||||
config.dst_addr = fifo_addr;
|
config.dst_addr = fifo_addr;
|
||||||
config.direction = (dir == RP1_PIO_DIR_TO_SM) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
|
config.direction = (dir == RP1_PIO_DIR_TO_SM) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
|
||||||
|
dma_caps.max_burst = 4;
|
||||||
|
dma_get_slave_caps(dma->chan, &dma_caps);
|
||||||
if (dir == RP1_PIO_DIR_TO_SM)
|
if (dir == RP1_PIO_DIR_TO_SM)
|
||||||
config.dst_maxburst = 8;
|
config.dst_maxburst = dma_caps.max_burst;
|
||||||
else
|
else
|
||||||
config.src_maxburst = 8;
|
config.src_maxburst = dma_caps.max_burst;
|
||||||
|
|
||||||
ret = dmaengine_slave_config(dma->chan, &config);
|
ret = dmaengine_slave_config(dma->chan, &config);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|||||||
Reference in New Issue
Block a user