Re: [PATCH 07/15] dmaengine: dw: revisit data_width property

From: Andy Shevchenko
Date: Mon Jan 25 2016 - 03:47:32 EST


On Mon, 2016-01-25 at 07:32 +0000, Vineet Gupta wrote:
> On Monday 25 January 2016 12:55 AM, Mans Rullgard wrote:
> > From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> >
> > There are several changes are done here:
> >
> > Â- Convert the property to be in bytes
> >
> > ÂÂÂMuch more convenient than keeping encoded value.
> >
> > Â- Use one value for all AHB masters for now
> >
> > ÂÂÂIt seems in practice we have no controllers where masters have
> > different
> > ÂÂÂdata bus width, we still might return to distinct values when
> > there is a use
> > ÂÂÂcase.
> >
> > Â- Rename data_width to data-width in the device tree bindings.
> >
> > Â- While here, replace dwc_fast_ffs() by __ffs().
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> > Signed-off-by: Mans Rullgard <mans@xxxxxxxxx>
> > ---
> > This patch changes the DT binding, so it should probably be amended
> > for
> > compatibility with old device trees.ÂÂI've included it as is since
> > I think
> > the change as such is good.
> > ---
> > ÂDocumentation/devicetree/bindings/dma/snps-dma.txt |ÂÂ5 ++-
> > Âarch/arc/boot/dts/abilis_tb10x.dtsiÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> > Âarch/arm/boot/dts/spear13xx.dtsiÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ4 +--
> > Âdrivers/dma/dw/core.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 40 +++-------
> > ------------
> > Âdrivers/dma/dw/platform.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ8 ++---
> > Âdrivers/dma/dw/regs.hÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> > Âinclude/linux/platform_data/dma-dw.hÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ5 ++-
> > Â7 files changed, 16 insertions(+), 50 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/dma/snps-dma.txt
> > b/Documentation/devicetree/bindings/dma/snps-dma.txt
> > index c99c1ffac199..fe7f7710a6b4 100644
> > --- a/Documentation/devicetree/bindings/dma/snps-dma.txt
> > +++ b/Documentation/devicetree/bindings/dma/snps-dma.txt
> > @@ -13,8 +13,7 @@ Required properties:
> > Â- chan_priority: priority of channels. 0 (default): increase from
> > chan 0->n, 1:
> > ÂÂÂincrease from chan n->0
> > Â- block_size: Maximum block size supported by the controller
> > -- data_width: Maximum data width supported by hardware per AHB
> > master
> > -ÂÂ(0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
> > +- data-width: Maximum data width supported by hardware (in bytes)
>
> To the reader this suggests a value truely byte granular, but code
> uses ffs
> implying that it is still power of 2.
> Can you mention this here (....in bytes, always power of 2).

While this comment is good, I have still note that using non-power of 2
values will not break anything. Least power of two number will be used
in that case. So, means I would suggest to replace 'always' by 'better
to be' or something like that.

>
> > ...
> > @@ -726,10 +710,7 @@ dwc_prep_dma_memcpy(struct dma_chan *chan,
> > dma_addr_t dest, dma_addr_t src,
> > Â
> > Â dwc->direction = DMA_MEM_TO_MEM;
> > Â
> > - data_width = dw->data_width[dwc->m_master];
> > -
> > - src_width = dst_width = min_t(unsigned int, data_width,
> > - ÂÂÂÂÂÂdwc_fast_ffs(src | dest |
> > len));
> > + src_width = dst_width = __ffs(dw->data_width | src | dest
> > | len);
> > ...
>
> -Vineet

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy