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

Wolfgang Denk
2011-04-01T12:41:31Z

Dear Lei Wen,

In message <AANLkTikiH8FUKprdHOuWNe8su0fTN_HcawsZB9xehMaT@mail.gmail.com> you wrote:
>
> I think my code also could handle this. They only could set the
> CONFIG_SYS_NS16550_REG_SIZE to be 1
> and CONFIG_SYS_NS16550_MAX_REG_SIZE to be 4. Then
> the other bits is untouched by this driver.

I don't think so. You still use just a single writel() call then. To
leave the other bits untouched, you would have to perform a readl()
first, then insert one data byte, and then write it back. Your patch
does not do that.

> The previous version of ns16550 has the ability of control the access
> width according to the CONFIG_SYS_NS16550_REG_SIZE. I just don't
> understand why my patch is rejected for I give this back?

There are two reasons:

First, your code is not correct (see above), it works just for your
setup and by pure chance.

Second, this is a NS16550 driver, that can be used with all 16550
compatible devices. Handling incompatible UART chips, or UART chips
with additional fatures, is out of scope of this driver.

If you need to handle additional register settings, use a wrapper
driver as I suggested before.

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
Little known fact about Middle Earth: The Hobbits had a very sophi-
sticated computer network! It was a Tolkien Ring...