Thread (9 messages) 9 messages, 6 authors, 2025-02-27

Re: [PATCH] Revert "dmaengine: qcom: bam_dma: Avoid writing unavailable register"

From: Caleb Connolly <hidden>
Date: 2025-02-08 22:33:35
Also in: linux-arm-msm


On 2/8/25 22:30, Caleb Connolly wrote:
This commit causes a hard crash on sdm845 and likely other platforms.
Revert it until a proper fix is found.

This reverts commit 57a7138d0627309d469719f1845d2778c251f358.

Signed-off-by: Caleb Connolly <redacted>
Missing fixes tag

Fixes: 57a7138d0627 (dmaengine: qcom: bam_dma: Avoid writing unavailable 
register)
quoted hunk ↗ jump to hunk
---
  drivers/dma/qcom/bam_dma.c | 24 ++++++++----------------
  1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index c14557efd577..bbc3276992bb 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -58,11 +58,8 @@ struct bam_desc_hw {
  #define DESC_FLAG_EOB BIT(13)
  #define DESC_FLAG_NWD BIT(12)
  #define DESC_FLAG_CMD BIT(11)
  
-#define BAM_NDP_REVISION_START	0x20
-#define BAM_NDP_REVISION_END	0x27
-
  struct bam_async_desc {
  	struct virt_dma_desc vd;
  
  	u32 num_desc;
@@ -400,9 +397,8 @@ struct bam_device {
  	int irq;
  
  	/* dma start transaction tasklet */
  	struct tasklet_struct task;
-	u32 bam_revision;
  };
  
  /**
   * bam_addr - returns BAM register address
@@ -444,12 +440,10 @@ static void bam_reset(struct bam_device *bdev)
  	val |= BAM_EN;
  	writel_relaxed(val, bam_addr(bdev, 0, BAM_CTRL));
  
  	/* set descriptor threshold, start with 4 bytes */
-	if (in_range(bdev->bam_revision, BAM_NDP_REVISION_START,
-		     BAM_NDP_REVISION_END))
-		writel_relaxed(DEFAULT_CNT_THRSHLD,
-			       bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
+	writel_relaxed(DEFAULT_CNT_THRSHLD,
+			bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
  
  	/* Enable default set of h/w workarounds, ie all except BAM_FULL_PIPE */
  	writel_relaxed(BAM_CNFG_BITS_DEFAULT, bam_addr(bdev, 0, BAM_CNFG_BITS));
  
@@ -1005,12 +999,11 @@ static void bam_apply_new_config(struct bam_chan *bchan,
  		if (dir == DMA_DEV_TO_MEM)
  			maxburst = bchan->slave.src_maxburst;
  		else
  			maxburst = bchan->slave.dst_maxburst;
-		if (in_range(bdev->bam_revision, BAM_NDP_REVISION_START,
-			     BAM_NDP_REVISION_END))
-			writel_relaxed(maxburst,
-				       bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
+
+		writel_relaxed(maxburst,
+			       bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
  	}
  
  	bchan->reconfigure = 0;
  }
@@ -1198,13 +1191,12 @@ static int bam_init(struct bam_device *bdev)
  {
  	u32 val;
  
  	/* read revision and configuration information */
-	val = readl_relaxed(bam_addr(bdev, 0, BAM_REVISION));
-	if (!bdev->num_ees)
+	if (!bdev->num_ees) {
+		val = readl_relaxed(bam_addr(bdev, 0, BAM_REVISION));
  		bdev->num_ees = (val >> NUM_EES_SHIFT) & NUM_EES_MASK;
-
-	bdev->bam_revision = val & REVISION_MASK;
+	}
  
  	/* check that configured EE is within range */
  	if (bdev->ee >= bdev->num_ees)
  		return -EINVAL;
-- 
Caleb (they/them)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help