linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Matt Porter <mporter@kernel.crashing.org>
To: "Jenkins, Clive" <Clive.Jenkins@xerox.com>,
	Peter Korsgaard <jacmet@sunsite.dk>,
	Kumar Gala <galak@kernel.crashing.org>,
	linuxppc-embedded@ozlabs.org
Subject: Re: Yosemite/440EP why are readl()/ioread32() setup to readlittle-endian?
Date: Thu, 2 Feb 2006 11:16:03 -0700	[thread overview]
Message-ID: <20060202111603.B28536@cox.net> (raw)
In-Reply-To: <20060202174504.GE12810@gate.ebshome.net>; from ebs@ebshome.net on Thu, Feb 02, 2006 at 09:45:04AM -0800

On Thu, Feb 02, 2006 at 09:45:04AM -0800, Eugene Surovegin wrote:
> On Thu, Feb 02, 2006 at 07:37:01AM -0700, Matt Porter wrote:
> > I mentioned the BE iomap variants that are being used on some non-pci
> > parisc devices already. I'll give a partial example of something that
> > is non-pci yet "arch-independent".
> > 
> > Take a non-pci EHCI core (yes, I know it's little endian by definition
> > but suspend reality for a second).  You can create an arch-independent
> > EHCI driver that uses the platform bus by using the iomap accessors.
> > Since these cores are licensed every day by XYZ startups for their
> > latest "gee-whiz" SoC, it reasons that you'll see the same core on
> > multiple licensable SoC architectures. I've seen one such thing
> > on MIPS.
> > 
> > We also know that major semiconductor companies do the same thing
> > for their peripherals in some cases. They're just as willing to
> > buy somebody else's USB core, for example.  So, having a BE
> > non-pci device cross platform isn't a stretch.
> > 
> > Take a look at drivers/scsi/53c700.{c,h}. That generic driver
> > is why BE iomap accessors were added. It's in the process of
> > being shared between parisc and m68k.
> > 
> 
> Matt, my problem with this approach is that it repeats the same 
> old mistakes but in "BE-mode", e.g. _assuming_ some access mode and 
> hard-coding it into the driver. I fail to see how assuming big-endian 
> is any better than assuming little-endian in this case. And this is 
> not _portable_ in my book, no matter what some people want me to 
> believe.
> 
> This fails miserably when for example you have a bus which does byte 
> swaps in every half-word. And yes, I have such device on my table and 
> I have to port PCMCIA/PCI drivers to this SoC :).

Yuck. But a good example that there are always ill-behaved exceptions.

> Here is how inb looks like:
> 
> static inline u8 fpi_inb(unsigned long port)
> {
>     port ^= 1;
>     return inb(port);
> }
> 
> IMO, truly portable and driver independent I/O accessors should be 
> implemented as a function pointers on per-bus (at least) basis which 
> can be overridden by arch or board code. In this case we can get rid 
> of "ugly" ifdefs in driver code :).

There are a ton of reasons for this too, but there's been resistance
in the past to anything adding an additional dereference to the ia32
case.  I think there's been some proposals to get around this and
maybe even some small level of acceptance. However, since the server
folks don't need it, it's slow going to get such a major change pushed
through.

FWIW, some Xscale IXPs could use the per-bus pointer accessors to
manage the some floating I/O windows more cleanly as well. RapidIO
has some use for it too. It's not just byte swapping at least.

You could drive this change, you know. :)

-Matt

  reply	other threads:[~2006-02-02 18:16 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-02  9:35 Yosemite/440EP why are readl()/ioread32() setup to readlittle-endian? Jenkins, Clive
2006-02-02  9:46 ` Eugene Surovegin
2006-02-02 14:37   ` Matt Porter
2006-02-02 17:45     ` Eugene Surovegin
2006-02-02 18:16       ` Matt Porter [this message]
2006-02-05  4:41         ` Yosemite/440EP PLB4 vs PLB3 DMA to PCI issue David Hawkins
2006-02-05 10:39           ` Wolfgang Denk
2006-02-05 23:47             ` David Hawkins
2006-02-06 18:31               ` Stefan Roese
2006-02-06 19:09                 ` David Hawkins
2006-02-08 15:38                   ` Stefan Roese
2006-02-08 18:43                     ` David Hawkins
2006-02-09  0:34                       ` Wolfgang Denk
2006-02-09 13:25                         ` Mark Chambers
2006-02-09 23:58                         ` Yosemite/440EP 'issues' as a PCI target David Hawkins
2006-02-10  7:47                           ` Stefan Roese
2006-02-10 17:05                             ` David Hawkins
2006-02-10 17:20                               ` Andrew Armitage
2006-02-10 17:26                                 ` David Hawkins
2006-02-10 17:31                               ` Wolfgang Denk
2006-02-10 17:38                                 ` David Hawkins
2006-02-10 17:58                                   ` David Hawkins
2006-02-11  6:03                                 ` David Hawkins
2006-02-11  8:21                                   ` Stefan Roese
2006-02-11 18:15                                     ` David Hawkins
2006-02-11 13:03                                   ` Wolfgang Denk
2006-02-10 17:59                               ` Stefan Roese
2006-02-10 18:11                                 ` David Hawkins
2006-02-11  8:06                                   ` Stefan Roese
2006-02-11 18:06                                     ` David Hawkins
2006-02-11 19:00                                     ` David Hawkins
     [not found]                               ` <43ECCCA2.1070007@sandburst.com>
     [not found]                                 ` <43ECCE7A.4090507@ovro.caltech.edu>
     [not found]                                   ` <43ECD19E.8010604@sandburst.com>
2006-02-10 19:13                                     ` David Hawkins
     [not found]                               ` <001701c62e6c$09c48ea0$6401a8c0@CHUCK2>
2006-02-10 18:19                                 ` David Hawkins
2006-02-11  6:06                                 ` David Hawkins
  -- strict thread matches above, loose matches on Subject: below --
2006-02-01 18:35 Yosemite/440EP why are readl()/ioread32() setup to readlittle-endian? Jenkins, Clive
2006-02-01 20:35 ` David Hawkins
2006-02-01 11:19 Jenkins, Clive
2006-02-01 17:02 ` David Hawkins
2006-02-01 17:44   ` Matt Porter
2006-02-01 17:53     ` David Hawkins
2006-02-01 18:04     ` David Hawkins
2006-02-01 18:11       ` Eugene Surovegin
2006-02-01 18:20         ` David Hawkins
2006-02-01 18:23           ` Eugene Surovegin
2006-02-01 21:14     ` Peter Korsgaard
2006-02-02  0:54       ` Kumar Gala
2006-02-02  3:07         ` Matt Porter
2006-02-02  8:09         ` Peter Korsgaard
2006-02-02  9:08           ` Eugene Surovegin
2006-02-02 17:34             ` Dale Farnsworth
2006-02-02 14:21           ` Matt Porter

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=20060202111603.B28536@cox.net \
    --to=mporter@kernel.crashing.org \
    --cc=Clive.Jenkins@xerox.com \
    --cc=galak@kernel.crashing.org \
    --cc=jacmet@sunsite.dk \
    --cc=linuxppc-embedded@ozlabs.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).