
Dear Ilya,
in message 4A0BE30F.9070902@emcraft.com you wrote:
Well, out_be32() and friends don't convert pointer, you are right. But these functions are not really generic, they can be found only on couple of archs. And writel() and friends (which are generic accessor functions for MMIO) do silent pointer conversion...
That's a serious deficiency of the (current) ARM implementation then. Also please keep in mind that, at least in Linux, readl() / writel() and friend are primarily intended to perform PCI memory accesses via an ioremap region, and that they perform little endian accesses.
I agree that the current definition:
#define __arch_getl(a) (*(volatile unsigned int *)(a)) ... #define readl(a) __arch_getl(a)
is indeed horrible and does not perform any of the type checking I supposedit was doing. [Hm.. sometimes I wish I had better knowledge of the ARM code in U-Boot and Linux, but at times like this I am pretty sure that I should be happy that I don't :-( ]
I see. PowerPC in Linux uses C structs too. But there are still a lot of code that uses registers offsets in Linux, so my arguments are the same: requirement to convert offsets to C struct brings additional difficulties to porting (and maintaining already ported) drivers from Linux.
I understand your argument, but the decision has been made. We want to get rid of this pointer stuff in U-Boot, and do not accept any new code like this any more.
Ok, we can do that. But for what reason? I don't think this improves readability...
Well, I don't think long lists of address offsets improve readability.
Best regards,
Wolfgang Denk