public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Serial: updated serial drivers
@ 2002-07-07  0:00 Russell King
  2002-07-07 10:01 ` Miquel van Smoorenburg
  2002-07-15 10:03 ` William Lee Irwin III
  0 siblings, 2 replies; 8+ messages in thread
From: Russell King @ 2002-07-07  0:00 UTC (permalink / raw)
  To: linux-kernel

Hi,

I've been maintaining a serial driver "off the side" of the ARM port
which cleans up the serial driver mess that we currently have, with
many duplications of serial.c, each with subtle bugs.

Since ARM seems to have a poliferation of various UARTs, each of them
different, if this were to carry on we'd end up with 6 or 7 more
copies of serial.c.  This is obviously unacceptable.

So, with a view to cutting down on this duplication, I split serial.c
into a core driver, which can be used by various "low level" serial
hardware drivers, including the ARM ones, but also the 8250/16550
drivers.

Jeff and Arjan (iirc) expressed some concern about the PCI and PNP
code in serial.c, so that got separated out in what has now come to
be known as the serial rewrite.

The only non-ARM driver this patch affects is the 8250/16550 serial.c
driver.  The others have not been ported to this infrastructure yet.

The patch does contain details on the interface between the low level
and core serial drivers.

This project was first announced to linux-kernel on 6 November 2001:

 http://marc.theaimsgroup.com/?l=linux-kernel&m=100504194616062&w=2

Linus has expressed an interest in merging this work; hence this
message.  Before I do send it to Linus, I would like to get some
feedback on the code.  So, here is the latest patch against 2.5.24:

 http://www.home.arm.linux.org.uk/cvs/serial-2.5.24.diff.bz2

It should cleanly apply to 2.5.24.  The names of the serial options
have changed, so use your favourite configuration program to select
the relevant options.

This patch affects the following mainline drivers:
	- 8250/16550 "generic" serial driver (serial.o)
	- PCMCIA serial probe module (serial_cs.o)

Please send any bug reports in my direction.  There is one specific
area that I'm unable to test here - 8250/16x50 "shared" interrupts
(where multiple 8250/16x50 devices share the same interrupt line).
I'm expecting my mailbox to overflow tomorrow, so...

Note that, as ever, 8250/16x50 sharing with non-serial devices is
NOT guaranteed to work on edge-based IRQ systems like PCs (and if
you want this to work you can either configure your kernel
appropriately, or pass "share_irqs=1" in modules.conf for
serial_8250.o)

The future:

 - work with tytso to integrate any relevant bits of serial_core.c
   with the tty layer.
 - fix bugs
 - there seems to be a fair number of people wanting support for
   the higher speeds of UARTs (eg 16C950 and most motherboard
   devices)
 - add support for driverfs
 - remove the silly situation where we have ports openable, but
   no hardware behind them (and use some other method to create
   serial devices on demand if still required)
 - remove callout functionality, which has been marked as such for
   a few years now.  tytso mentions that the only program this
   might break is minicom, which should be fixed.

I'm sure there's other stuff people want. 8)

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: Serial: updated serial drivers
@ 2002-07-07 14:15 Marko Kohtala
  0 siblings, 0 replies; 8+ messages in thread
From: Marko Kohtala @ 2002-07-07 14:15 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel

Russell King wrote:
> Linus has expressed an interest in merging this work; hence this
> message.  Before I do send it to Linus, I would like to get some
> feedback on the code.  So, here is the latest patch against 2.5.24:
> 
>  http://www.home.arm.linux.org.uk/cvs/serial-2.5.24.diff.bz2
...
> I'm sure there's other stuff people want. 8)

It looks good.

I have one additional request that might best be done while doing this kind of rewrite.

I came across an IndustryPack (IP) carrier card. Each IP sits on a 16 bit bus. The carrier is a PCI device and has slots for four IP, each IP module I had carried eight 16550 serial ports.

With this I came up with two problems:

1) The PCI<->IP bridge had a bug with byte accesses. The iotype SERIAL_IO_MEM and iomem_reg_shift 1 addressed right addresses, but with byte access, so it did not work.

2) All the 32 serial ports were on same IRQ. You could find out which ports need service on an interrupt with one or two register reads, but the serial driver wanted to get and handle the IRQ on its own. The multiport support did not quite work for this.

One solution to allow the carrier driver address these would be to replace the struct uart_port iotype with a pointer to

struct serial_hw_ops {
  unsigned int (*serial_in)(struct uart_port *, int offset);
  void (*serial_out)(struct uart_port *, int offset, int value);
  int (*enable_irq)(struct uart_port *, void (*irq_func)(struct uart_port *));
  void (*disable_irq)(struct uart_port *);
};

Then implement new register_serial functions for the carrier card driver to use that take this as argument (serial8250_register?). The irq_func would be the function carrier driver calls to get the IRQ serviced (close to serial8250_handle_port).

The struct uart_port would need to also carry a pointer to carrier specific data. Only the enable_irq and disable_irq will need carrier data.

I think the current iobase and other members are good enough such that the serial_in and serial_out can be implemented rather efficiently without the extra indirection through the carrier data pointer.

I'm not sure if it would still incur a small overhead to I/O access. Perhaps not, as it would seem to me the serial_in does not get inlined and there would be one switch statement we could avoid by this. You are more competent to judge this.

This would also nicely clean up the SERIAL_IO_HUB6 case in serial_in/out. And it would help other multiport serial cards to utilize the registers they have to isolate the ports that interrupt.

The enable_irq in the carrier driver would see if the port is the first on the carrier, and request the IRQ to its own interrupt function. On the same interrupt there can be other things besides the serial ports.

struct serial_hw_ops instances and the functions for the standard single port or standard multiport cases should be exported. The carrier card has it's own module that needs access to these things for the serial8250_register call.

There are IP with other UART than 16550, so this should be used for all UART drivers.

Since this seems to affect the interface to port registration functions, it might be better to have it done now rather than later.


............................................................
Maksuton sähköposti aina käytössä http://luukku.com                            
Kuukausimaksuton MTV3 Internet-liittymä www.mtv3.fi/liittyma


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-07-15 18:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-07  0:00 Serial: updated serial drivers Russell King
2002-07-07 10:01 ` Miquel van Smoorenburg
2002-07-15 10:03 ` William Lee Irwin III
2002-07-15 11:01   ` William Lee Irwin III
2002-07-15 11:24     ` Russell King
2002-07-15 18:17       ` William Lee Irwin III
2002-07-15 14:25   ` Dave Hansen
  -- strict thread matches above, loose matches on Subject: below --
2002-07-07 14:15 Marko Kohtala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox