Re: [PATCH v6 2/2] Add Intel LGM soc DMA support.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

...

> > > +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?

> > > +	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.

...

> > > +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.
 */

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux