From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757086Ab0DNWkF (ORCPT ); Wed, 14 Apr 2010 18:40:05 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:50847 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756070Ab0DNWkC convert rfc822-to-8bit (ORCPT ); Wed, 14 Apr 2010 18:40:02 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=rPmKOQj4WJwRC6kPhdOK56FvzyRky2Mp3P4S0lLgDZpPCdtlAOIqBJSxYufBN7pnhU CtQWx/C2UGhS/J/iB1wrMrZUKBYo57i47mW/q/tDVerLgqIiz2NP5o/K1dLEJJq+O16N /AZAb4yWtR7cfG3cEUYzfKqRzJW8T0E2wfZlY= MIME-Version: 1.0 In-Reply-To: <1270681973-5763-1-git-send-email-linus.walleij@stericsson.com> References: <1270681973-5763-1-git-send-email-linus.walleij@stericsson.com> Date: Wed, 14 Apr 2010 15:40:02 -0700 X-Google-Sender-Auth: e8a36dd855403b51 Message-ID: Subject: Re: [PATCH 05/11] ARM: add generic PrimeCell interface to COH 901 318 v5 From: Dan Williams To: Linus Walleij Cc: akpm@linux-foundation.org, Russell King - ARM Linux , Grant Likely , linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, STEricsson_nomadik_linux@list.st.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, On Wed, Apr 7, 2010 at 4:12 PM, Linus Walleij wrote: > This extends the DMA engine driver for the COH 901 318 used in the > U300 platform with the generic PrimeCell interface. > > Signed-off-by: Linus Walleij > --- >  drivers/dma/coh901318.c     |  146 +++++++++++++++++++++++++++++++++++++++++++ >  drivers/dma/coh901318_lli.c |   78 ++++++++++++++++++++++- >  2 files changed, 221 insertions(+), 3 deletions(-) > [..] > diff --git a/drivers/dma/coh901318_lli.c b/drivers/dma/coh901318_lli.c > index 9f7e0e6..f37db49 100644 > --- a/drivers/dma/coh901318_lli.c > +++ b/drivers/dma/coh901318_lli.c > @@ -153,6 +153,39 @@ coh901318_lli_fill_memcpy(struct coh901318_pool *pool, >        lli->src_addr = src; >        lli->dst_addr = dst; > > +       /* > +        * The DMA hardware will increase its pointer by 1, > +        * 2 or 4 bytes at a time depending on configuration. > +        * If using som oddly-aligned buffer this will cause s/som/some/ > +        * performance problems. > +        */ > +#if 0 > +       ctrl_chained &= ~COH901318_CX_CTRL_SRC_BUS_SIZE_MASK; > +       ctrl_eom &= ~COH901318_CX_CTRL_SRC_BUS_SIZE_MASK; > +       ctrl_chained &= ~COH901318_CX_CTRL_DST_BUS_SIZE_MASK; > +       ctrl_eom &= ~COH901318_CX_CTRL_DST_BUS_SIZE_MASK; > +       if (src & 0x01) { > +               ctrl_chained |= COH901318_CX_CTRL_SRC_BUS_SIZE_8_BITS; > +               ctrl_eom |= COH901318_CX_CTRL_SRC_BUS_SIZE_8_BITS; > +       } else if (src & 0x02) { > +               ctrl_chained |= COH901318_CX_CTRL_SRC_BUS_SIZE_16_BITS; > +               ctrl_eom |= COH901318_CX_CTRL_SRC_BUS_SIZE_16_BITS; > +       } else { > +               ctrl_chained |= COH901318_CX_CTRL_SRC_BUS_SIZE_32_BITS; > +               ctrl_eom |= COH901318_CX_CTRL_SRC_BUS_SIZE_32_BITS; > +       } > +       if (dst & 0x01) { > +               ctrl_chained |= COH901318_CX_CTRL_DST_BUS_SIZE_8_BITS; > +               ctrl_eom |= COH901318_CX_CTRL_SRC_DST_SIZE_8_BITS; > +       } else if (dst & 0x02) { > +               ctrl_chained |= COH901318_CX_CTRL_DST_BUS_SIZE_16_BITS; > +               ctrl_eom |= COH901318_CX_CTRL_DST_BUS_SIZE_16_BITS; > +       } else { > +               ctrl_chained |= COH901318_CX_CTRL_DST_BUS_SIZE_32_BITS; > +               ctrl_eom |= COH901318_CX_CTRL_DST_BUS_SIZE_32_BITS; > +       } > +#endif It looks like this bit twiddling code is duplicated three times. Can it be moved to a static inline in a header file and hide the #if 0 there as well. I assume you want it for documentation purposes in case someone in the future has an unaligned usage model? -- Dan From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Williams Subject: Re: [PATCH 05/11] ARM: add generic PrimeCell interface to COH 901 318 v5 Date: Wed, 14 Apr 2010 15:40:02 -0700 Message-ID: References: <1270681973-5763-1-git-send-email-linus.walleij@stericsson.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mail-pw0-f46.google.com ([209.85.160.46]:50847 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756070Ab0DNWkC convert rfc822-to-8bit (ORCPT ); Wed, 14 Apr 2010 18:40:02 -0400 In-Reply-To: <1270681973-5763-1-git-send-email-linus.walleij@stericsson.com> Sender: linux-mmc-owner@vger.kernel.org List-Id: linux-mmc@vger.kernel.org To: Linus Walleij Cc: akpm@linux-foundation.org, Russell King - ARM Linux , Grant Likely , linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, STEricsson_nomadik_linux@list.st.com, linux-kernel@vger.kernel.org Hi Linus, On Wed, Apr 7, 2010 at 4:12 PM, Linus Walleij wrote: > This extends the DMA engine driver for the COH 901 318 used in the > U300 platform with the generic PrimeCell interface. > > Signed-off-by: Linus Walleij > --- > =A0drivers/dma/coh901318.c =A0 =A0 | =A0146 +++++++++++++++++++++++++= ++++++++++++++++++ > =A0drivers/dma/coh901318_lli.c | =A0 78 ++++++++++++++++++++++- > =A02 files changed, 221 insertions(+), 3 deletions(-) > [..] > diff --git a/drivers/dma/coh901318_lli.c b/drivers/dma/coh901318_lli.= c > index 9f7e0e6..f37db49 100644 > --- a/drivers/dma/coh901318_lli.c > +++ b/drivers/dma/coh901318_lli.c > @@ -153,6 +153,39 @@ coh901318_lli_fill_memcpy(struct coh901318_pool = *pool, > =A0 =A0 =A0 =A0lli->src_addr =3D src; > =A0 =A0 =A0 =A0lli->dst_addr =3D dst; > > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* The DMA hardware will increase its pointer by 1, > + =A0 =A0 =A0 =A0* 2 or 4 bytes at a time depending on configuration. > + =A0 =A0 =A0 =A0* If using som oddly-aligned buffer this will cause s/som/some/ > + =A0 =A0 =A0 =A0* performance problems. > + =A0 =A0 =A0 =A0*/ > +#if 0 > + =A0 =A0 =A0 ctrl_chained &=3D ~COH901318_CX_CTRL_SRC_BUS_SIZE_MASK; > + =A0 =A0 =A0 ctrl_eom &=3D ~COH901318_CX_CTRL_SRC_BUS_SIZE_MASK; > + =A0 =A0 =A0 ctrl_chained &=3D ~COH901318_CX_CTRL_DST_BUS_SIZE_MASK; > + =A0 =A0 =A0 ctrl_eom &=3D ~COH901318_CX_CTRL_DST_BUS_SIZE_MASK; > + =A0 =A0 =A0 if (src & 0x01) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctrl_chained |=3D COH901318_CX_CTRL_SRC= _BUS_SIZE_8_BITS; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctrl_eom |=3D COH901318_CX_CTRL_SRC_BUS= _SIZE_8_BITS; > + =A0 =A0 =A0 } else if (src & 0x02) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctrl_chained |=3D COH901318_CX_CTRL_SRC= _BUS_SIZE_16_BITS; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctrl_eom |=3D COH901318_CX_CTRL_SRC_BUS= _SIZE_16_BITS; > + =A0 =A0 =A0 } else { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctrl_chained |=3D COH901318_CX_CTRL_SRC= _BUS_SIZE_32_BITS; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctrl_eom |=3D COH901318_CX_CTRL_SRC_BUS= _SIZE_32_BITS; > + =A0 =A0 =A0 } > + =A0 =A0 =A0 if (dst & 0x01) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctrl_chained |=3D COH901318_CX_CTRL_DST= _BUS_SIZE_8_BITS; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctrl_eom |=3D COH901318_CX_CTRL_SRC_DST= _SIZE_8_BITS; > + =A0 =A0 =A0 } else if (dst & 0x02) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctrl_chained |=3D COH901318_CX_CTRL_DST= _BUS_SIZE_16_BITS; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctrl_eom |=3D COH901318_CX_CTRL_DST_BUS= _SIZE_16_BITS; > + =A0 =A0 =A0 } else { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctrl_chained |=3D COH901318_CX_CTRL_DST= _BUS_SIZE_32_BITS; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctrl_eom |=3D COH901318_CX_CTRL_DST_BUS= _SIZE_32_BITS; > + =A0 =A0 =A0 } > +#endif It looks like this bit twiddling code is duplicated three times. Can it be moved to a static inline in a header file and hide the #if 0 there as well. I assume you want it for documentation purposes in case someone in the future has an unaligned usage model? -- Dan From mboxrd@z Thu Jan 1 00:00:00 1970 From: dan.j.williams@intel.com (Dan Williams) Date: Wed, 14 Apr 2010 15:40:02 -0700 Subject: [PATCH 05/11] ARM: add generic PrimeCell interface to COH 901 318 v5 In-Reply-To: <1270681973-5763-1-git-send-email-linus.walleij@stericsson.com> References: <1270681973-5763-1-git-send-email-linus.walleij@stericsson.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Linus, On Wed, Apr 7, 2010 at 4:12 PM, Linus Walleij wrote: > This extends the DMA engine driver for the COH 901 318 used in the > U300 platform with the generic PrimeCell interface. > > Signed-off-by: Linus Walleij > --- > ?drivers/dma/coh901318.c ? ? | ?146 +++++++++++++++++++++++++++++++++++++++++++ > ?drivers/dma/coh901318_lli.c | ? 78 ++++++++++++++++++++++- > ?2 files changed, 221 insertions(+), 3 deletions(-) > [..] > diff --git a/drivers/dma/coh901318_lli.c b/drivers/dma/coh901318_lli.c > index 9f7e0e6..f37db49 100644 > --- a/drivers/dma/coh901318_lli.c > +++ b/drivers/dma/coh901318_lli.c > @@ -153,6 +153,39 @@ coh901318_lli_fill_memcpy(struct coh901318_pool *pool, > ? ? ? ?lli->src_addr = src; > ? ? ? ?lli->dst_addr = dst; > > + ? ? ? /* > + ? ? ? ?* The DMA hardware will increase its pointer by 1, > + ? ? ? ?* 2 or 4 bytes at a time depending on configuration. > + ? ? ? ?* If using som oddly-aligned buffer this will cause s/som/some/ > + ? ? ? ?* performance problems. > + ? ? ? ?*/ > +#if 0 > + ? ? ? ctrl_chained &= ~COH901318_CX_CTRL_SRC_BUS_SIZE_MASK; > + ? ? ? ctrl_eom &= ~COH901318_CX_CTRL_SRC_BUS_SIZE_MASK; > + ? ? ? ctrl_chained &= ~COH901318_CX_CTRL_DST_BUS_SIZE_MASK; > + ? ? ? ctrl_eom &= ~COH901318_CX_CTRL_DST_BUS_SIZE_MASK; > + ? ? ? if (src & 0x01) { > + ? ? ? ? ? ? ? ctrl_chained |= COH901318_CX_CTRL_SRC_BUS_SIZE_8_BITS; > + ? ? ? ? ? ? ? ctrl_eom |= COH901318_CX_CTRL_SRC_BUS_SIZE_8_BITS; > + ? ? ? } else if (src & 0x02) { > + ? ? ? ? ? ? ? ctrl_chained |= COH901318_CX_CTRL_SRC_BUS_SIZE_16_BITS; > + ? ? ? ? ? ? ? ctrl_eom |= COH901318_CX_CTRL_SRC_BUS_SIZE_16_BITS; > + ? ? ? } else { > + ? ? ? ? ? ? ? ctrl_chained |= COH901318_CX_CTRL_SRC_BUS_SIZE_32_BITS; > + ? ? ? ? ? ? ? ctrl_eom |= COH901318_CX_CTRL_SRC_BUS_SIZE_32_BITS; > + ? ? ? } > + ? ? ? if (dst & 0x01) { > + ? ? ? ? ? ? ? ctrl_chained |= COH901318_CX_CTRL_DST_BUS_SIZE_8_BITS; > + ? ? ? ? ? ? ? ctrl_eom |= COH901318_CX_CTRL_SRC_DST_SIZE_8_BITS; > + ? ? ? } else if (dst & 0x02) { > + ? ? ? ? ? ? ? ctrl_chained |= COH901318_CX_CTRL_DST_BUS_SIZE_16_BITS; > + ? ? ? ? ? ? ? ctrl_eom |= COH901318_CX_CTRL_DST_BUS_SIZE_16_BITS; > + ? ? ? } else { > + ? ? ? ? ? ? ? ctrl_chained |= COH901318_CX_CTRL_DST_BUS_SIZE_32_BITS; > + ? ? ? ? ? ? ? ctrl_eom |= COH901318_CX_CTRL_DST_BUS_SIZE_32_BITS; > + ? ? ? } > +#endif It looks like this bit twiddling code is duplicated three times. Can it be moved to a static inline in a header file and hide the #if 0 there as well. I assume you want it for documentation purposes in case someone in the future has an unaligned usage model? -- Dan