All of lore.kernel.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/8] ARM: support for Moschip MCS814x SoCs
Date: Tue, 17 Jul 2012 13:51:14 +0000	[thread overview]
Message-ID: <201207171351.15034.arnd@arndb.de> (raw)
In-Reply-To: <20120717152826.2bf75948@skate>

On Tuesday 17 July 2012, Thomas Petazzoni wrote:
> And then, on PowerPC, which accessors do you use to access
> SoC-peripherals that are not on the PCI bus?

PowerPC has in_le32/out_le32 and variants of those, which unfortunately
are not defined for most other architectures, so you cannot use them
in portable code. They are the same as readl/writel, but without the
PCI error handling.

> For example, drivers/tty/serial/mpsc.c uses writel/readl, so a
> conversion to/from little-endian is done when writing/reading
> registers. Are those memory-mapped devices little-endian even though
> they are used on big-endian PowerPCs?
> 
> I apologize for the silly questions, but I'm trying to make some sense
> out of these numerous I/O and memory accessors.

All combinations of little/big endian CPUs and peripherals have been
done in the past, including peripherals that switch their endianess
dynamically when you change the mode of the CPU, and those that come
with an extra register to add byte-swapping for operating systems
that don't deal with it.

It's all a big mess and there is no good solution that anyone has
managed to come with to cover all possibilities. My recommendation
is generally to use the little-endian accessors when they work,
and have your bus-specific or driver-specific wrapper around those
when the endianess is not always the same.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Thomas Petazzoni
	<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Cc: Mike Turquette
	<mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Florian Fainelli
	<florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 1/8] ARM: support for Moschip MCS814x SoCs
Date: Tue, 17 Jul 2012 13:51:14 +0000	[thread overview]
Message-ID: <201207171351.15034.arnd@arndb.de> (raw)
In-Reply-To: <20120717152826.2bf75948@skate>

On Tuesday 17 July 2012, Thomas Petazzoni wrote:
> And then, on PowerPC, which accessors do you use to access
> SoC-peripherals that are not on the PCI bus?

PowerPC has in_le32/out_le32 and variants of those, which unfortunately
are not defined for most other architectures, so you cannot use them
in portable code. They are the same as readl/writel, but without the
PCI error handling.

> For example, drivers/tty/serial/mpsc.c uses writel/readl, so a
> conversion to/from little-endian is done when writing/reading
> registers. Are those memory-mapped devices little-endian even though
> they are used on big-endian PowerPCs?
> 
> I apologize for the silly questions, but I'm trying to make some sense
> out of these numerous I/O and memory accessors.

All combinations of little/big endian CPUs and peripherals have been
done in the past, including peripherals that switch their endianess
dynamically when you change the mode of the CPU, and those that come
with an extra register to add byte-swapping for operating systems
that don't deal with it.

It's all a big mess and there is no good solution that anyone has
managed to come with to cover all possibilities. My recommendation
is generally to use the little-endian accessors when they work,
and have your bus-specific or driver-specific wrapper around those
when the endianess is not always the same.

	Arnd

  reply	other threads:[~2012-07-17 13:51 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-15 14:49 [PATCH 0/8] ARM: support for Moschip MCS814x SoCs Florian Fainelli
2012-07-15 14:49 ` Florian Fainelli
2012-07-15 14:49 ` [PATCH 1/8] " Florian Fainelli
2012-07-15 14:49   ` Florian Fainelli
2012-07-16 12:29   ` Thomas Petazzoni
2012-07-16 12:29     ` Thomas Petazzoni
2012-07-16 12:43     ` Florian Fainelli
2012-07-16 12:43       ` Florian Fainelli
2012-07-16 15:55       ` Arnd Bergmann
2012-07-16 15:55         ` Arnd Bergmann
2012-07-16 17:57       ` Nicolas Pitre
2012-07-16 17:57         ` Nicolas Pitre
2012-07-23 19:11     ` Florian Fainelli
2012-07-23 19:11       ` Florian Fainelli
2012-07-27 22:42       ` Linus Walleij
2012-07-27 22:42         ` Linus Walleij
2012-07-16 15:54   ` Arnd Bergmann
2012-07-16 15:54     ` Arnd Bergmann
2012-07-16 20:47     ` Turquette, Mike
2012-07-16 20:47       ` Turquette, Mike
2012-07-17  9:41       ` Florian Fainelli
2012-07-17  9:41         ` Florian Fainelli
2012-07-17 10:47       ` Florian Fainelli
2012-07-17 10:47         ` Florian Fainelli
2012-07-16 22:12     ` Linus Walleij
2012-07-16 22:12       ` Linus Walleij
2012-07-17  9:35       ` Florian Fainelli
2012-07-17  9:35         ` Florian Fainelli
2012-07-17  9:34     ` Florian Fainelli
2012-07-17  9:34       ` Florian Fainelli
2012-07-17 13:07       ` Arnd Bergmann
2012-07-17 13:07         ` Arnd Bergmann
2012-07-17 13:32         ` Florian Fainelli
2012-07-17 13:32           ` Florian Fainelli
2012-07-17 13:45           ` Arnd Bergmann
2012-07-17 13:45             ` Arnd Bergmann
2012-07-17 10:16     ` Thomas Petazzoni
2012-07-17 10:16       ` Thomas Petazzoni
2012-07-17 13:12       ` Arnd Bergmann
2012-07-17 13:12         ` Arnd Bergmann
2012-07-17 13:28         ` Thomas Petazzoni
2012-07-17 13:28           ` Thomas Petazzoni
2012-07-17 13:51           ` Arnd Bergmann [this message]
2012-07-17 13:51             ` Arnd Bergmann
2012-07-16 22:06   ` Linus Walleij
2012-07-16 22:06     ` Linus Walleij
2012-07-15 14:49 ` [PATCH 2/8] ARM: MCS814x: add Device Tree based MCS8140 board support Florian Fainelli
2012-07-15 14:49   ` Florian Fainelli
2012-07-17 13:19   ` Arnd Bergmann
2012-07-17 13:19     ` Arnd Bergmann
2012-07-17 13:34     ` Florian Fainelli
2012-07-17 13:34       ` Florian Fainelli
2012-07-17 13:53       ` Arnd Bergmann
2012-07-17 13:53         ` Arnd Bergmann
2012-07-17 13:57         ` Florian Fainelli
2012-07-17 13:57           ` Florian Fainelli
2012-07-15 14:49 ` [PATCH 3/8] ARM: MCS814x: add Device Tree bindings documentation Florian Fainelli
2012-07-15 14:49   ` Florian Fainelli
2012-07-17 13:24   ` Arnd Bergmann
2012-07-17 13:24     ` Arnd Bergmann
2012-07-17 13:35     ` Florian Fainelli
2012-07-17 13:35       ` Florian Fainelli
2012-07-15 14:49 ` [PATCH 4/8] ARM: MCS814X: add DTS file for Tigal/Robotech RBT-832 Florian Fainelli
2012-07-15 14:49   ` Florian Fainelli
2012-07-17 13:27   ` Arnd Bergmann
2012-07-17 13:27     ` Arnd Bergmann
2012-07-15 14:49 ` [PATCH 5/8] ARM: MCS814x: add DTS file for Devolo dLAN USB Extender Florian Fainelli
2012-07-15 14:49   ` Florian Fainelli
2012-07-15 14:49 ` [PATCH 6/8] ARM: MCS814x: provide a sample defconfig file Florian Fainelli
2012-07-15 14:49   ` Florian Fainelli
2012-07-15 14:49 ` [PATCH 7/8] ARM: MSC814X: add Kconfig and Makefile to arch/arm Florian Fainelli
2012-07-15 14:49   ` Florian Fainelli
2012-07-15 14:49 ` [PATCH 8/8] ARM: MSC814x: add MAINTAINERS entry Florian Fainelli
2012-07-15 14:49   ` Florian Fainelli
2012-07-15 19:59 ` [PATCH 0/8] ARM: support for Moschip MCS814x SoCs Arnd Bergmann
2012-07-15 19:59   ` Arnd Bergmann
2012-07-16  8:16   ` Florian Fainelli
2012-07-16  8:16     ` Florian Fainelli
2012-07-16 18:09   ` Nicolas Pitre
2012-07-16 18:09     ` Nicolas Pitre

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=201207171351.15034.arnd@arndb.de \
    --to=arnd@arndb.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.