From mboxrd@z Thu Jan 1 00:00:00 1970 From: andriy.shevchenko@linux.intel.com (Andy Shevchenko) Date: Mon, 25 Jan 2016 10:45:47 +0200 Subject: [PATCH 07/15] dmaengine: dw: revisit data_width property In-Reply-To: References: <1453663322-14474-1-git-send-email-mans@mansr.com> <1453663322-14474-8-git-send-email-mans@mansr.com> List-ID: Message-ID: <1453711547.2521.209.camel@linux.intel.com> To: linux-snps-arc@lists.infradead.org On Mon, 2016-01-25@07:32 +0000, Vineet Gupta wrote: > On Monday 25 January 2016 12:55 AM, Mans Rullgard wrote: > > From: Andy Shevchenko > > > > 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 > > Signed-off-by: Mans Rullgard > > --- > > 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 Intel Finland Oy From mboxrd@z Thu Jan 1 00:00:00 1970 From: andriy.shevchenko@linux.intel.com (Andy Shevchenko) Date: Mon, 25 Jan 2016 10:45:47 +0200 Subject: [PATCH 07/15] dmaengine: dw: revisit data_width property In-Reply-To: References: <1453663322-14474-1-git-send-email-mans@mansr.com> <1453663322-14474-8-git-send-email-mans@mansr.com> Message-ID: <1453711547.2521.209.camel@linux.intel.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org 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 > > > > 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 > > Signed-off-by: Mans Rullgard > > --- > > 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 Intel Finland Oy From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Subject: Re: [PATCH 07/15] dmaengine: dw: revisit data_width property Date: Mon, 25 Jan 2016 10:45:47 +0200 Message-ID: <1453711547.2521.209.camel@linux.intel.com> References: <1453663322-14474-1-git-send-email-mans@mansr.com> <1453663322-14474-8-git-send-email-mans@mansr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Vineet Gupta , Mans Rullgard , Viresh Kumar , Vinod Koul , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" Cc: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Russell King , Dan Williams , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-snps-arc-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" List-Id: devicetree@vger.kernel.org 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 > >=20 > > There are several changes are done here: > >=20 > > =C2=A0- Convert the property to be in bytes > >=20 > > =C2=A0=C2=A0=C2=A0Much more convenient than keeping encoded value. > >=20 > > =C2=A0- Use one value for all AHB masters for now > >=20 > > =C2=A0=C2=A0=C2=A0It seems in practice we have no controllers where= masters have > > different > > =C2=A0=C2=A0=C2=A0data bus width, we still might return to distinct= values when > > there is a use > > =C2=A0=C2=A0=C2=A0case. > >=20 > > =C2=A0- Rename data_width to data-width in the device tree bindings= =2E > >=20 > > =C2=A0- While here, replace dwc_fast_ffs() by __ffs(). > >=20 > > Signed-off-by: Andy Shevchenko > > Signed-off-by: Mans Rullgard > > --- > > This patch changes the DT binding, so it should probably be amended > > for > > compatibility with old device trees.=C2=A0=C2=A0I've included it as= is since > > I think > > the change as such is good. > > --- > > =C2=A0Documentation/devicetree/bindings/dma/snps-dma.txt |=C2=A0=C2= =A05 ++- > > =C2=A0arch/arc/boot/dts/abilis_tb10x.dtsi=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2= =A0=C2=A02 +- > > =C2=A0arch/arm/boot/dts/spear13xx.dtsi=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0|=C2=A0=C2=A04 +-- > > =C2=A0drivers/dma/dw/core.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| 40 = +++------- > > ------------ > > =C2=A0drivers/dma/dw/platform.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A08 ++--- > > =C2=A0drivers/dma/dw/regs.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0= =C2=A02 +- > > =C2=A0include/linux/platform_data/dma-dw.h=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2= =A05 ++- > > =C2=A07 files changed, 16 insertions(+), 50 deletions(-) > >=20 > > 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: > > =C2=A0- chan_priority: priority of channels. 0 (default): increase = from > > chan 0->n, 1: > > =C2=A0=C2=A0=C2=A0increase from chan n->0 > > =C2=A0- block_size: Maximum block size supported by the controller > > -- data_width: Maximum data width supported by hardware per AHB > > master > > -=C2=A0=C2=A0(0 - 8bits, 1 - 16bits, ..., 5 - 256bits) > > +- data-width: Maximum data width supported by hardware (in bytes) >=20 > 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. >=20 > > ... > > @@ -726,10 +710,7 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, > > dma_addr_t dest, dma_addr_t src, > > =C2=A0 > > =C2=A0 dwc->direction =3D DMA_MEM_TO_MEM; > > =C2=A0 > > - data_width =3D dw->data_width[dwc->m_master]; > > - > > - src_width =3D dst_width =3D min_t(unsigned int, data_width, > > - =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0dwc_fast_ffs(src | dest | > > len)); > > + src_width =3D dst_width =3D __ffs(dw->data_width | src | dest > > | len); > > ... >=20 > -Vineet --=20 Andy Shevchenko Intel Finland Oy -- To unsubscribe from this list: send the line "unsubscribe devicetree" i= n the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755541AbcAYIra (ORCPT ); Mon, 25 Jan 2016 03:47:30 -0500 Received: from mga02.intel.com ([134.134.136.20]:7850 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751117AbcAYIr0 (ORCPT ); Mon, 25 Jan 2016 03:47:26 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,343,1449561600"; d="scan'208";a="897689698" Message-ID: <1453711547.2521.209.camel@linux.intel.com> Subject: Re: [PATCH 07/15] dmaengine: dw: revisit data_width property From: Andy Shevchenko To: Vineet Gupta , Mans Rullgard , Viresh Kumar , Vinod Koul , "linux-kernel@vger.kernel.org" , "dmaengine@vger.kernel.org" Cc: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Russell King , Dan Williams , "devicetree@vger.kernel.org" , "linux-snps-arc@lists.infradead.org" , "linux-arm-kernel@lists.infradead.org" Date: Mon, 25 Jan 2016 10:45:47 +0200 In-Reply-To: References: <1453663322-14474-1-git-send-email-mans@mansr.com> <1453663322-14474-8-git-send-email-mans@mansr.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.3-1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > > 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 > > Signed-off-by: Mans Rullgard > > --- > > 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 Intel Finland Oy