[U-Boot] [PATCH] serial: ns16550: fix different reg size access

Wolfgang Denk
2011-04-01T07:39:22Z

Dear Lei Wen,

In message <AANLkTindN8kSqiq28H68Rs77Dc6Pf-4MSTibAq_2dRaV@mail.gmail.com> you wrote:
>
> > This makes no sense to me. I have never seen any 9 bit registers in
> > any processor I ever encountered in real life.
>
> I don't mean that register is 9bit...
> I means that register, IER, is 32bit long, but 9-31th bit is reserved, and
> 0th to 8th bit is used... Maybe I don't say clearly...
> So byte access would only cover 0-7th bit, while 8th bit is not covered.
>
> > Also, in this case the serial controller is probably not NS16550
> > compatible, because AFAICT the NS16550 uses only 8 bit wide
> > registers.
>
> This is may be additional feature added. For another part except this
> one bit is all compatible with ns16550.

OK, so let's summarize the facts we found so far:

1. Your hardware is NOT NS16550 compatible. It does not have the
typical 8 bit register interface, but provides additional bits that
somehow control non-standard functionality.

2. You say there is one additional bit (bit 9, i. e. 0x00000100) which
must remain set to 1 which appears to be the default setting after
power-on reset.

3. You say that the current implementation, which uses a writeb() call
(i. e. a byte write operation) to this register would not only
affect bits 0...7, as expected, but also clear bit 9.

This seems somewhat unlikely to me, so please confirm that I
understood correctly.

4. You say that writing a 32 bit value instead (i. e. using writel())
would work for you.

This seems also unlikely to me, as the driver just operates on 8
bit data, and will insert only 8 bit data into the word written, so
you will write some data word like 0x000000XX - and in this case
(and only in this case) the 9th bit would explicitly be set to 0.

So from my understanding of the code the original version is supposed
to work on your hardware, while your patched version should definitely
NOT work.

Yet you state it's exactly vice versa.

Either I'm missing something, or you fail to provide complete
information.

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
Space is big. You just won't believe how vastly, hugely, mind-
bogglingly big it is. I mean, you may think it's a long way down the
road to the drug store, but that's just peanuts to space.
-- The Hitchhiker's Guide to the Galaxy