mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Varadarajan Narayanan <quic_varada@quicinc.com>
To: Md Sadre Alam <quic_mdalam@quicinc.com>
Cc: <vkoul@kernel.org>, <ulf.hansson@linaro.org>,
	<martin.petersen@oracle.com>, <kees@kernel.org>,
	<dave.jiang@intel.com>, <av2082000@gmail.com>,
	<linux-arm-msm@vger.kernel.org>, <dmaengine@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <quic_srichara@quicinc.com>
Subject: Re: [PATCH] dmaengine: qcom: bam_dma: Avoid writing unavailable register
Date: Sat, 23 Nov 2024 10:06:55 +0530	[thread overview]
Message-ID: <Z0Fb5xBolEtwyUKb@hu-varada-blr.qualcomm.com> (raw)
In-Reply-To: <20241122071649.2618320-1-quic_mdalam@quicinc.com>

On Fri, Nov 22, 2024 at 12:46:49PM +0530, Md Sadre Alam wrote:
> 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 avoid writing
> this register for clients who is using BAM-Lite mode.
>
> Signed-off-by: Md Sadre Alam <quic_mdalam@quicinc.com>
> ---
>  drivers/dma/qcom/bam_dma.c | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
> index d43a881e43b9..13a08c03746b 100644
> --- a/drivers/dma/qcom/bam_dma.c
> +++ b/drivers/dma/qcom/bam_dma.c
> @@ -59,6 +59,9 @@ struct bam_desc_hw {
>  #define DESC_FLAG_NWD BIT(12)
>  #define DESC_FLAG_CMD BIT(11)
>
> +#define BAM_LITE	0x13
> +#define BAM_NDP		0x20
> +
>  struct bam_async_desc {
>  	struct virt_dma_desc vd;
>
> @@ -398,6 +401,7 @@ struct bam_device {
>
>  	/* dma start transaction tasklet */
>  	struct tasklet_struct task;
> +	u32 bam_revision;
>  };
>
>  /**
> @@ -441,8 +445,9 @@ static void bam_reset(struct bam_device *bdev)
>  	writel_relaxed(val, bam_addr(bdev, 0, BAM_CTRL));
>
>  	/* set descriptor threshold, start with 4 bytes */
> -	writel_relaxed(DEFAULT_CNT_THRSHLD,
> -			bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
> +	if (bdev->bam_revision >= BAM_LITE && bdev->bam_revision < BAM_NDP)
> +		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));
> @@ -1000,9 +1005,9 @@ static void bam_apply_new_config(struct bam_chan *bchan,
>  			maxburst = bchan->slave.src_maxburst;
>  		else
>  			maxburst = bchan->slave.dst_maxburst;
> -
> -		writel_relaxed(maxburst,
> -			       bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
> +		if (bdev->bam_revision >= BAM_LITE && bdev->bam_revision < BAM_NDP)
> +			writel_relaxed(maxburst,
> +				       bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
>  	}
>
>  	bchan->reconfigure = 0;
> @@ -1192,10 +1197,11 @@ static int bam_init(struct bam_device *bdev)
>  	u32 val;
>
>  	/* read revision and configuration information */
> -	if (!bdev->num_ees) {
> -		val = readl_relaxed(bam_addr(bdev, 0, BAM_REVISION));
> +	val = readl_relaxed(bam_addr(bdev, 0, BAM_REVISION));
> +	if (!bdev->num_ees)
>  		bdev->num_ees = (val >> NUM_EES_SHIFT) & NUM_EES_MASK;
> -	}
> +
> +	bdev->bam_revision = val & 0xff;

Use REVISION_MASK instead of 0xff

-Varada

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

  reply	other threads:[~2024-11-23  4:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-22  7:16 Md Sadre Alam
2024-11-23  4:36 ` Varadarajan Narayanan [this message]
2024-11-26  4:57   ` Md Sadre Alam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z0Fb5xBolEtwyUKb@hu-varada-blr.qualcomm.com \
    --to=quic_varada@quicinc.com \
    --cc=av2082000@gmail.com \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=quic_mdalam@quicinc.com \
    --cc=quic_srichara@quicinc.com \
    --cc=ulf.hansson@linaro.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®