RE: [PATCH V8 03/10] USB/ppc4xx: Add Synopsys DWC OTG CoreInterface Layer

2011-02-07 Thread Tirumala Marri
-Original Message-
From: linuxppc-dev-bounces+tmarri=amcc@lists.ozlabs.org
[mailto:linuxppc-dev-bounces+tmarri=amcc@lists.ozlabs.org] On Behalf
Of David Laight
Sent: Wednesday, January 26, 2011 8:35 AM
Cc: linux-...@vger.kernel.org; linuxppc-dev@lists.ozlabs.org
Subject: RE: [PATCH V8 03/10] USB/ppc4xx: Add Synopsys DWC OTG
CoreInterface Layer


> Also in_le32/out_le32/in_be32/out_be32 are
> architecture-specific AFAIK.

Isn't the whole patch architecture-specific ?

> I'd suggest using readl/writel for LE ops and
> __be32_to_cpu(__raw_readl(addr))/__raw_writel(__cpu_to_be32(b),addr)
> for BE ops.

Since the ppc doesn't have a byteswap instruction (and the LE
memory transfers might even be slow!) you really don't want to
be doing software byteswap.

Not to mention the horrific synchronistion instructions
that in_le32() and out_le32() actually contain.

I didn't find __raw_readl() when I was looking for asm
patterns that byteswapped memory transfers.

I did find st_le32() and ld_le32() in arch/powerpc/include/asm/swab.h
but that file is actually quite difficult to #include because
there is another swab.h that gets included instead.

[marri] Initial version of DWC-IP did not have feature to swap endianness.
Whereas next versions have it.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH V8 03/10] USB/ppc4xx: Add Synopsys DWC OTG CoreInterface Layer

2011-01-26 Thread Alexander Gordeev
В Wed, 26 Jan 2011 16:35:05 -
"David Laight"  пишет:

>  
> > Also in_le32/out_le32/in_be32/out_be32 are 
> > architecture-specific AFAIK.
> 
> Isn't the whole patch architecture-specific ?

I use this driver on MIPS board right now. :)
This core from Synopsys is used in many SOCs with various architectures.

> > I'd suggest using readl/writel for LE ops and
> > __be32_to_cpu(__raw_readl(addr))/__raw_writel(__cpu_to_be32(b),addr)
> > for BE ops.
> 
> Since the ppc doesn't have a byteswap instruction (and the LE
> memory transfers might even be slow!) you really don't want to
> be doing software byteswap.
> 
> Not to mention the horrific synchronistion instructions
> that in_le32() and out_le32() actually contain.
> 
> I didn't find __raw_readl() when I was looking for asm
> patterns that byteswapped memory transfers.
> 
> I did find st_le32() and ld_le32() in arch/powerpc/include/asm/swab.h
> but that file is actually quite difficult to #include because
> there is another swab.h that gets included instead.

I see. readl/writel are defined in asm-generic/io.h. So IMHO there
should be also le and be versions that can be redefined in
arch-specific code.

-- 
  Alexander


signature.asc
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

RE: [PATCH V8 03/10] USB/ppc4xx: Add Synopsys DWC OTG CoreInterface Layer

2011-01-26 Thread David Laight
 
> Also in_le32/out_le32/in_be32/out_be32 are 
> architecture-specific AFAIK.

Isn't the whole patch architecture-specific ?

> I'd suggest using readl/writel for LE ops and
> __be32_to_cpu(__raw_readl(addr))/__raw_writel(__cpu_to_be32(b),addr)
> for BE ops.

Since the ppc doesn't have a byteswap instruction (and the LE
memory transfers might even be slow!) you really don't want to
be doing software byteswap.

Not to mention the horrific synchronistion instructions
that in_le32() and out_le32() actually contain.

I didn't find __raw_readl() when I was looking for asm
patterns that byteswapped memory transfers.

I did find st_le32() and ld_le32() in arch/powerpc/include/asm/swab.h
but that file is actually quite difficult to #include because
there is another swab.h that gets included instead.

David


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev