From: Zhu Yixin <yzhu@maxlinear.com>
To: <dmaengine@vger.kernel.org>, <vkoul@kernel.org>
Cc: <jchng@maxlinear.com>, <sureshnagaraj@maxlinear.com>,
Zhu Yixin <yzhu@maxlinear.com>
Subject: [PATCH 2/5] dmaengine: lgm-dma: Correct ORRC MAX counter value.
Date: Wed, 30 Jul 2025 10:45:44 +0800 [thread overview]
Message-ID: <20250730024547.3160871-2-yzhu@maxlinear.com> (raw)
In-Reply-To: <20250730024547.3160871-1-yzhu@maxlinear.com>
The maximum ORRC counter is 16.
Sanity check and recify the value when get from device tree.
Signed-off-by: Zhu Yixin <yzhu@maxlinear.com>
---
drivers/dma/lgm/lgm-dma.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/lgm/lgm-dma.c b/drivers/dma/lgm/lgm-dma.c
index 93438cc9f020..ea185c5de1b2 100644
--- a/drivers/dma/lgm/lgm-dma.c
+++ b/drivers/dma/lgm/lgm-dma.c
@@ -140,8 +140,7 @@
#define DMA_VALID_DESC_FETCH_ACK BIT(7)
#define DMA_DFT_DRB BIT(8)
-#define DMA_DFT_ORRC_CNT 16
-#define DMA_ORRC_MAX_CNT (SZ_32 - 1)
+#define DMA_ORRC_MAX_CNT 16
#define DMA_DFT_POLL_CNT SZ_4
#define DMA_DFT_BURST_V22 SZ_2
#define DMA_BURSTL_8DW SZ_8
@@ -406,12 +405,11 @@ static void ldma_dev_orrc_cfg(struct ldma_dev *d)
u32 val = 0;
u32 mask;
- if (d->type == DMA_TYPE_RX)
+ if (d->type == DMA_TYPE_RX || !d->orrc)
return;
mask = DMA_ORRC_EN | DMA_ORRC_ORRCNT;
- if (d->orrc > 0 && d->orrc <= DMA_ORRC_MAX_CNT)
- val = DMA_ORRC_EN | FIELD_PREP(DMA_ORRC_ORRCNT, d->orrc);
+ val = DMA_ORRC_EN | FIELD_PREP(DMA_ORRC_ORRCNT, d->orrc);
spin_lock_irqsave(&d->dev_lock, flags);
ldma_update_bits(d, mask, val, DMA_ORRC);
@@ -946,8 +944,11 @@ static int ldma_parse_dt(struct ldma_dev *d)
d->pollcnt = DMA_DFT_POLL_CNT;
if (fwnode_property_read_u32(fwnode, "intel,dma-orrc",
- &d->orrc))
- d->orrc = DMA_DFT_ORRC_CNT;
+ &d->orrc)) {
+ d->orrc = 0;
+ } else if (d->orrc > DMA_ORRC_MAX_CNT) {
+ d->orrc = DMA_ORRC_MAX_CNT;
+ }
if (fwnode_property_read_u32(fwnode, "intel,dma-type",
&d->type))
--
2.43.5
next prev parent reply other threads:[~2025-07-30 2:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-30 2:45 [PATCH 1/5] dmaengine: lgm-dma: Move platfrom data to device tree Zhu Yixin
2025-07-30 2:45 ` Zhu Yixin [this message]
2025-07-30 2:45 ` [PATCH 3/5] dmaengine: lgm-dma: split legacy DMA and HDMA functions Zhu Yixin
2025-07-30 6:20 ` Krzysztof Kozlowski
2025-07-30 8:52 ` Yi xin Zhu
2025-07-30 2:45 ` [PATCH 4/5] dmaengine: lgm-dma: Added HDMA software mode TX function Zhu Yixin
2025-07-30 6:21 ` Krzysztof Kozlowski
2025-07-30 8:59 ` Yi xin Zhu
2025-07-30 16:17 ` kernel test robot
2025-07-30 2:45 ` [PATCH 5/5] dmaengine: lgm_dma: Added HDMA RX interrupt handle functions Zhu Yixin
2025-07-30 6:19 ` [PATCH 1/5] dmaengine: lgm-dma: Move platfrom data to device tree Krzysztof Kozlowski
2025-07-30 8:43 ` Yi xin Zhu
2025-07-30 8:54 ` Krzysztof Kozlowski
2025-07-31 5:44 ` Yi xin Zhu
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=20250730024547.3160871-2-yzhu@maxlinear.com \
--to=yzhu@maxlinear.com \
--cc=dmaengine@vger.kernel.org \
--cc=jchng@maxlinear.com \
--cc=sureshnagaraj@maxlinear.com \
--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