[U-Boot] [PATCH 01/10] mx27: basic cpu support

Wolfgang Denk wd at denx.de
Thu May 14 11:42:12 CEST 2009


Dear Ilya,

in message <4A0BE30F.9070902 at 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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In the beginning, there was nothing, which exploded.
                                - Terry Pratchett, _Lords and Ladies_


More information about the U-Boot mailing list