[U-Boot] [PATCH] include/ns16550.h: Unify structure declaration for registers

Detlev Zundel dzu at denx.de
Thu Apr 30 15:30:44 CEST 2009


Hello Shinya,

> I might be unclear. I used to use REG_SIZE = -16, as 16550 registers
> are located at 0, +0x10, +0x20, ..., .

Actually, come to think of it, I have never seen what you used to use,
as the REG_SIZE = -16 case was never in the official U-Boot sources.
Theoretically extending the "-4 to -8" step from the old code to
extrapolate to -16, I get exactly what my new version yields.

> Looks to me like playing with macros... but,
> this is better than before, and would work for my machine.

Thinking about it some more, I wonder about the following.  You said,
this would work for you:

struct NS16550 {
       unsigned long rbr;
       unsigned long postpad_rbr[3];
....

while

struct NS16550 {
       unsigned char rbr;
       unsigned char postpad_rbr[12];
...

doesn't.  If we regard only the "significant" 8-bits, the first layout
is congruent to the second shifted by 2 bytes (on big-endian machines).

So what about using +16 for your board and lower the base address by 2?
Does that work?  What is your base address?  Is that 64-bit aligned?

This is somewhat hypothetical and outright ugly, but I still want to
know if this works.

Thanks
  Detlev

-- 
#!/usr/bin/perl -l
print ((1 x shift) !~ /^(11+?)\1+$/ ? "prime" : "not prime");
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the U-Boot mailing list