From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michal Simek <monstr@monstr.eu>, Arnd Bergmann <arnd@arndb.de>,
"Vineet Gupta" <Vineet.Gupta1@synopsys.com>,
<linux-kernel@vger.kernel.org>, <grant.likely@secretlab.ca>,
<alan@lxorguk.ukuu.org.uk>, <geert@linux-m68k.org>,
<dahinds@users.sourceforge.net>
Subject: Re: [PATCH] drivers/block/xsysace - replace in(out)_8/in(out)_be16/in(out)_le16 with generic iowrite(read)8/16(be)
Date: Wed, 6 Feb 2013 01:25:00 +0400 [thread overview]
Message-ID: <511178AC.7080304@synopsys.com> (raw)
In-Reply-To: <1360098004.4529.13.camel@pasglop>
On 02/06/2013 01:00 AM, Benjamin Herrenschmidt wrote:
> On Tue, 2013-02-05 at 18:03 +0400, Alexey Brodkin wrote:
>> =====
>>
>> and its endianess is fixed which is stated in this document
>> (http://www.xilinx.com/support/documentation/ip_documentation/xps_sysace.pdf).
>> =====
>> The Xilinx System ACE Compact Flash chip is a true little-endian device
>> =====
>
> So far so good...
>
>> But in its turn Xilinx System ACE Compact Flash chip is attached to
>> CPU's interface bus via some bridge. Depending on interface bus used it
>> could be BVCI-to-MPU (Microprocessor Interface of the System ACE
>> Compact Flash solution peripheral) for ARC, PLB for MicroBlaze etc.
>> And this bridge in general may do whatever its (HW) developer wants.
>>
>> For example for MicroBlaze Xilinx has its XPS Sysace interface
>> controller
>> (http://www.xilinx.com/support/documentation/ip_documentation/xps_sysace.pdf)
>> which does bit-swapping from PLB's big-endian bytes to xsysace
>> CF-controller little-endian bytes (though bytes in words are not swapped):
>> =====
>> The Xilinx System ACE Compact Flash chip is a true little-endian device
>> and the PLB is a big-endian bus. Therefore the XPS System ACE Interface
>> Controller will do a bit-swap in each byte when connecting the PLB data
>> bus to the System ACE data bus as shown in Table 2.
>
> This sounds totally bogus to me. But I'll have a look at the doco to
> understand it better. I'll try to do so later today.
>
>> Note however, that the XPS System ACE Interface Controller does not
>> perform the byte swapping necessary to interface to a little-endian
>> device when configured to use 16-bit mode. Therefore, the software
>> drivers provided for this core will perform the necessary byte-swapping
>> to correctly interface to the Xilinx System ACE Compact Flash chip as
>> shown in Table 3.
>> =====
>>
>> So at this point I'd say that data access should be done differently
>> depending on HW (bridge) used.
>
> Well, bytes accesses should never need any swapping whatsoever. 16-bit
> access requires swapping for a LE device for register, never for a data
> port. If it does, the bridge is wired incorrectly.
Sorry, saying "data access" here I meant accessing 16-bit registers
indeed. Because most of configuration/control is done via setting values
in registers. I should have selected proper terms.
>> Another question is do we know for sure that for particular architecture
>> only 1 interface bridge is used. If so then we may select proper
>> accessors per architecture.
>
> There aren't two ways to wire up an interface bridge correctly. I would
> advocate not supporting any incorrect wiring in Linux. Doing so would be
> going back to supporting horrors like IDE wired backward etc... which we
> have mostly gotten rid of.
>
> People need to be educated in this area, and Linux upstream doesn't have
> to support any piece of shit anybody comes up with because they can't be
> bothered understanding what endianness and byte address invariance mean.
Sounds good but how should one tell which approach is correct? For
example here - is the one implemented by Xilinx is golden reference or not?
>>>>> It is just sharing the same IP across all platforms. Which is better
>>>>> than create new devices and new device drivers for it. It means that
>>>>> all of them are register compatible but require access with native
>>>>> platform endianness as I listed above.
>>>>
>>>> Every attempt at doing "native platform endianness" has always been a
>>>> misguided attempt turning into a trainwreck (see OHCI USB).
>>>>
>>>> Just pick one endian for the device and stick to it.
>>>
>>> It is reality and I can't change it. Arnd mentioned it earlier that USB
>>>
>>>
>>>>> It is not a problem to create runtime wrapper and even detect endian
>>>>> directly in the driver
>>>>> but the point if this is the proper design.
>>>>> Also ioread32 and ioread32be shouldn't be used on ARM because there
>>>>> are missing memory barriers.
>>>>
>>>> Then fix them, they shouldn't be, it's a bug, it will break many other
>>>> drivers. They should be fully equivalent to readl.
>>>
>>> I want to be sure about this. I have parsed this again with closer look and
>>> seems to me that ioread32 is equal to readl and iowrite32 to writel.
>>> Arnd: Am I right?
>>>
>>> Thanks,
>>> Michal
>>
>> -Alexey
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
>
>
-Alexey
next prev parent reply other threads:[~2013-02-05 21:26 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-29 16:02 [PATCH] drivers/block/xsysace - replace in(out)_8/in(out)_be16/in(out)_le16 with generic iowrite(read)8/16(be) Alexey Brodkin
2013-01-29 16:27 ` Arnd Bergmann
2013-01-30 11:03 ` Alexey Brodkin
2013-01-30 11:13 ` Michal Simek
2013-01-30 12:10 ` Vineet Gupta
2013-01-30 12:31 ` Michal Simek
2013-01-30 14:36 ` Arnd Bergmann
2013-02-04 9:26 ` Michal Simek
2013-02-04 17:24 ` Arnd Bergmann
2013-02-05 2:29 ` Benjamin Herrenschmidt
2013-02-05 10:54 ` Michal Simek
2013-02-05 12:09 ` Vineet Gupta
2013-02-05 12:29 ` Benjamin Herrenschmidt
2013-02-05 12:19 ` Benjamin Herrenschmidt
2013-02-05 12:38 ` Michal Simek
2013-02-05 14:03 ` Alexey Brodkin
2013-02-05 15:12 ` Arnd Bergmann
2013-02-05 21:01 ` Benjamin Herrenschmidt
2013-02-06 10:03 ` Grant Likely
2013-02-06 16:20 ` Arnd Bergmann
2013-02-06 16:21 ` Michal Simek
2013-02-07 0:34 ` Arnd Bergmann
2013-02-06 17:40 ` Michal Simek
2013-02-06 19:51 ` Geert Uytterhoeven
2013-02-07 7:23 ` Michal Simek
2013-02-07 7:38 ` Geert Uytterhoeven
2013-02-07 8:01 ` Michal Simek
2013-02-07 8:20 ` Geert Uytterhoeven
2013-02-07 8:33 ` Arnd Bergmann
2013-02-07 14:19 ` Michal Simek
2013-02-07 23:12 ` Arnd Bergmann
2013-02-11 10:38 ` Michal Simek
2013-02-11 15:26 ` Arnd Bergmann
2013-02-11 15:36 ` Michal Simek
2013-02-11 15:43 ` Arnd Bergmann
2013-02-11 15:57 ` Michal Simek
2013-02-11 16:08 ` Arnd Bergmann
2013-02-12 0:29 ` Benjamin Herrenschmidt
2013-02-12 11:29 ` Arnd Bergmann
2013-02-12 10:11 ` Michal Simek
2013-02-12 11:26 ` Arnd Bergmann
2013-02-12 12:14 ` Michal Simek
2013-02-12 13:55 ` Arnd Bergmann
2013-02-12 12:30 ` Benjamin Herrenschmidt
2013-02-12 0:25 ` Benjamin Herrenschmidt
2013-02-12 10:03 ` Michal Simek
2013-02-05 21:00 ` Benjamin Herrenschmidt
2013-02-05 21:25 ` Alexey Brodkin [this message]
2013-02-05 23:07 ` Benjamin Herrenschmidt
2013-02-06 10:14 ` Grant Likely
2013-02-06 16:27 ` Arnd Bergmann
2013-02-06 21:35 ` Benjamin Herrenschmidt
2013-02-07 12:09 ` Alexey Brodkin
2013-02-07 12:20 ` Benjamin Herrenschmidt
2013-02-07 12:23 ` Benjamin Herrenschmidt
2013-02-07 14:31 ` Michal Simek
2013-02-07 14:35 ` Alexey Brodkin
2013-02-07 14:39 ` Grant Likely
2013-02-07 14:51 ` Grant Likely
2013-02-07 15:12 ` Alexey Brodkin
2013-02-07 15:23 ` Grant Likely
2013-02-07 15:28 ` Alexey Brodkin
2013-02-07 16:44 ` Grant Likely
2013-02-07 16:56 ` Alexey Brodkin
2013-02-07 17:16 ` Grant Likely
2013-02-07 17:22 ` Alexey Brodkin
2013-02-08 7:45 ` Grant Likely
2013-02-07 21:18 ` Benjamin Herrenschmidt
2013-02-07 21:15 ` Benjamin Herrenschmidt
2013-02-07 23:05 ` Arnd Bergmann
2013-02-08 6:19 ` Geert Uytterhoeven
2013-02-08 7:14 ` Grant Likely
2013-02-07 21:09 ` Benjamin Herrenschmidt
2013-02-12 17:02 ` Michal Simek
2013-02-12 17:25 ` Arnd Bergmann
2013-03-21 17:01 ` Alexey Brodkin
2013-06-19 8:56 ` xsysace driver support on arches other than PPC/Microblaze Alexey Brodkin
2013-06-19 9:09 ` Alexey Brodkin
2013-06-19 12:13 ` Andy Shevchenko
2013-06-19 12:56 ` Alexey Brodkin
2013-06-19 14:51 ` Arnd Bergmann
2013-02-07 21:06 ` [PATCH] drivers/block/xsysace - replace in(out)_8/in(out)_be16/in(out)_le16 with generic iowrite(read)8/16(be) Benjamin Herrenschmidt
2013-02-05 23:03 ` Arnd Bergmann
2013-02-06 8:59 ` Geert Uytterhoeven
2013-02-06 16:18 ` Arnd Bergmann
2013-02-05 10:45 ` Michal Simek
-- strict thread matches above, loose matches on Subject: below --
2013-06-21 14:02 Alexey Brodkin
2013-06-21 14:23 ` Arnd Bergmann
2013-06-21 18:35 ` Alexey Brodkin
2013-06-21 18:40 ` Arnd Bergmann
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=511178AC.7080304@synopsys.com \
--to=alexey.brodkin@synopsys.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arnd@arndb.de \
--cc=benh@kernel.crashing.org \
--cc=dahinds@users.sourceforge.net \
--cc=geert@linux-m68k.org \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=monstr@monstr.eu \
/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.