public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Karsten Keil <kkeil@suse.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org, isdn4linux@listserv.isdn4linux.de
Subject: Re: [PATCH 3/4] Fix remaining big endian issue of hfcmulti
Date: Tue, 5 Aug 2008 13:31:11 +0200	[thread overview]
Message-ID: <20080805113111.GA6827@pingi.kke.suse.de> (raw)
In-Reply-To: <1217910588.24157.151.camel@pasglop>

On Tue, Aug 05, 2008 at 02:29:48PM +1000, Benjamin Herrenschmidt wrote:
> On Sat, 2008-08-02 at 16:35 +0200, Karsten Keil wrote:
> > The driver was not so bad at big endian at all, only the optimised fifo
> > read/write functions need a fix, with this fix the driver works on
> > a pegasus PPC machine.
> 
> This is however very broken... IE, you should instead use iomap
> and thus get ioreadXX_rep() and writeXX_rep() (XX = 16 or 32) that
> will do the right thing for you. IE, they will do the right amount
> of memory barriers and will avoid the unnecessary double-swapping
> you are doing there.
> 

Thanks for this hint, I didn't know that the repetive versions are
for byte streams and not for eg. transfer of multiple u32.
So it makes things lot easier the code should look like:

	int l = len >> 2;

	if (l) {
		ioread32_rep(hc->pci_membase + A_FIFO_DATA0, data, l);
		data += l << 2;
	}
	if (len & 2) {
		ioread16_rep(hc->pci_membase + A_FIFO_DATA0, data, 1);
		data += 2;
	}
	if (len & 1)
		writeb(*data, hc->pci_membase + A_FIFO_DATA0);

-- 
Karsten Keil
SuSE Labs
ISDN and VOIP development
SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)

  reply	other threads:[~2008-08-05 11:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-02 14:35 [PATCH 3/4] Fix remaining big endian issue of hfcmulti Karsten Keil
2008-08-04 12:03 ` David Woodhouse
2008-08-04 14:29   ` Karsten Keil
2008-08-05  4:29 ` Benjamin Herrenschmidt
2008-08-05 11:31   ` Karsten Keil [this message]
2008-08-05 13:04     ` Benjamin Herrenschmidt
2008-08-05 17:25       ` Karsten Keil
2008-08-05 18:42         ` Linus Torvalds
2008-08-05 21:02           ` Karsten Keil
2008-08-05 21:23             ` Sean MacLennan
2008-08-05 21:37               ` Linus Torvalds
2008-08-05 21:59                 ` Sean MacLennan
2008-08-05 23:04                   ` Benjamin Herrenschmidt
2008-08-05 23:38                     ` Sean MacLennan
2008-08-06  0:18                   ` Karsten Keil
2008-08-06  0:33                     ` Benjamin Herrenschmidt
2008-08-05 21:46               ` Benjamin Herrenschmidt
2008-08-05 21:45             ` Benjamin Herrenschmidt
2008-08-05 21:43         ` Benjamin Herrenschmidt
  -- strict thread matches above, loose matches on Subject: below --
2008-08-07 11:01 AW: " Andreas.Eversberg
2008-08-07 13:46 ` Karsten Keil

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=20080805113111.GA6827@pingi.kke.suse.de \
    --to=kkeil@suse.de \
    --cc=benh@kernel.crashing.org \
    --cc=isdn4linux@listserv.isdn4linux.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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