]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dmaengine: switchtec-dma: fix FIELD_GET misuse when programming SE threshold
authorDavid Carlier <devnexen@gmail.com>
Tue, 17 Mar 2026 08:32:52 +0000 (08:32 +0000)
committerVinod Koul <vkoul@kernel.org>
Tue, 30 Jun 2026 11:22:11 +0000 (16:52 +0530)
FIELD_GET(SE_THRESH_MASK, thresh) extracts bits [31:23] from thresh and
right-shifts them, which is the inverse of the intended operation. Since
thresh is derived from se_buf_len / 2 (at most 255), bits [31:23] are
always zero, so the SE threshold is never actually programmed into the
register.

Use FIELD_PREP() instead to correctly left-shift thresh into bits [31:23]
of the valid_en_se register, consistent with the FIELD_PREP usage for
the perf tuner config just above.

Fixes: 30eba9df76ad ("dmaengine: switchtec-dma: Implement hardware initialization and cleanup")
Signed-off-by: David Carlier <devnexen@gmail.com>
Review-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260317083252.13224-1-devnexen@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/switchtec_dma.c

index 3ef928640615934461b619c2e49a19b2541a4cc5..71d9868ce613e2437c35998b1196f14c821a42a8 100644 (file)
@@ -1099,7 +1099,7 @@ static int switchtec_dma_chan_init(struct switchtec_dma_dev *swdma_dev,
        dev_dbg(&pdev->dev, "Channel %d: SE buffer count %d\n", i, se_buf_len);
 
        thresh = se_buf_len / 2;
-       valid_en_se |= FIELD_GET(SE_THRESH_MASK, thresh);
+       valid_en_se |= FIELD_PREP(SE_THRESH_MASK, thresh);
        writel(valid_en_se, &swdma_chan->mmio_chan_fw->valid_en_se);
 
        /* request irqs */