From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Serge Semin <fancer.lancer@gmail.com>
Cc: "Viresh Kumar" <vireshk@kernel.org>,
"Vinod Koul" <vkoul@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>,
dmaengine@vger.kernel.org, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] dmaengine: dw: Simplify max-burst calculation procedure
Date: Tue, 16 Apr 2024 22:11:58 +0300 [thread overview]
Message-ID: <Zh7NfmffgSBSjVWv@smile.fi.intel.com> (raw)
In-Reply-To: <20240416162908.24180-5-fancer.lancer@gmail.com>
On Tue, Apr 16, 2024 at 07:28:58PM +0300, Serge Semin wrote:
> In order to have a more coherent DW AHB DMA slave configuration method
> let's simplify the source and destination channel max-burst calculation
> procedure:
>
> 1. Create the max-burst verification method as it has been just done for
> the memory and peripheral address widths. Thus the DWC DMA slave config
dwc_config() method
?
> method will turn to a set of the verification methods execution.
>
> 2. Since both the generic DW AHB DMA and Intel DMA32 engines support the
"i" in iDMA 32-bit stands for "integrated", so 'Intel iDMA 32-bit'
> power-of-2 bursts only, then the specified by the client driver max-burst
> values can be converted to being power-of-2 right in the max-burst
> verification method.
>
> 3. Since max-burst encoded value is required on the CTL_LO fields
> calculation stage, the encode_maxburst() callback can be easily dropped
> from the dw_dma structure meanwhile the encoding procedure will be
> executed right in the CTL_LO register value calculation.
>
> Thus the update will provide the next positive effects: the internal
> DMA-slave config structure will contain only the real DMA-transfer config
> value, which will be encoded to the DMA-controller register fields only
> when it's required on the buffer mapping; the redundant encode_maxburst()
> callback will be dropped simplifying the internal HW-abstraction API;
> DWC-config method will look more readable executing the verification
dwc_config() method
?
> functions one-by-one.
...
> +static void dwc_verify_maxburst(struct dma_chan *chan)
It's inconsistent to the rest of _verify methods. It doesn't verify as it
doesn't return anything. Make it int or rename the function.
> +{
> + struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
> +
> + dwc->dma_sconfig.src_maxburst =
> + clamp(dwc->dma_sconfig.src_maxburst, 1U, dwc->max_burst);
> + dwc->dma_sconfig.dst_maxburst =
> + clamp(dwc->dma_sconfig.dst_maxburst, 1U, dwc->max_burst);
> +
> + dwc->dma_sconfig.src_maxburst =
> + rounddown_pow_of_two(dwc->dma_sconfig.src_maxburst);
> + dwc->dma_sconfig.dst_maxburst =
> + rounddown_pow_of_two(dwc->dma_sconfig.dst_maxburst);
> +}
...
> static int dwc_verify_p_buswidth(struct dma_chan *chan)
> - reg_burst = rounddown_pow_of_two(dwc->dma_sconfig.src_maxburst);
> + reg_burst = dwc->dma_sconfig.src_maxburst;
Seems you have a dependency, need a comment below that maxburst has to be
"verified" [whatever] first.
...
> +static inline u8 dw_dma_encode_maxburst(u32 maxburst)
> +{
> + /*
> + * Fix burst size according to dw_dmac. We need to convert them as:
> + * 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3.
> + */
> + return maxburst > 1 ? fls(maxburst) - 2 : 0;
> +}
Split these moves to another preparatory patch.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-04-16 19:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 16:28 [PATCH 0/4] dmaengine: dw: Fix src/dst addr width misconfig Serge Semin
2024-04-16 16:28 ` [PATCH 1/4] dmaengine: dw: Add peripheral bus width verification Serge Semin
2024-04-16 18:00 ` Andy Shevchenko
2024-04-17 19:54 ` Serge Semin
2024-04-18 9:43 ` Andy Shevchenko
2024-04-18 15:47 ` Serge Semin
2024-04-16 16:28 ` [PATCH 2/4] dmaengine: dw: Add memory " Serge Semin
2024-04-16 18:47 ` Andy Shevchenko
2024-04-17 17:13 ` Serge Semin
2024-04-17 17:28 ` Andy Shevchenko
2024-04-17 18:52 ` Serge Semin
2024-04-18 9:37 ` Andy Shevchenko
2024-04-18 15:52 ` Serge Semin
2024-04-16 16:28 ` [PATCH 3/4] dmaengine: dw: Simplify prepare CTL_LO methods Serge Semin
2024-04-16 19:04 ` Andy Shevchenko
2024-04-17 20:11 ` Serge Semin
2024-04-18 11:47 ` Andy Shevchenko
2024-04-18 19:00 ` Serge Semin
2024-04-18 21:00 ` Andy Shevchenko
2024-04-19 9:19 ` Serge Semin
2024-04-16 16:28 ` [PATCH 4/4] dmaengine: dw: Simplify max-burst calculation procedure Serge Semin
2024-04-16 19:11 ` Andy Shevchenko [this message]
2024-04-17 20:35 ` Serge Semin
2024-04-18 11:49 ` Andy Shevchenko
2024-04-18 19:10 ` Serge Semin
2024-04-16 19:13 ` [PATCH 0/4] dmaengine: dw: Fix src/dst addr width misconfig Andy Shevchenko
2024-04-17 17:34 ` Serge Semin
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=Zh7NfmffgSBSjVWv@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=fancer.lancer@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=vireshk@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.