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

Lei Wen
2011-04-01T07:59:15Z

Hi Wolfgang,

On Fri, Apr 1, 2011 at 3:39 PM, Wolfgang Denk <wd@denx.de> wrote:
> 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.

That is not my case. In my case, for writeb, it would affect only
bits0-7, but leave
bit 8 untouched. However, I need the bit 8 to be set to be 0, which is
1 at the power
on.

>
> ? 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.

Yes, that is what I want. The bit8 set to 0.

Best regards,
Lei