linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "André Przywara" <andre.przywara@arm.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: Amit Singh Tomar <amittomer25@gmail.com>,
	afaerber@suse.de, manivannan.sadhasivam@linaro.org,
	dan.j.williams@intel.com, cristian.ciocaltea@gmail.com,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-actions@lists.infradead.org
Subject: Re: [PATCH v4 02/10] dmaengine: Actions: Add support for S700 DMA engine
Date: Mon, 29 Jun 2020 12:19:04 +0100	[thread overview]
Message-ID: <36274785-f400-4d69-deed-b7d545718d40@arm.com> (raw)
In-Reply-To: <20200629095446.GH2599@vkoul-mobl>

On 29/06/2020 10:54, Vinod Koul wrote:

Hi Vinod,

> On 24-06-20, 10:35, Andr� Przywara wrote:
>> On 24/06/2020 07:15, Vinod Koul wrote:
>>> On 09-06-20, 15:47, Amit Singh Tomar wrote:
>>>
>>>> @@ -372,6 +383,7 @@ static inline int owl_dma_cfg_lli(struct owl_dma_vchan *vchan,
>>>>  				  struct dma_slave_config *sconfig,
>>>>  				  bool is_cyclic)
>>>>  {
>>>> +	struct owl_dma *od = to_owl_dma(vchan->vc.chan.device);
>>>>  	u32 mode, ctrlb;
>>>>  
>>>>  	mode = OWL_DMA_MODE_PW(0);
>>>> @@ -427,14 +439,26 @@ static inline int owl_dma_cfg_lli(struct owl_dma_vchan *vchan,
>>>>  	lli->hw[OWL_DMADESC_DADDR] = dst;
>>>>  	lli->hw[OWL_DMADESC_SRC_STRIDE] = 0;
>>>>  	lli->hw[OWL_DMADESC_DST_STRIDE] = 0;
>>>> -	/*
>>>> -	 * Word starts from offset 0xC is shared between frame length
>>>> -	 * (max frame length is 1MB) and frame count, where first 20
>>>> -	 * bits are for frame length and rest of 12 bits are for frame
>>>> -	 * count.
>>>> -	 */
>>>> -	lli->hw[OWL_DMADESC_FLEN] = len | FCNT_VAL << 20;
>>>> -	lli->hw[OWL_DMADESC_CTRLB] = ctrlb;
>>>> +
>>>> +	if (od->devid == S700_DMA) {
>>>> +		/* Max frame length is 1MB */
>>>> +		lli->hw[OWL_DMADESC_FLEN] = len;
>>>> +		/*
>>>> +		 * On S700, word starts from offset 0x1C is shared between
>>>> +		 * frame count and ctrlb, where first 12 bits are for frame
>>>> +		 * count and rest of 20 bits are for ctrlb.
>>>> +		 */
>>>> +		lli->hw[OWL_DMADESC_CTRLB] = FCNT_VAL | ctrlb;
>>>> +	} else {
>>>> +		/*
>>>> +		 * On S900, word starts from offset 0xC is shared between
>>>> +		 * frame length (max frame length is 1MB) and frame count,
>>>> +		 * where first 20 bits are for frame length and rest of
>>>> +		 * 12 bits are for frame count.
>>>> +		 */
>>>> +		lli->hw[OWL_DMADESC_FLEN] = len | FCNT_VAL << 20;
>>>> +		lli->hw[OWL_DMADESC_CTRLB] = ctrlb;
>>>
>>> Unfortunately this wont scale, we will keep adding new conditions for
>>> newer SoC's! So rather than this why not encode max frame length in
>>> driver_data rather than S900_DMA/S700_DMA.. In future one can add values
>>> for newer SoC and not code above logic again.
>>
>> What newer SoCs? I don't think we should try to guess the future here.
> 
> In a patch for adding new SoC, quite ironical I would say!

S700 is not a new SoC, it's just this driver didn't support it yet. What
I meant is that I don't even know about the existence of upcoming SoCs
(Google seems clueless), not to speak of documentation to assess which
DMA controller they use.

>> We can always introduce further abstractions later, once we actually
>> *know* what we are looking at.
> 
> Rather if we know we are adding abstractions, why not add in a way that
> makes it scale better rather than rework again

I appreciate the effort, but this really tapping around in the dark,
since we don't know which direction any new DMA controller is taking. I
might not even be similar.

>> Besides, I don't understand what you are after. The max frame length is
>> 1MB in both cases, it's just a matter of where to put FCNT_VAL, either
>> in FLEN or in CTRLB. And having an extra flag for that in driver data
>> sounds a bit over the top at the moment.
> 
> Maybe, maybe not. I would rather make it support N SoC when adding
> support for second one rather than keep adding everytime a new SoC is
> added...

Well, what do you suggest, specifically? At the moment we have two
*slightly* different DMA controllers, so we differentiate between the
two based on the model. Do you want to introduce an extra flag like
FRAME_CNT_IN_CTRLB? That seems to be a bit over the top here, since we
don't know if a future DMA controller is still compatible, or introduces
completely new differences.

Cheers,
Andre

  reply	other threads:[~2020-06-29 19:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 10:17 [PATCH v4 00/10] Add MMC and DMA support for Actions S700 Amit Singh Tomar
2020-06-09 10:17 ` [PATCH v4 01/10] dmaengine: Actions: get rid of bit fields from dma descriptor Amit Singh Tomar
2020-06-09 10:17 ` [PATCH v4 02/10] dmaengine: Actions: Add support for S700 DMA engine Amit Singh Tomar
2020-06-24  6:15   ` Vinod Koul
2020-06-24  9:35     ` André Przywara
2020-06-29  8:28       ` Amit Tomer
2020-06-29  9:54       ` Vinod Koul
2020-06-29 11:19         ` André Przywara [this message]
2020-06-29 13:21           ` Vinod Koul
2020-06-29  8:19     ` Amit Tomer
2020-06-29  9:52       ` Vinod Koul
2020-06-30  9:47         ` Amit Tomer
2020-06-30 14:24           ` Vinod Koul
2020-06-30 18:14             ` Amit Tomer
2020-06-09 10:17 ` [PATCH v4 03/10] clk: actions: Add MMC clock-register reset bits Amit Singh Tomar
2020-06-09 11:29   ` kernel test robot
2020-06-09 10:17 ` [PATCH v4 04/10] arm64: dts: actions: limit address range for pinctrl node Amit Singh Tomar
2020-06-09 10:17 ` [PATCH v4 05/10] dt-bindings: dmaengine: convert Actions Semi Owl SoCs bindings to yaml Amit Singh Tomar
2020-06-17 21:16   ` Rob Herring
2020-06-09 10:17 ` [PATCH v4 06/10] arm64: dts: actions: Add DMA Controller for S700 Amit Singh Tomar
2020-06-09 10:17 ` [PATCH v4 07/10] dt-bindings: reset: s700: Add binding constants for mmc Amit Singh Tomar
2020-06-09 10:17 ` [PATCH v4 08/10] dt-bindings: mmc: owl: add compatible string actions,s700-mmc Amit Singh Tomar
2020-06-09 10:17 ` [PATCH v4 09/10] arm64: dts: actions: Add MMC controller support for S700 Amit Singh Tomar
2020-06-09 10:17 ` [PATCH v4 10/10] arm64: dts: actions: Add uSD support for Cubieboard7 Amit Singh Tomar

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=36274785-f400-4d69-deed-b7d545718d40@arm.com \
    --to=andre.przywara@arm.com \
    --cc=afaerber@suse.de \
    --cc=amittomer25@gmail.com \
    --cc=cristian.ciocaltea@gmail.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-actions@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@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;
as well as URLs for NNTP newsgroup(s).