* [PATCH 2/2] MIPS: add readl/write_be @ 2009-12-12 16:57 Florian Fainelli 2009-12-12 19:31 ` Thomas Bogendoerfer 2009-12-14 16:40 ` David Daney 0 siblings, 2 replies; 10+ messages in thread From: Florian Fainelli @ 2009-12-12 16:57 UTC (permalink / raw) To: linux-mips, Maxime Bizon; +Cc: ralf MIPS currently lacks the readl_be and writel_be accessors which are required by BCM63xx for OHCI and EHCI support. Let's define them globally for MIPS. This also fixes the compilation of the bcm63xx defconfig against USB. Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> --- diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 436878e..65cb4e4 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -447,6 +447,9 @@ __BUILDIO(q, u64) #define readl_relaxed readl #define readq_relaxed readq +#define readl_be(addr) __raw_readl((__force unsigned *)addr) +#define writel_be(val, addr) __raw_writel(val, (__force unsigned *)addr) + /* * Some code tests for these symbols */ -- ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] MIPS: add readl/write_be 2009-12-12 16:57 [PATCH 2/2] MIPS: add readl/write_be Florian Fainelli @ 2009-12-12 19:31 ` Thomas Bogendoerfer 2009-12-14 17:02 ` Florian Fainelli 2009-12-14 16:40 ` David Daney 1 sibling, 1 reply; 10+ messages in thread From: Thomas Bogendoerfer @ 2009-12-12 19:31 UTC (permalink / raw) To: Florian Fainelli; +Cc: linux-mips, Maxime Bizon, ralf On Sat, Dec 12, 2009 at 05:57:56PM +0100, Florian Fainelli wrote: > +#define readl_be(addr) __raw_readl((__force unsigned *)addr) > +#define writel_be(val, addr) __raw_writel(val, (__force unsigned *)addr) looks broken for little endian machines. __raw_XXX doesn't do any swapping, so IMHO the correct thing would be to use be32_to_cpu/cpu_to_be32. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessary a good idea. [ RFC1925, 2.3 ] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] MIPS: add readl/write_be 2009-12-12 19:31 ` Thomas Bogendoerfer @ 2009-12-14 17:02 ` Florian Fainelli 2009-12-14 19:05 ` Geert Uytterhoeven 0 siblings, 1 reply; 10+ messages in thread From: Florian Fainelli @ 2009-12-14 17:02 UTC (permalink / raw) To: Thomas Bogendoerfer; +Cc: linux-mips, Maxime Bizon, ralf Hello Thomas, On Saturday 12 December 2009 20:31:14 Thomas Bogendoerfer wrote: > On Sat, Dec 12, 2009 at 05:57:56PM +0100, Florian Fainelli wrote: > > +#define readl_be(addr) __raw_readl((__force unsigned *)addr) > > +#define writel_be(val, addr) __raw_writel(val, (__force unsigned > > *)addr) > > looks broken for little endian machines. __raw_XXX doesn't do any swapping, > so IMHO the correct thing would be to use be32_to_cpu/cpu_to_be32. Yeah, I missed that point. Please find below version 2 of the patch which also addresses David's comment. -- From: Florian Fainelli <ffainelli@freebox.fr> Subject: [PATCH v2] MIPS: add readl_be/writel_be MIPS currently lacks the readl_be and writel_be accessors which are required by BCM63xx for OHCI and EHCI support. Let's define them globally for MIPS. This also fixes the compilation of the bcm63xx defconfig against USB. Changes from v1: - make it work on little-endian machines - protect macros arguments with parenthesis Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> --- diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 436878e..4a76d39 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -447,6 +447,9 @@ __BUILDIO(q, u64) #define readl_relaxed readl #define readq_relaxed readq +#define readl_be(addr) cpu_to_be32(__raw_readl((__force unsigned *)(addr))) +#define writel_be(val, addr) __raw_writel(be32_to_cpu((val)), (__force unsigned *)(addr)) + /* * Some code tests for these symbols */ -- ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] MIPS: add readl/write_be 2009-12-14 17:02 ` Florian Fainelli @ 2009-12-14 19:05 ` Geert Uytterhoeven 2009-12-15 0:44 ` Florian Fainelli 0 siblings, 1 reply; 10+ messages in thread From: Geert Uytterhoeven @ 2009-12-14 19:05 UTC (permalink / raw) To: Florian Fainelli; +Cc: Thomas Bogendoerfer, linux-mips, Maxime Bizon, ralf On Mon, Dec 14, 2009 at 18:02, Florian Fainelli <ffainelli@freebox.fr> wrote: > On Saturday 12 December 2009 20:31:14 Thomas Bogendoerfer wrote: >> On Sat, Dec 12, 2009 at 05:57:56PM +0100, Florian Fainelli wrote: >> > +#define readl_be(addr) __raw_readl((__force unsigned *)addr) >> > +#define writel_be(val, addr) __raw_writel(val, (__force unsigned >> > *)addr) >> >> looks broken for little endian machines. __raw_XXX doesn't do any swapping, >> so IMHO the correct thing would be to use be32_to_cpu/cpu_to_be32. > > Yeah, I missed that point. Please find below version 2 of the patch which also addresses David's comment. > -- > From: Florian Fainelli <ffainelli@freebox.fr> > Subject: [PATCH v2] MIPS: add readl_be/writel_be > > MIPS currently lacks the readl_be and writel_be accessors > which are required by BCM63xx for OHCI and EHCI support. > Let's define them globally for MIPS. This also fixes the > compilation of the bcm63xx defconfig against USB. > > Changes from v1: > - make it work on little-endian machines > - protect macros arguments with parenthesis > > Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> > --- > diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h > index 436878e..4a76d39 100644 > --- a/arch/mips/include/asm/io.h > +++ b/arch/mips/include/asm/io.h > @@ -447,6 +447,9 @@ __BUILDIO(q, u64) > #define readl_relaxed readl > #define readq_relaxed readq > > +#define readl_be(addr) cpu_to_be32(__raw_readl((__force unsigned *)(addr))) > +#define writel_be(val, addr) __raw_writel(be32_to_cpu((val)), (__force unsigned *)(addr)) Shouldn't it be the other way around (cpu <-> be32), i.e. #define readl_be(addr) be32_to_cpu(__raw_readl((__force unsigned *)(addr))) #define writel_be(val, addr) __raw_writel(cpu_to_be32((val)), (__force unsigned *)(addr)) ? I know it'll work both ways, though... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] MIPS: add readl/write_be 2009-12-14 19:05 ` Geert Uytterhoeven @ 2009-12-15 0:44 ` Florian Fainelli 2009-12-15 8:25 ` Ralf Baechle 2009-12-15 12:03 ` Sergei Shtylyov 0 siblings, 2 replies; 10+ messages in thread From: Florian Fainelli @ 2009-12-15 0:44 UTC (permalink / raw) To: Geert Uytterhoeven; +Cc: Thomas Bogendoerfer, linux-mips, Maxime Bizon, ralf Hi Geert, Le lundi 14 décembre 2009 20:05:50, Geert Uytterhoeven a écrit : > On Mon, Dec 14, 2009 at 18:02, Florian Fainelli <ffainelli@freebox.fr> wrote: > > On Saturday 12 December 2009 20:31:14 Thomas Bogendoerfer wrote: > >> On Sat, Dec 12, 2009 at 05:57:56PM +0100, Florian Fainelli wrote: > >> > +#define readl_be(addr) __raw_readl((__force > >> > unsigned *)addr) +#define writel_be(val, addr) > >> > __raw_writel(val, (__force unsigned *)addr) > >> > >> looks broken for little endian machines. __raw_XXX doesn't do any > >> swapping, so IMHO the correct thing would be to use > >> be32_to_cpu/cpu_to_be32. > > > > Yeah, I missed that point. Please find below version 2 of the patch which > > also addresses David's comment. -- > > From: Florian Fainelli <ffainelli@freebox.fr> > > Subject: [PATCH v2] MIPS: add readl_be/writel_be > > > > MIPS currently lacks the readl_be and writel_be accessors > > which are required by BCM63xx for OHCI and EHCI support. > > Let's define them globally for MIPS. This also fixes the > > compilation of the bcm63xx defconfig against USB. > > > > Changes from v1: > > - make it work on little-endian machines > > - protect macros arguments with parenthesis > > > > Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> > > --- > > diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h > > index 436878e..4a76d39 100644 > > --- a/arch/mips/include/asm/io.h > > +++ b/arch/mips/include/asm/io.h > > @@ -447,6 +447,9 @@ __BUILDIO(q, u64) > > #define readl_relaxed readl > > #define readq_relaxed readq > > > > +#define readl_be(addr) cpu_to_be32(__raw_readl((__force > > unsigned *)(addr))) +#define writel_be(val, addr) > > __raw_writel(be32_to_cpu((val)), (__force unsigned *)(addr)) > > Shouldn't it be the other way around (cpu <-> be32), i.e. > > #define readl_be(addr) > be32_to_cpu(__raw_readl((__force unsigned *)(addr))) > #define writel_be(val, addr) > __raw_writel(cpu_to_be32((val)), (__force unsigned *)(addr)) It should, I inverted the semantics. I should think twice before sending stuff :) -- From: Florian Fainelli <ffainelli@freebox.fr> Subject: [PATCH v3] MIPS: add readl/write_be accessors MIPS currently lacks the readl_be and writel_be accessors which are required by BCM63xx for OHCI and EHCI support. Let's define them globally for MIPS. This also fixes the compilation of the bcm63xx defconfig against USB. Changes from v2: - fixed the be/cpu endianness inversion Changes from v1: - make it work on little-endian machines - protect macros arguments with parenthesis Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> --- diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 436878e..65d7843 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -447,6 +447,9 @@ __BUILDIO(q, u64) #define readl_relaxed readl #define readq_relaxed readq +#define readl_be(addr) be32_to_cpu(__raw_readl((__force unsigned *)(addr))) +#define writel_be(val, addr) __raw_writel(cpu_to_be32((val)), (__force unsigned *)(addr)) + /* * Some code tests for these symbols */ -- ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] MIPS: add readl/write_be 2009-12-15 0:44 ` Florian Fainelli @ 2009-12-15 8:25 ` Ralf Baechle 2009-12-16 10:29 ` Florian Fainelli 2009-12-15 12:03 ` Sergei Shtylyov 1 sibling, 1 reply; 10+ messages in thread From: Ralf Baechle @ 2009-12-15 8:25 UTC (permalink / raw) To: Florian Fainelli Cc: Geert Uytterhoeven, Thomas Bogendoerfer, linux-mips, Maxime Bizon On Tue, Dec 15, 2009 at 01:44:03AM +0100, Florian Fainelli wrote: > It should, I inverted the semantics. I should think twice before sending stuff :) That should include Documentation/SubmittingPatches :-) Ralf ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] MIPS: add readl/write_be 2009-12-15 8:25 ` Ralf Baechle @ 2009-12-16 10:29 ` Florian Fainelli 2010-01-13 13:48 ` Ralf Baechle 0 siblings, 1 reply; 10+ messages in thread From: Florian Fainelli @ 2009-12-16 10:29 UTC (permalink / raw) To: Ralf Baechle Cc: Geert Uytterhoeven, Thomas Bogendoerfer, linux-mips, Maxime Bizon From: Florian Fainelli <ffainelli@freebox.fr> Subject: [PATCH v3] MIPS: add readl/write_be accessors MIPS currently lacks the readl_be and writel_be accessors which are required by BCM63xx for OHCI and EHCI support. Let's define them globally for MIPS. This also fixes the compilation of the bcm63xx defconfig against USB. Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> --- diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 436878e..65d7843 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -447,6 +447,9 @@ __BUILDIO(q, u64) #define readl_relaxed readl #define readq_relaxed readq +#define readl_be(addr) be32_to_cpu(__raw_readl((__force unsigned *)(addr))) +#define writel_be(val, addr) __raw_writel(cpu_to_be32((val)), (__force unsigned *)(addr)) + /* * Some code tests for these symbols */ -- ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] MIPS: add readl/write_be 2009-12-16 10:29 ` Florian Fainelli @ 2010-01-13 13:48 ` Ralf Baechle 0 siblings, 0 replies; 10+ messages in thread From: Ralf Baechle @ 2010-01-13 13:48 UTC (permalink / raw) To: Florian Fainelli Cc: Geert Uytterhoeven, Thomas Bogendoerfer, linux-mips, Maxime Bizon On Wed, Dec 16, 2009 at 11:29:06AM +0100, Florian Fainelli wrote: > From: Florian Fainelli <ffainelli@freebox.fr> > Subject: [PATCH v3] MIPS: add readl/write_be accessors > > MIPS currently lacks the readl_be and writel_be accessors > which are required by BCM63xx for OHCI and EHCI support. > Let's define them globally for MIPS. This also fixes the > compilation of the bcm63xx defconfig against USB. Queued; I've added the b, w and q variants to make the patch feature complete even though there are probably no users atm. Ralf ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] MIPS: add readl/write_be 2009-12-15 0:44 ` Florian Fainelli 2009-12-15 8:25 ` Ralf Baechle @ 2009-12-15 12:03 ` Sergei Shtylyov 1 sibling, 0 replies; 10+ messages in thread From: Sergei Shtylyov @ 2009-12-15 12:03 UTC (permalink / raw) To: Florian Fainelli Cc: Geert Uytterhoeven, Thomas Bogendoerfer, linux-mips, Maxime Bizon, ralf Hello. Florian Fainelli wrote: > From: Florian Fainelli <ffainelli@freebox.fr> > Subject: [PATCH v3] MIPS: add readl/write_be accessors > > MIPS currently lacks the readl_be and writel_be accessors > which are required by BCM63xx for OHCI and EHCI support. > Let's define them globally for MIPS. This also fixes the > compilation of the bcm63xx defconfig against USB. > > Changes from v2: > - fixed the be/cpu endianness inversion > > Changes from v1: > - make it work on little-endian machines > - protect macros arguments with parenthesis > You should have put the description of changes under --- tearline, not in the patch description itself. > Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> > --- WBR, Sergei ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] MIPS: add readl/write_be 2009-12-12 16:57 [PATCH 2/2] MIPS: add readl/write_be Florian Fainelli 2009-12-12 19:31 ` Thomas Bogendoerfer @ 2009-12-14 16:40 ` David Daney 1 sibling, 0 replies; 10+ messages in thread From: David Daney @ 2009-12-14 16:40 UTC (permalink / raw) To: Florian Fainelli; +Cc: linux-mips, Maxime Bizon, ralf Florian Fainelli wrote: > MIPS currently lacks the readl_be and writel_be accessors > which are required by BCM63xx for OHCI and EHCI support. > Let's define them globally for MIPS. This also fixes the > compilation of the bcm63xx defconfig against USB. > > Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> > --- > diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h > index 436878e..65cb4e4 100644 > --- a/arch/mips/include/asm/io.h > +++ b/arch/mips/include/asm/io.h > @@ -447,6 +447,9 @@ __BUILDIO(q, u64) > #define readl_relaxed readl > #define readq_relaxed readq > > +#define readl_be(addr) __raw_readl((__force unsigned *)addr) > +#define writel_be(val, addr) __raw_writel(val, (__force unsigned *)addr) > + Without addressing the need for the patch, as a technical matter, the macro parameters should probably be protected by parenthesis. I.E.: #define readl_be(addr) __raw_readl((__force unsigned *)(addr)) #define writel_be(val, addr) __raw_writel((val), (__force unsigned *)(addr)) ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-01-13 13:48 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-12-12 16:57 [PATCH 2/2] MIPS: add readl/write_be Florian Fainelli 2009-12-12 19:31 ` Thomas Bogendoerfer 2009-12-14 17:02 ` Florian Fainelli 2009-12-14 19:05 ` Geert Uytterhoeven 2009-12-15 0:44 ` Florian Fainelli 2009-12-15 8:25 ` Ralf Baechle 2009-12-16 10:29 ` Florian Fainelli 2010-01-13 13:48 ` Ralf Baechle 2009-12-15 12:03 ` Sergei Shtylyov 2009-12-14 16:40 ` David Daney
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).