[lkml]   [1999]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: New resources - pls, explain :-(
On Sat, Aug 14, 1999, Linus Torvalds <> wrote:

>You can do byte-swapping by hand.
>I think it is really _stupid_ to do a writel_be(), and quite frankly, the
>moew people whine about it the less likely I'm going to accept it. So far
>all the arguments have just been _stupid_. They haven't had any reasoning.

Hi Linus !

I think it's not so stupid, but should definitely not be called
writel_be(). I _do_ agree however that the arguments so far were not very
precise, I'll try do be clear:

Basically, as Paul Mackerras noticed, there are cases when you move bunch
of byte datas 32 bits at a time (or 16 bits at a time) between the HW
device and system memory where you just need no swapping, whatever endian
is current on your platform. And of course, in those cases, you also want
maximum performances. So you want to avoid swapping twice, which would be
your only choice if writel is little endian.

This is quite common when accessing HW fifos (I'm doing this on a sound
card driver).

I see 3 cases:

- writel/readl are native endian, which I think is just plain wrong
- writel/readl are little endian and you do not provide no-swap
versions. In this case, doing the above requires either double-swapping
on be-machines, or re-implementing the writel/readl logic withtout the
swap in the driver, which makes the driver dependant on the
implementation of writel/readl.
- writel/readl are little endian, and you provide writel_ns/readl_ns. On
little endian platforms, those are #defined to be writel/readl. On big
endian platforms they avoid swapping.

Perso. e-mail: <>
Work e-mail: <>
BenH. Web : <>

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:53    [W:0.126 / U:31.480 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site