aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dma/xilinx/xilinx_dma.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index 93435f7002ab..d59af2b33a99 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -161,7 +161,9 @@
161#define XILINX_DMA_REG_BTT 0x28 161#define XILINX_DMA_REG_BTT 0x28
162 162
163/* AXI DMA Specific Masks/Bit fields */ 163/* AXI DMA Specific Masks/Bit fields */
164#define XILINX_DMA_MAX_TRANS_LEN GENMASK(22, 0) 164#define XILINX_DMA_MAX_TRANS_LEN_MIN 8
165#define XILINX_DMA_MAX_TRANS_LEN_MAX 23
166#define XILINX_DMA_V2_MAX_TRANS_LEN_MAX 26
165#define XILINX_DMA_CR_COALESCE_MAX GENMASK(23, 16) 167#define XILINX_DMA_CR_COALESCE_MAX GENMASK(23, 16)
166#define XILINX_DMA_CR_CYCLIC_BD_EN_MASK BIT(4) 168#define XILINX_DMA_CR_CYCLIC_BD_EN_MASK BIT(4)
167#define XILINX_DMA_CR_COALESCE_SHIFT 16 169#define XILINX_DMA_CR_COALESCE_SHIFT 16
@@ -2626,7 +2628,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
2626 struct xilinx_dma_device *xdev; 2628 struct xilinx_dma_device *xdev;
2627 struct device_node *child, *np = pdev->dev.of_node; 2629 struct device_node *child, *np = pdev->dev.of_node;
2628 struct resource *io; 2630 struct resource *io;
2629 u32 num_frames, addr_width; 2631 u32 num_frames, addr_width, len_width;
2630 int i, err; 2632 int i, err;
2631 2633
2632 /* Allocate and initialize the DMA engine structure */ 2634 /* Allocate and initialize the DMA engine structure */
@@ -2658,10 +2660,24 @@ static int xilinx_dma_probe(struct platform_device *pdev)
2658 2660
2659 /* Retrieve the DMA engine properties from the device tree */ 2661 /* Retrieve the DMA engine properties from the device tree */
2660 xdev->has_sg = of_property_read_bool(node, "xlnx,include-sg"); 2662 xdev->has_sg = of_property_read_bool(node, "xlnx,include-sg");
2661 xdev->max_buffer_len = XILINX_DMA_MAX_TRANS_LEN; 2663 xdev->max_buffer_len = GENMASK(XILINX_DMA_MAX_TRANS_LEN_MAX - 1, 0);
2662 2664
2663 if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) 2665 if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
2664 xdev->mcdma = of_property_read_bool(node, "xlnx,mcdma"); 2666 xdev->mcdma = of_property_read_bool(node, "xlnx,mcdma");
2667 if (!of_property_read_u32(node, "xlnx,sg-length-width",
2668 &len_width)) {
2669 if (len_width < XILINX_DMA_MAX_TRANS_LEN_MIN ||
2670 len_width > XILINX_DMA_V2_MAX_TRANS_LEN_MAX) {
2671 dev_warn(xdev->dev,
2672 "invalid xlnx,sg-length-width property value. Using default width\n");
2673 } else {
2674 if (len_width > XILINX_DMA_MAX_TRANS_LEN_MAX)
2675 dev_warn(xdev->dev, "Please ensure that IP supports buffer length > 23 bits\n");
2676 xdev->max_buffer_len =
2677 GENMASK(len_width - 1, 0);
2678 }
2679 }
2680 }
2665 2681
2666 if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { 2682 if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {
2667 err = of_property_read_u32(node, "xlnx,num-fstores", 2683 err = of_property_read_u32(node, "xlnx,num-fstores",