linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dave.Martin@arm.com (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: cci: driver need big endian fixes in asm code
Date: Tue, 8 Oct 2013 19:03:11 +0100	[thread overview]
Message-ID: <20131008180305.GA3919@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.03.1310081356280.3023@syhkavp.arg>

On Tue, Oct 08, 2013 at 01:57:48PM -0400, Nicolas Pitre wrote:
> On Tue, 8 Oct 2013, Dave Martin wrote:
> 
> > On Mon, Oct 07, 2013 at 09:37:20PM -0700, Victor Kamensky wrote:
> > > cci_enable_port_for_self written in asm and it works with h/w
> > > registers that are in little endian format. When run in big
> > > endian mode it needs byte swap before/after it writes/reads
> > > to/from such registers
> > 
> > Lorenzo should comment on this if he's not already seen it.
> > 
> > > 
> > > Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
> > > ---
> > >  drivers/bus/arm-cci.c | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
> > > index 2009266..6db173e 100644
> > > --- a/drivers/bus/arm-cci.c
> > > +++ b/drivers/bus/arm-cci.c
> > > @@ -281,6 +281,9 @@ asmlinkage void __naked cci_enable_port_for_self(void)
> > >  	/* Enable the CCI port */
> > >  "	ldr	r0, [r0, %[offsetof_port_phys]] \n"
> > >  "	mov	r3, #"__stringify(CCI_ENABLE_REQ)" \n"
> > > +#ifdef __ARMEB__
> > > +"	rev	r3, r3 \n"
> > > +#endif /* __ARMEB__ */
> > 
> > Hmmm, this is a bit ugly, but we can't easily use ARM_BE8() here.
> 
> In any case, it would be more efficient to swap the CCI_ENABLE_REQ 
> constant at compile time rather than doing it at run time with an extra 
> instruction.

Indeed, but we can't stringify that.

A different way of wedging it into the assembler would be needed...
We might need to use ldr= too, which doesn't pay nice with inline asm.

Cheers
---Dave

  reply	other threads:[~2013-10-08 18:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08  4:37 [PATCH 0/2] additional vexpress-tc2 big endian fixes Victor Kamensky
2013-10-08  4:37 ` [PATCH 1/2] ARM: mcpm: fix big endian issue in mcpm startup code Victor Kamensky
2013-10-08  4:37 ` [PATCH 2/2] ARM: cci: driver need big endian fixes in asm code Victor Kamensky
2013-10-08 17:51   ` Dave Martin
2013-10-08 17:57     ` Nicolas Pitre
2013-10-08 18:03       ` Dave Martin [this message]
2013-10-08 18:14       ` Victor Kamensky
2013-10-08 18:26         ` Nicolas Pitre
2013-10-08  7:27 ` [PATCH 0/2] additional vexpress-tc2 big endian fixes Ben Dooks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131008180305.GA3919@localhost.localdomain \
    --to=dave.martin@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).