Subject: Re: 16bit aligned NS16550 variant
To: TAKEMURA Shin <takemura@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-kern
Date: 10/20/2001 20:21:10
"TAKEMURA Shin" wrote:

> # It seems that my last message was lost. So I send this again...
> 
> I'd like to change NS16550 serial driver, 'com' to add 16bit register
> access support. And I've made the patch(attached).
> 
> Some embedded companion chip and ASIC have UART compatible
> function but you must make 16bit access for thier registers.
> 
> With this change, the driver will access it's registers with specified
> access wrappers instead of bus_space_read/write.
> There will be added new entries for compatibility and no ather files
> will be affected. (I found over 50 files calling comprobe1 or
> comcnattach and I  gave up to chage them all.)
> 
> Please review the patch. If no one against me, I will commit this 
> change next weekend.

The correct way to do this is to add a bus_space for the bus the device
is connected to.  I'm currently using an embedded chip with a '550-alike
with registers on 32-bit boundaries without any modifications to the
bus_space_{read,write}_1's in com.c.  I've got some other mods to com.c,
but that's for issues like the chip I'm dealing with having a single
16bit clock divisor register (accessed with bus_space_write_2 but
it's physically a 32bit access register) instead of two separate 8bit
registers.

By using a separate bus space, you don't need to modify every driver you
need to access with your special restrictions.

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD CDs, Support and Service:    http://www.wasabisystems.com/