On Thu, May 14, 2015 at 03:15:55PM -0500, Timur Tabi wrote:
On 05/14/2015 03:03 PM, Arnd Bergmann wrote:
writel(cpu_to_le32(wor), &data->control->wor);
Why the double endianess swap? Are the registers defined to be CPU-endian?
You probably mean le32_to_cpu() here, not the other way round, although the effect is the same.
Maybe I'd doing the whole __le32 thing wrong, but I think cpu_to_le32(wor) is correct. 'wor' is a normal integer, so it's in "cpu" format. I want to convert it to le32 format so that I write an le32 value to memory. Therefore, cpu_to_le32(). Most calls to writel() use cpu_to_le32():
What other drivers do is completely irrelevant. The key question is what _this_ hardware does, and you should know that.
It concerns me that you point to other drivers as argument for using the endianness conversion your code. That raises the question if you really understand the hardware. Is the register known to be a little endian register, even on a big endian machine, or is it in host byte order ? You don't really answer that question.
Guenter