Skip to content

Commit 57a7138

Browse files
Md Sadre Alamvinodkoul
authored andcommitted
dmaengine: qcom: bam_dma: Avoid writing unavailable register
Avoid writing unavailable register in BAM-Lite mode. BAM_DESC_CNT_TRSHLD register is unavailable in BAM-Lite mode. Its only available in BAM-NDP mode. So only write this register for clients who is using BAM-NDP. Signed-off-by: Md Sadre Alam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 3082137 commit 57a7138

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

drivers/dma/qcom/bam_dma.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ struct bam_desc_hw {
5959
#define DESC_FLAG_NWD BIT(12)
6060
#define DESC_FLAG_CMD BIT(11)
6161

62+
#define BAM_NDP_REVISION_START 0x20
63+
#define BAM_NDP_REVISION_END 0x27
64+
6265
struct bam_async_desc {
6366
struct virt_dma_desc vd;
6467

@@ -398,6 +401,7 @@ struct bam_device {
398401

399402
/* dma start transaction tasklet */
400403
struct tasklet_struct task;
404+
u32 bam_revision;
401405
};
402406

403407
/**
@@ -441,8 +445,10 @@ static void bam_reset(struct bam_device *bdev)
441445
writel_relaxed(val, bam_addr(bdev, 0, BAM_CTRL));
442446

443447
/* set descriptor threshold, start with 4 bytes */
444-
writel_relaxed(DEFAULT_CNT_THRSHLD,
445-
bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
448+
if (in_range(bdev->bam_revision, BAM_NDP_REVISION_START,
449+
BAM_NDP_REVISION_END))
450+
writel_relaxed(DEFAULT_CNT_THRSHLD,
451+
bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
446452

447453
/* Enable default set of h/w workarounds, ie all except BAM_FULL_PIPE */
448454
writel_relaxed(BAM_CNFG_BITS_DEFAULT, bam_addr(bdev, 0, BAM_CNFG_BITS));
@@ -1000,9 +1006,10 @@ static void bam_apply_new_config(struct bam_chan *bchan,
10001006
maxburst = bchan->slave.src_maxburst;
10011007
else
10021008
maxburst = bchan->slave.dst_maxburst;
1003-
1004-
writel_relaxed(maxburst,
1005-
bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
1009+
if (in_range(bdev->bam_revision, BAM_NDP_REVISION_START,
1010+
BAM_NDP_REVISION_END))
1011+
writel_relaxed(maxburst,
1012+
bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
10061013
}
10071014

10081015
bchan->reconfigure = 0;
@@ -1192,10 +1199,11 @@ static int bam_init(struct bam_device *bdev)
11921199
u32 val;
11931200

11941201
/* read revision and configuration information */
1195-
if (!bdev->num_ees) {
1196-
val = readl_relaxed(bam_addr(bdev, 0, BAM_REVISION));
1202+
val = readl_relaxed(bam_addr(bdev, 0, BAM_REVISION));
1203+
if (!bdev->num_ees)
11971204
bdev->num_ees = (val >> NUM_EES_SHIFT) & NUM_EES_MASK;
1198-
}
1205+
1206+
bdev->bam_revision = val & REVISION_MASK;
11991207

12001208
/* check that configured EE is within range */
12011209
if (bdev->ee >= bdev->num_ees)

0 commit comments

Comments
 (0)