Skip to contentSkip to conversation

Bitrotting serial drivers

PATCH Applied Russell King 9 participants 21 messages Mar 19, 2005 – Mar 30, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

m32r_sio
--------

Maintainer: Hirokazu Takata

Please clean up the m32r_sio driver, removing whatever bits of code aren't absolutely necessary.

Specifically, I'd like to see the following addressed:

- the usage of SERIAL_IO_HUB6
(this driver doesn't support hub6 cards)
- SERIAL_IO_* should be UPIO_*
- __register_m32r_sio, register_m32r_sio, unregister_m32r_sio, m32r_sio_get_irq_map
(this driver doesn't support PCMCIA cards, all of which are based on
8250-compatible devices.)
- early_serial_setup
(should we really have the function name duplicated across different
hardware drivers?)

au1x00_uart
-----------

Maintainer: unknown (akpm - any ideas?)

This is a complete clone of 8250.c, which includes all the 8250-specific structure names.

Specifically, I'd like to see the following addressed:

- Please clean this up to use au1x00-specific names.
- this driver is lagging behind with fixes that the other drivers are getting. Is au1x00_uart actually maintained?
- the usage of UPIO_HUB6
(this driver doesn't support hub6 cards)
- __register_serial, register_serial, unregister_serial (this driver doesn't support PCMCIA cards, all of which are based on 8250-compatible devices.)
- early_serial_setup
(should we really have the function name duplicated across different
hardware drivers?)

The main reason is I wish to kill off uart_register_port and uart_unregister_port, but these drivers are using it.

Thanks.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#1 lore raw
Quoted 24 lines · Russell King

Hi,

m32r_sio
--------

Maintainer: Hirokazu Takata

Please clean up the m32r_sio driver, removing whatever bits of code aren't absolutely necessary.

Specifically, I'd like to see the following addressed:

- the usage of SERIAL_IO_HUB6
(this driver doesn't support hub6 cards)
- SERIAL_IO_* should be UPIO_*
- __register_m32r_sio, register_m32r_sio, unregister_m32r_sio, m32r_sio_get_irq_map
(this driver doesn't support PCMCIA cards, all of which are based on
8250-compatible devices.)
- early_serial_setup
(should we really have the function name duplicated across different
hardware drivers?)

Quoted 4 lines

au1x00_uart
-----------

Maintainer: unknown (akpm - any ideas?)

Ralf.

Quoted 26 lines

This is a complete clone of 8250.c, which includes all the 8250-specific structure names.

Specifically, I'd like to see the following addressed:

- Please clean this up to use au1x00-specific names.
- this driver is lagging behind with fixes that the other drivers are getting. Is au1x00_uart actually maintained?
- the usage of UPIO_HUB6
(this driver doesn't support hub6 cards)
- __register_serial, register_serial, unregister_serial (this driver doesn't support PCMCIA cards, all of which are based on 8250-compatible devices.)
- early_serial_setup
(should we really have the function name duplicated across different
hardware drivers?)

The main reason is I wish to kill off uart_register_port and uart_unregister_port, but these drivers are using it.

Thanks.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#2 lore raw
Quoted 6 lines · Andrew Morton
Quoted 4 lines

au1x00_uart
-----------

Maintainer: unknown (akpm - any ideas?)

Ralf.

Actually Pete Popov ([email protected]) who I put on the cc.

Quoted 8 lines
Quoted 8 lines

This is a complete clone of 8250.c, which includes all the 8250-specific structure names.

Specifically, I'd like to see the following addressed:

- Please clean this up to use au1x00-specific names.
- this driver is lagging behind with fixes that the other drivers are getting. Is au1x00_uart actually maintained?

Sort of; much of the Alchemy development effort is still going into 2.4.

Quoted 8 lines
Quoted 8 lines

- the usage of UPIO_HUB6
(this driver doesn't support hub6 cards)
- __register_serial, register_serial, unregister_serial (this driver doesn't support PCMCIA cards, all of which are based on 8250-compatible devices.)
- early_serial_setup
(should we really have the function name duplicated across different
hardware drivers?)

No argument here. Pete says the AMD Alchemy UART is just different enough to be hard to handle in the 8250 and so the driver is just an ugly chainsawed version of the 8250.c

Quoted 2 lines
Quoted 2 lines

The main reason is I wish to kill off uart_register_port and uart_unregister_port, but these drivers are using it.

Ralf

#3 lore raw
Quoted 6 lines · Ralf Baechle
Quoted 3 lines · Andrew Morton
Quoted 3 lines

au1x00_uart
-----------

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Maintainer: unknown (akpm - any ideas?)

Ralf.

Actually Pete Popov ([email protected]) who I put on the cc.

Thanks :)

Quoted 11 lines
Quoted 8 lines
Quoted 8 lines

This is a complete clone of 8250.c, which includes all the 8250-specific structure names.

Specifically, I'd like to see the following addressed:

- Please clean this up to use au1x00-specific names.
- this driver is lagging behind with fixes that the other drivers are getting. Is au1x00_uart actually maintained?

Sort of; much of the Alchemy development effort is still going into 2.4.

It works and no one has complained about any bugs. But you're right, fixes going into other drivers have not made it into this one.

Quoted 10 lines
Quoted 8 lines
Quoted 8 lines

- the usage of UPIO_HUB6
(this driver doesn't support hub6 cards)
- __register_serial, register_serial, unregister_serial (this driver doesn't support PCMCIA cards, all of which are based on 8250-compatible devices.)
- early_serial_setup
(should we really have the function name duplicated across different
hardware drivers?)

Quoted 7 lines

No argument here. Pete says the AMD Alchemy UART is just different enough to be hard to handle in the 8250 and so the driver is just an ugly chainsawed version of the 8250.c

Quoted 2 lines
Quoted 2 lines

The main reason is I wish to kill off uart_register_port and uart_unregister_port, but these drivers are using it.

I tried a couple of times to cleanly add support to the 8250 for the Au1x serial. The uart is just different enough to make that hard, though I admit I never spent too much time on it. Sounds like it's time to revisit it again.

Pete

#4 lore raw
Quoted 7 lines · Pete Popov
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

- __register_serial, register_serial, unregister_serial (this driver doesn't support PCMCIA cards, all of which are based on 8250-compatible devices.)

I tried a couple of times to cleanly add support to the 8250 for the Au1x serial. The uart is just different enough to make that hard, though I admit I never spent too much time on it. Sounds like it's time to revisit it again.

I would prefer to have a patch to remove (or ack to do so myself) the above three mentioned functions so I can avoid breaking your driver, rather than a large update to it.

Thanks.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#5 lore raw
Quoted 6 lines · Russell King
Quoted 4 lines · Pete Popov
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

- __register_serial, register_serial, unregister_serial (this driver doesn't support PCMCIA cards, all of which are based on 8250-compatible devices.)

Quoted 6 lines
Quoted 1 line

I tried a couple of times to cleanly add support to the 8250 for the Au1x serial. The uart is just different enough to make that hard, though I admit I never spent too much time on it. Sounds like it's time to revisit it again.

I would prefer to have a patch to remove (or ack to do so myself) the above three mentioned functions so I can avoid breaking your driver, rather than a large update to it.

Go for it. I'll test the driver afterwards and think about getting it into the 8250 again.

Thanks,

Pete

#6 lore raw
In reply to Pete Popov
Quoted 1 line · Pete Popov

It works and no one has complained about any bugs.

I hereby do complain that it doesn't work. ;)

I'd give more details, but I'm neither at work nor did I investigate the situation properly. What I remember trying is to add 'console=/dev/ttyS0' or somesuch to the commandline, but couldn't get it to work there. The funny thing is that when I use the GDB support over serial line (which seems to use a primitive, stripped-down version of a serial driver) it works, I can then redirect boot messages via 'console=gdb'.

Uli

#7 lore raw
Quoted 8 lines · Ulrich Eckhardt
Quoted 1 line · Pete Popov

It works and no one has complained about any bugs.

I hereby do complain that it doesn't work. ;)

I'd give more details, but I'm neither at work nor did I investigate the situation properly. What I remember trying is to add 'console=/dev/ttyS0' or somesuch to the commandline, but couldn't get it to work there.

Well, come on, I know that much works :) Which board and kernel rev?

Pete

Quoted 5 lines

The funny thing is that when I use the GDB support over serial line (which seems to use a primitive, stripped-down version of a serial driver) it works, I can then redirect boot messages via 'console=gdb'.

Uli

#8 lore raw
Quoted 7 lines · Pete Popov
Quoted 3 lines · Ulrich Eckhardt

I'd give more details, but I'm neither at work nor did I investigate the situation properly. What I remember trying is to add 'console=/dev/ttyS0' or somesuch to the commandline, but couldn't get it to work there.

Well, come on, I know that much works :) Which board and kernel rev?

DB1100 derivative running 2.6.something from linux-mips CVS. Maybe it's just PEBKAC though, I can't rule that out. Maybe I'll get to trying tomorrow again, but it's not on the top of my priorities - that's rooting from CF currently.

Uli

#9 lore raw
Quoted 10 lines · Ulrich Eckhardt
Quoted 7 lines · Pete Popov
Quoted 4 lines · Ulrich Eckhardt

I'd give more details, but I'm neither at work nor did I investigate the situation properly. What I remember trying is to add 'console=/dev/ttyS0' or somesuch to the commandline, but couldn't get it to work there.

Did you try console=ttyS0,*
I also had some problems with the 2.6 release and the serial console.

Michael

#10 lore raw
In reply to Pete Popov

If we leave the driver for the au1x00 as it is it should not have the register_serial / unregister_serial functions and it should be renamed to something else, e.g. ttySAxxx like it is done for the internal serial port of the strongarm (sa1100).

I have thought about the serial driver and came along this.
I we take a look at the hardware, we have a chip, the 8250 and its successors and the chip is integrated into some kind of hardware. So the chip has an interface. It has some address lines for register access, it has data lines and some controll lines. It also has an interrupt pin, some (GP)IO-Pins, that are freely programmable and a clock input. The chip is integrated thru some interface as I mentioned before. It can be an ISA-IO card or a PCI card or a multiport card, where more than one chip is accessed thru the same io-range and the hip to access is selected thru a single register. The au1x00 serial driver is like an ISA card except that the chip is mapped to a memory region instead of an io-region and the fact, that we can calculate the baud_base using the pll configuration of the au1x00, if we assume a 12MHz oscilator, which is standard for the au1x00.

We need some access methods to access the chip registers, some way to handle intterupts, some way to deal with the gpio-pins, and we need a way to get the clock input of the chip. What should the serial-chip driver know about and what should the card driver know about.

It's like the streams concept, where the chip driver does not know how to access the chip or what resources it uses, but what to do with the chip.

Regards,
Michael

#11 lore raw
In reply to Ralf Baechle
Quoted 8 lines · Ralf Baechle

On Sat, Mar 19, 2005 at 02:13:51PM -0800, Andrew Morton wrote:

No argument here. Pete says the AMD Alchemy UART is just different enough to be hard to handle in the 8250 and so the driver is just an ugly chainsawed version of the 8250.c

Even if I don't make me a lot of friends, the au1x00 driver seems to be a hack.

Most of the difference seems to be the PCI stuff, that has been removed and the access method. Shouldn't we have a driver for the chip and one driver for each access method (isa,pci,...). The access method should handle register access and the bus abstraction.
I have a lot of problems with the au1x00 serial driver, because I use it together with a PCMCIA serial port card.

Michael

#12 lore raw
Quoted 4 lines

Most of the difference seems to be the PCI stuff, that has been removed and the access method.
Shouldn't we have a driver for the chip and one driver for each access method (isa,pci,...).

Right! I'm entirely with you. SGI Octane required hacks to the 8250 driver just to get a new access method.

Stanislaw

#13 lore raw
In reply to Michael Stickel
Quoted 2 lines

Even if I don't make me a lot of friends, the au1x00 driver seems to be a hack.

Well, it basically is.

Quoted 1 line

Most of the difference seems to be the PCI stuff, that has been removed and the access method.

There were a bunch of differences including how you program the baud rate, the addresses of the registers, and if I remember correctly, additional/different registers. To cleanly get the au1x support into the 8250 driver, some additional abstraction was necessary and I just never had the time to do it.

Pete

#14 lore raw
Quoted 1 line · Pete Popov

There were a bunch of differences including how you program the baud rate,

You mentioned the baudrate. There is one thing that had happend to me. On the au1x00 the baud_base is 0 by default. In the serial driver there is a division by baud_base, that ends up in a an exception. How could we handle that. For the moment I set it to a default before it is used:

if (baud_base == 0L)
baud_base = 115200;

Which is also a hack. How can we get the correct baud_base for a pcmcia based serial-port.

Quoted 4 lines

the addresses of the registers, and if I remember correctly, additional/different registers. To cleanly get the au1x support into the 8250 driver, some additional abstraction was necessary and I just never had the time to do it.

We should have a resource for the register access and the serial driver should not care about what it is (memory,io,au1x00,multiport,...). It should just use the resource to access the chip. The resource can be a "virtual resource" like the multiport cards that have an index register.

The serial port needs a second resource that is the interrupt.

Michael

#15 lore raw

On Mon, Mar 21, 2005 at 01:12:08PM +0100, Michael Stickel wrote:

It would be useful if you had not truncated the cc list of this thread. The people that deciede on the serial drivers fate are now no longer receiving it.

Ralf

#16 lore raw
In reply to Russell King

Hi,

I made a patch to update m32r_sio driver.

Compile checked and tested on a M32700UT eva board with SMP kernel. It looks working...

Could you please accept the following patch?

Thanks,
-- Takata

From: Russell King <[email protected]>
Date: Sat, 19 Mar 2005 17:21:01 +0000

Quoted 10 lines

m32r_sio
--------

Maintainer: Hirokazu Takata

Please clean up the m32r_sio driver, removing whatever bits of code aren't absolutely necessary.

Specifically, I'd like to see the following addressed:

Quoted 7 lines

- the usage of SERIAL_IO_HUB6
(this driver doesn't support hub6 cards)
- SERIAL_IO_* should be UPIO_*
- __register_m32r_sio, register_m32r_sio, unregister_m32r_sio, m32r_sio_get_irq_map
(this driver doesn't support PCMCIA cards, all of which are based on
8250-compatible devices.)

__register_m32r_sio, register_m32r_sio, unregister_m32r_sio are still remained. I'm going to take a look them after.

Quoted 4 lines

- early_serial_setup
(should we really have the function name duplicated across different
hardware drivers?)

---

 drivers/serial/m32r_sio.c     |  156 ++++++++--------------------------
 drivers/serial/m32r_sio.h     |    1 
 drivers/serial/m32r_sio_reg.h |  190 ------------------------------------------
 include/asm-m32r/serial.h     |  142 ++++---------------------------
 include/linux/serial_core.h   |    3 
 5 files changed, 59 insertions(+), 433 deletions(-)
include/linux/serial_core.h +3 -0
diff -ruNp a/include/linux/serial_core.h b/include/linux/serial_core.h
@@ -113,6 +113,9 @@
 /* Samsung S3C2400 SoC */
 #define PORT_S3C2400	67
 
+/* M32R SIO */
+#define PORT_M32R_SIO	68
+
 #ifdef __KERNEL__
 
 #include <linux/config.h>
include/asm-m32r/serial.h +19 -123

160 lines not on this page · raw message

drivers/serial/m32r_sio.c +37 -119

294 lines not on this page · raw message

drivers/serial/m32r_sio.h +0 -1
diff -ruNp a/drivers/serial/m32r_sio.h b/drivers/serial/m32r_sio.h
@@ -36,7 +36,6 @@ struct old_serial_port {
 	unsigned int port;
 	unsigned int irq;
 	unsigned int flags;
-	unsigned char hub6;
 	unsigned char io_type;
 	unsigned char *iomem_base;
 	unsigned short iomem_reg_shift;
drivers/serial/m32r_sio_reg.h +0 -190

201 lines not on this page · raw message

--
Hirokazu Takata <[email protected]>
Linux/M32R Project: http://www.linux-m32r.org/

#17 lore raw
Quoted 1 line · Hirokazu Takata

Could you please accept the following patch?

Probably, but I'd like to have a reply to my comments below first.

include/asm-m32r/serial.h

Quoted 3 lines

diff -ruNp a/include/asm-m32r/serial.h b/include/asm-m32r/serial.h

include/asm-m32r/serial.h +0 -0

Can m32r accept PCMCIA cards? If so, this may mean that 8250.c gets built, which will use this file to determine where it should look for built-in 8250 ports.

If this file is used to describe non-8250 compatible ports, you could end up with a nasty mess. Therefore, I recommend that you do not use asm-m32r/serial.h to describe your SIO ports.

Instead, since these definitions are private to your own driver, you may consider moving them into the driver, or a header file closely associated with your driver in drivers/serial.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#18 lore raw

From: Russell King <[email protected]>
Date: Thu, 24 Mar 2005 12:17:46 +0000

Quoted 13 lines · Hirokazu Takata
Quoted 1 line

Could you please accept the following patch?

Probably, but I'd like to have a reply to my comments below first.

include/asm-m32r/serial.h

Quoted 3 lines

diff -ruNp a/include/asm-m32r/serial.h b/include/asm-m32r/serial.h

include/asm-m32r/serial.h +0 -0

Can m32r accept PCMCIA cards? If so, this may mean that 8250.c gets built, which will use this file to determine where it should look for built-in 8250 ports.

Quoted 3 lines

If this file is used to describe non-8250 compatible ports, you could end up with a nasty mess. Therefore, I recommend that you do not use asm-m32r/serial.h to describe your SIO ports.

I understand.

You mean I have to keep 8250.c buildable for PCMCIA serial cards, if I make use of both m32r_sio and 8250 compatible drivers at a time, right?

Quoted 3 lines

Instead, since these definitions are private to your own driver, you may consider moving them into the driver, or a header file closely associated with your driver in drivers/serial.

I will try to move these definitions into the m32r_sio driver. Please just a moment, I have no time to do it now...

Thank you.

-- Takata

#19 lore raw

PATCH 1/1 m32r: m32r_sio driver update (was Re: [PATCH] Re: Bitrotting serial drivers)

In reply to Russell King

Hello,

Here is an additional patch to update m32r_sio driver. This patch is against 2.6.12-rc1-mm3.

m32r_sio driver updates:
- Move m32r_sio specific description from asm-m32r/serial.h to driver/serial/m32r_sio.c.
- Remove __register_m32r_sio, register_m32r_sio and unregister_m32r_sio from driver/serial/m32r_sio.c.

Thank you.

From: Russell King <[email protected]>
Subject: Re: [PATCH] Re: Bitrotting serial drivers
Date: Thu, 24 Mar 2005 12:17:46 +0000

Quoted 9 lines · Hirokazu Takata

include/asm-m32r/serial.h

Quoted 3 lines

diff -ruNp a/include/asm-m32r/serial.h b/include/asm-m32r/serial.h

include/asm-m32r/serial.h +0 -0

Can m32r accept PCMCIA cards? If so, this may mean that 8250.c gets built, which will use this file to determine where it should look for built-in 8250 ports.

Quoted 7 lines

If this file is used to describe non-8250 compatible ports, you could end up with a nasty mess. Therefore, I recommend that you do not use asm-m32r/serial.h to describe your SIO ports.

Instead, since these definitions are private to your own driver, you may consider moving them into the driver, or a header file closely associated with your driver in drivers/serial.

---

 drivers/serial/m32r_sio.c |  131 ++++++++++------------------------------------
 include/asm-m32r/serial.h |   41 --------------
 2 files changed, 31 insertions(+), 141 deletions(-)
include/asm-m32r/serial.h +2 -39
diff -ruNp a/include/asm-m32r/serial.h b/include/asm-m32r/serial.h
@@ -1,47 +1,10 @@
 #ifndef _ASM_M32R_SERIAL_H
 #define _ASM_M32R_SERIAL_H
 
-/*
- * include/asm-m32r/serial.h
- */
+/* include/asm-m32r/serial.h */
 
 #include <linux/config.h>
-#include <asm/m32r.h>
 
-/*
- * This assumes you have a 1.8432 MHz clock for your UART.
- *
- * It'd be nice if someone built a serial card with a 24.576 MHz
- * clock, since the 16550A is capable of handling a top speed of 1.5
- * megabits/second; but this requires the faster clock.
- */
-#define BASE_BAUD ( 1843200 / 16 )
-
-/* Standard COM flags */
-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
-
-/* Standard PORT definitions */
-#if defined(CONFIG_PLAT_USRV)
-
-#define STD_SERIAL_PORT_DEFNS						\
-       /* UART  CLK     PORT   IRQ            FLAGS */			\
-	{ 0, BASE_BAUD, 0x3F8, PLD_IRQ_UART0, STD_COM_FLAGS }, /* ttyS0 */ \
-	{ 0, BASE_BAUD, 0x2F8, PLD_IRQ_UART1, STD_COM_FLAGS }, /* ttyS1 */
-
-#else /* !CONFIG_PLAT_USRV */
-
-#if defined(CONFIG_SERIAL_M32R_PLDSIO)
-#define STD_SERIAL_PORT_DEFNS						\
-	{ 0, BASE_BAUD, ((unsigned long)PLD_ESIO0CR), PLD_IRQ_SIO0_RCV,	\
-	  STD_COM_FLAGS }, /* ttyS0 */
-#else
-#define STD_SERIAL_PORT_DEFNS						\
-	{ 0, BASE_BAUD, M32R_SIO_OFFSET, M32R_IRQ_SIO0_R,		\
-	  STD_COM_FLAGS }, /* ttyS0 */
-#endif
-
-#endif /* !CONFIG_PLAT_USRV */
-
-#define SERIAL_PORT_DFNS	STD_SERIAL_PORT_DEFNS
+#define BASE_BAUD	115200
 
 #endif  /* _ASM_M32R_SERIAL_H */
drivers/serial/m32r_sio.c +29 -102

199 lines not on this page · raw message

--
Hirokazu Takata <[email protected]> Linux/M32R Project: http://www.linux-m32r.org/

author Applied
#20 lore raw

Re: [PATCH 2.6.12-rc1-mm3] m32r: m32r_sio driver update (was Re: [PATCH] Re: Bitrotting serial drivers)

Quoted 10 lines · Hirokazu Takata

Here is an additional patch to update m32r_sio driver. This patch is against 2.6.12-rc1-mm3.

m32r_sio driver updates:
- Move m32r_sio specific description from asm-m32r/serial.h to driver/serial/m32r_sio.c.
- Remove __register_m32r_sio, register_m32r_sio and unregister_m32r_sio from driver/serial/m32r_sio.c.

Thank you.

Applied, thanks.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core