devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Reddy, MallikarjunaX" <mallikarjunax.reddy@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: dmaengine@vger.kernel.org, vkoul@kernel.org,
	devicetree@vger.kernel.org, robh+dt@kernel.org,
	linux-kernel@vger.kernel.org, chuanhua.lei@linux.intel.com,
	cheol.yong.kim@intel.com, qi-ming.wu@intel.com,
	malliamireddy009@gmail.com, peter.ujfalusi@ti.com
Subject: Re: [PATCH v6 2/2] Add Intel LGM soc DMA support.
Date: Mon, 21 Sep 2020 23:13:22 +0800	[thread overview]
Message-ID: <bc6499da-1179-25c1-a624-bf2566354ead@linux.intel.com> (raw)
In-Reply-To: <20200918122029.GX3956970@smile.fi.intel.com>

Hi Andy,
Thanks for your comments. My comments are in line.

On 9/18/2020 8:20 PM, Andy Shevchenko wrote:
> On Fri, Sep 18, 2020 at 11:42:54AM +0800, Reddy, MallikarjunaX wrote:
>> On 9/9/2020 7:14 PM, Andy Shevchenko wrote:
>>> On Wed, Sep 09, 2020 at 07:07:34AM +0800, Amireddy Mallikarjuna reddy wrote:
> ...
>
>>>> +	help
>>>> +	  Enable support for intel Lightning Mountain SOC DMA controllers.
>>>> +	  These controllers provide DMA capabilities for a variety of on-chip
>>>> +	  devices such as SSC, HSNAND and GSWIP.
>>> And how module will be called?
>>   are you expecting to include 'default y' ?
> I'm expecting to see something like "if you choose M the module will be called
> bla-foo-bar." Look at the existing examples in the kernel.
ok, i will change bool to tristate.
>
> ...
>
>>>> +ldma_update_bits(struct ldma_dev *d, u32 mask, u32 val, u32 ofs)
>>>> +{
>>>> +	u32 old_val, new_val;
>>>> +
>>>> +	old_val = readl(d->base +  ofs);
>>>> +	new_val = (old_val & ~mask) | (val & mask);
>>> With bitfield.h you will have this as u32_replace_bits().
>> -  new_val = (old_val & ~mask) | (val & mask);
>> + new_val = old_val;
>> + u32_replace_bits(new_val, val, mask);
>>
>> I think in this function we cant use this because of compilation issues
>> thrown by bitfield.h . Expecting 2nd and 3rd arguments as constant numbers
>> not as type variables.
>>
>> ex:
>> 	u32_replace_bits(val, 0, IPA_REG_ENDP_ROUTER_HASH_MSK_ALL);
> How comes these are constants? In the above you have a function which does
> r-m-w approach to the register. It should be something like
>
> 	old = read();
> 	new = u32_replace_bits(old, ...);
> 	write(new);
>
>> ./include/linux/bitfield.h:131:3: error: call to '__field_overflow' declared
>> with attribute error: value doesn't fit into mask
>>     __field_overflow();     \
>>     ^~~~~~~~~~~~~~~~~~
>>
>> ./include/linux/bitfield.h:119:3: error: call to '__bad_mask' declared with
>> attribute error: bad bitfield mask
>>     __bad_mask();
>>     ^~~~~~~~~~~~
> So, even with constants u32_replace_bits() must work. Maybe you didn't get how?

Thanks Andy, now i know how u32_replace_bits() is working.

The mask is not the continuous bits in some cases. Due to the mask bits 
are not continuous u32_replace_bits() can't be used here.
Ex:
         u32 mask = DMA_CPOLL_EN | DMA_CPOLL_CNT;

Comes to __field_overflow error, update bits in the 'val' are aligned 
with mask bits. Because of the this reason in u32_replace_bits() 'val'  
exceeds the 'mask' in some cases which is causing __field_overflow error.

>>>> +	if (new_val != old_val)
>>>> +		writel(new_val, d->base + ofs);
>>>> +}
> ...
>
>>>> +	/* High 4 bits */
>>> Why only 4?
>> this is higher 4 bits of 36 bit addressing..
> Make it clear in the comment.
ok.
>
> ...
>
>>>> +device_initcall(intel_ldma_init);
>>> Each _initcall() in general should be explained.
>> ok. is it fine?
>>
>> /* Perform this driver as device_initcall to make sure initialization
>> happens
>>   * before its dma clients of some are platform specific. make sure to
>> provice
>>   * registered dma channels and dma capabilities to client before their
>>   * initialization.
>>   */
> /*
>   * Just follow proper multi-line comment style.
>   * And use dma -> DMA.
>   */
Ok.

  reply	other threads:[~2020-09-21 15:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 23:07 [PATCH v6 0/2] Add Intel LGM soc DMA support Amireddy Mallikarjuna reddy
     [not found] ` <748370a51af0ab768e542f1537d1aa3aeefebe8a.1599605765.git.mallikarjunax.reddy@linux.intel.com>
2020-09-09 11:14   ` [PATCH v6 2/2] " Andy Shevchenko
     [not found]     ` <36a42016-3260-3933-bbf9-9203c4124115@linux.intel.com>
2020-09-18 12:20       ` Andy Shevchenko
2020-09-21 15:13         ` Reddy, MallikarjunaX [this message]
     [not found] ` <ff2de5b0e4cd414420d48377c7c97c45d71f6197.1599605765.git.mallikarjunax.reddy@linux.intel.com>
2020-09-09 11:27   ` [PATCH v6 1/2] dt-bindings: dma: Add bindings for intel LGM SOC Vinod Koul

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=bc6499da-1179-25c1-a624-bf2566354ead@linux.intel.com \
    --to=mallikarjunax.reddy@linux.intel.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=cheol.yong.kim@intel.com \
    --cc=chuanhua.lei@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=malliamireddy009@gmail.com \
    --cc=peter.ujfalusi@ti.com \
    --cc=qi-ming.wu@intel.com \
    --cc=robh+dt@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 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).