diff mbox

[RFC,15/23] usb: musb: raw read and write endian fix

Message ID 20131125221348.GB18046@saruman.home (mailing list archive)
State New, archived
Headers show

Commit Message

Felipe Balbi Nov. 25, 2013, 10:13 p.m. UTC
Hi,

On Mon, Nov 25, 2013 at 04:07:49PM -0600, Felipe Balbi wrote:
> On Sat, Nov 16, 2013 at 02:01:18AM +0200, Taras Kondratiuk wrote:
> > From: Victor Kamensky <victor.kamensky@linaro.org>
> > 
> > All OMAP IP blocks expect LE data, but CPU may operate in BE mode.
> > Need to use endian neutral functions to read/write h/w registers.
> > I.e instead of __raw_read[lw] and __raw_write[lw] functions code
> > need to use read[lw]_relaxed and write[lw]_relaxed functions.
> > If the first simply reads/writes register, the second will byteswap
> > it if host operates in BE mode.
> > 
> > Changes are trivial sed like replacement of __raw_xxx functions
> > with xxx_relaxed variant.
> > 
> > Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
> > Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
> > ---
> >  drivers/usb/musb/musb_io.h |   18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/usb/musb/musb_io.h b/drivers/usb/musb/musb_io.h
> > index eebeed7..76f4d2a 100644
> > --- a/drivers/usb/musb/musb_io.h
> > +++ b/drivers/usb/musb/musb_io.h
> > @@ -42,17 +42,17 @@
> >  /* NOTE:  these offsets are all in bytes */
> >  
> >  static inline u16 musb_readw(const void __iomem *addr, unsigned offset)
> > -	{ return __raw_readw(addr + offset); }
> > +	{ return readw_relaxed(addr + offset); }
> 
> x86 doesn't provide any of the write?_relaxed methods so this breaks
> build on x86 at least.

here's an untested patch which would "solve" the problem:



I'm not sure if it's correct though. Someone would have to tell me if
it's correct or not. For now, I have dropped $subject from my
testing/next branch.
diff mbox

Patch

diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 34f69cb..b6ad164 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -73,6 +73,9 @@  build_mmio_write(__writel, "l", unsigned int, "r", )
 #define __raw_readw __readw
 #define __raw_readl __readl
 
+#define writeb_relaxed(d, a) __writeb(d, a)
+#define writew_relaxed(d, a) __writew(d, a)
+#define writel_relaxed(d, a) __writel(d, a)
 #define __raw_writeb __writeb
 #define __raw_writew __writew
 #define __raw_writel __writel
@@ -85,6 +88,7 @@  build_mmio_read(readq, "q", unsigned long, "=r", :"memory")
 build_mmio_write(writeq, "q", unsigned long, "r", :"memory")
 
 #define readq_relaxed(a)	readq(a)
+#define writeq_relaxed(d, a)	writeq(d, a)
 
 #define __raw_readq(a)		readq(a)
 #define __raw_writeq(val, addr)	writeq(val, addr)