[RFC 7/9] usb: ehci: add big-endian registers support

Antony Pavlov antonynpavlov at gmail.com
Fri Aug 28 08:49:39 PDT 2015


On Fri, 28 Aug 2015 08:19:00 +0200
Sascha Hauer <s.hauer at pengutronix.de> wrote:

> On Fri, Aug 28, 2015 at 01:24:08AM +0300, Antony Pavlov wrote:
> > +
> > +#ifdef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
> > +#define ehci_big_endian_mmio(e)		((e)->big_endian_mmio)
> > +#else
> > +#define ehci_big_endian_mmio(e)		0
> > +#endif
> > +
> > +static inline void ehci_writel(const struct ehci_priv *ehci,
> > +				__u32 __iomem *regs, const unsigned int val)
> >  {
> > -	writel(val, regs);
> > +	if (IS_ENABLED(CONFIG_USB_EHCI_BIG_ENDIAN_MMIO)) {
> > +		ehci_big_endian_mmio(ehci) ?
> > +			iowrite32be(val, regs) :
> > +			writel(val, regs);
> > +	} else
> > +		writel(val, regs);
> >  }
> 
> 	if (ehci_big_endian_mmio(ehci))
> 		iowrite32be(val, regs);
> 	else
> 		writel(val, regs);
> 
> is enough.

It looks you are right. :)

I have just stealed this code from linux kernel.
I have some suspicions on redundancy of this code but I didn't proposed any good solution. 
Thanks!

-- 
Best regards,
  Antony Pavlov



More information about the barebox mailing list