linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Serial updates
@ 2003-09-09 18:56 Russell King
  0 siblings, 0 replies; 13+ messages in thread
From: Russell King @ 2003-09-09 18:56 UTC (permalink / raw)
  To: Linux Kernel List

Here's a set of serial updates I'm planning to send to Linus shortly.
You can get a patch from the following URL:

	http://patches.arm.linux.org.uk/serial-20030909.diff

 drivers/serial/8250_cs.c     |  712 ------------
 drivers/serial/core.c        | 2432 -------------------------------------------
 drivers/serial/8250.c        |   24 
 drivers/serial/8250.h        |    4 
 drivers/serial/8250_pci.c    |   22 
 drivers/serial/Kconfig       |   32 
 drivers/serial/Makefile      |    4 
 drivers/serial/clps711x.c    |   12 
 drivers/serial/sa1100.c      |    8 
 drivers/serial/serial_core.c | 2420 ++++++++++++++++++++++++++++++++++++++++++
 drivers/serial/serial_cs.c   |  712 ++++++++++++
 include/linux/serial_core.h  |   10 
 12 files changed, 3198 insertions(+), 3194 deletions(-)

<rmk@flint.arm.linux.org.uk> (03/09/09 1.1243)
	[SERIAL] Introduce per-port capabilities.
	
	This allows us to maintain quirks or capabilities on a per-port basis,
	so we can handle buggy clones more effectively.

<rmk@flint.arm.linux.org.uk> (03/09/09 1.1242)
	[SERIAL] Fix another missing irqreturn_t (clps711x.c)

<rmk@flint.arm.linux.org.uk> (03/09/09 1.1241)
	[SERIAL] Convert serial config deps to select statements
	
	The dependencies for CONFIG_SERIAL_CORE / CONFIG_SERIAL_CORE_CONSOLE
	were becoming very messy.  This cset converts the dependencies to
	use "select" statements instead.

<rmk@flint.arm.linux.org.uk> (03/09/09 1.1240)
	[SERIAL] Drop "level" argument from serial PM calls.
	
	Since the driver model has transitioned away from using multi-level
	device suspend/resume, we also drop the multi-level support from
	the serial layer.
	
	Update the 8250 and sa1100 drivers for this change.

<rmk@flint.arm.linux.org.uk> (03/08/27 1.1153.59.2)
	[SERIAL] Rename core.o and 8250_cs.o
	
	core.ko is a bad name for a module - make it serial_core.ko
	8250_cs.ko continues to cause people compatibility problems with
	older kernels, so rename that back to serial_cs.ko

<rmk@flint.arm.linux.org.uk> (03/08/24 1.1123.33.1)
	[SERIAL] Add new port numbers.
	
	This adds the new port numbers which are in use in MAC and PARISC
	trees (so other people know they're taken.)


-- 
Russell King (rmk@arm.linux.org.uk)	http://www.arm.linux.org.uk/personal/
Linux kernel maintainer of:
  2.6 ARM Linux   - http://www.arm.linux.org.uk/
  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
  2.6 Serial core

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

* Re: [PATCH] Serial updates
  2004-11-02 23:17         ` Russell King
@ 2004-11-04 21:22           ` Tony Lindgren
  0 siblings, 0 replies; 13+ messages in thread
From: Tony Lindgren @ 2004-11-04 21:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: rmk+lkml

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]

* Russell King <rmk+lkml@arm.linux.org.uk> [041102 15:27]:
> 
> Ok, I'll send a pull request imminently.  For those who don't want to
> wait, latest patch against Linus' tree is at:
> 
>   http://www.arm.linux.org.uk/~rmk/misc/linus-serial.diff

I tried the current BK tree on omap, and the serial ports work with
the following patch.

However, on omap 1510, the change of interrupt return value in
serial8250_interrupt from IRQ_HANDLED to IRQ_RETVAL(handled) causes
a problem on the first RX interrupt. It looks like the IIR register is
not ready for reading right away, and at first shows that no interrupt
happened (UART_IIR_NO_INT stays high).

This is probably a hardware issue, but might trigger something
similar on other hardware as well.

Regards,

Tony

[-- Attachment #2: patch-2.6.10-rc1-current-omap-serial --]
[-- Type: text/plain, Size: 1914 bytes --]

--- linus/drivers/serial/8250.c	2004-11-03 09:50:58.000000000 -0800
+++ linux-omap-dev/drivers/serial/8250.c	2004-11-04 13:14:22.000000000 -0800
@@ -1692,6 +1693,17 @@
 		serial_outp(up, UART_EFR, efr);
 	}
 
+#ifdef CONFIG_ARCH_OMAP1510
+	/* Workaround to enable 115200 baud on OMAP1510 internal ports */
+	if (cpu_is_omap1510() && is_omap_port(up->port.membase)) {
+		if (baud == 115200) {
+			quot = 1;
+			serial_out(up, UART_OMAP_OSC_12M_SEL, 1);
+		} else
+			serial_out(up, UART_OMAP_OSC_12M_SEL, 0);
+        }
+#endif
+
 	if (up->capabilities & UART_NATSEMI) {
 		/* Switch to bank 2 not bank 1, to avoid resetting EXCR2 */
 		serial_outp(up, UART_LCR, 0xe0);
@@ -1742,6 +1754,11 @@
 	unsigned int size = 8 << up->port.regshift;
 	int ret = 0;
 
+#ifdef CONFIG_ARCH_OMAP
+	if (is_omap_port(up->port.membase))
+		size = 0x16 << up->port.regshift;
+#endif
+
 	switch (up->port.iotype) {
 	case UPIO_MEM:
 		if (!up->port.mapbase)
--- linus/include/linux/serial_reg.h	2004-10-25 10:33:36.000000000 -0700
+++ linux-omap-dev/include/linux/serial_reg.h	2004-11-01 14:52:36.000000000 -0800
@@ -307,5 +307,19 @@
 #define SERIAL_RSA_BAUD_BASE (921600)
 #define SERIAL_RSA_BAUD_BASE_LO (SERIAL_RSA_BAUD_BASE / 8)
 
+/*
+ * Extra serial register definitions for the internal UARTs 
+ * in TI OMAP processors.
+ */
+#define UART_OMAP_MDR1		0x08	/* Mode definition register */
+#define UART_OMAP_MDR2		0x09	/* Mode definition register 2 */
+#define UART_OMAP_SCR		0x10	/* Supplementary control register */
+#define UART_OMAP_SSR		0x11	/* Supplementary status register */
+#define UART_OMAP_EBLR		0x12	/* BOF length register */
+#define UART_OMAP_OSC_12M_SEL	0x13	/* OMAP1510 12MHz osc select */
+#define UART_OMAP_MVER		0x14	/* Module version register */
+#define UART_OMAP_SYSC		0x15	/* System configuration register */
+#define UART_OMAP_SYSS		0x16	/* System status register */
+
 #endif /* _LINUX_SERIAL_REG_H */
 

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

* Re: [PATCH] Serial updates
  2004-11-02 23:01       ` Andrew Morton
@ 2004-11-02 23:17         ` Russell King
  2004-11-04 21:22           ` Tony Lindgren
  0 siblings, 1 reply; 13+ messages in thread
From: Russell King @ 2004-11-02 23:17 UTC (permalink / raw)
  To: Andrew Morton; +Cc: benh, linux-kernel

On Tue, Nov 02, 2004 at 03:01:12PM -0800, Andrew Morton wrote:
> Russell King <rmk+lkml@arm.linux.org.uk> wrote:
> >
> > On Tue, Nov 02, 2004 at 03:20:26PM +1100, Benjamin Herrenschmidt wrote:
> > > And here's another one that also fixes a little bug in the
> > > default console selection code ...
> > 
> > Thanks for testing Ben, applied.
> > 
> > akpm - do you want this set of serial changes to appear in one -mm
> > release before hitting Linus?
> > 
> 
> Not really - there's plenty of time to shake out any problems.

Ok, I'll send a pull request imminently.  For those who don't want to
wait, latest patch against Linus' tree is at:

  http://www.arm.linux.org.uk/~rmk/misc/linus-serial.diff

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

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

* Re: [PATCH] Serial updates
  2004-11-02 22:43     ` Russell King
@ 2004-11-02 23:01       ` Andrew Morton
  2004-11-02 23:17         ` Russell King
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Morton @ 2004-11-02 23:01 UTC (permalink / raw)
  To: Russell King; +Cc: benh, linux-kernel

Russell King <rmk+lkml@arm.linux.org.uk> wrote:
>
> On Tue, Nov 02, 2004 at 03:20:26PM +1100, Benjamin Herrenschmidt wrote:
> > And here's another one that also fixes a little bug in the
> > default console selection code ...
> 
> Thanks for testing Ben, applied.
> 
> akpm - do you want this set of serial changes to appear in one -mm
> release before hitting Linus?
> 

Not really - there's plenty of time to shake out any problems.

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

* Re: [PATCH] Serial updates
  2004-11-02  4:20   ` Benjamin Herrenschmidt
@ 2004-11-02 22:43     ` Russell King
  2004-11-02 23:01       ` Andrew Morton
  0 siblings, 1 reply; 13+ messages in thread
From: Russell King @ 2004-11-02 22:43 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Andrew Morton; +Cc: Linux Kernel list

On Tue, Nov 02, 2004 at 03:20:26PM +1100, Benjamin Herrenschmidt wrote:
> And here's another one that also fixes a little bug in the
> default console selection code ...

Thanks for testing Ben, applied.

akpm - do you want this set of serial changes to appear in one -mm
release before hitting Linus?

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

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

* Re: [PATCH] Serial updates
  2004-10-31 17:51 Russell King
  2004-10-31 22:26 ` Andreas Jellinghaus
  2004-11-02  4:09 ` Benjamin Herrenschmidt
@ 2004-11-02 20:06 ` Alex Williamson
  2 siblings, 0 replies; 13+ messages in thread
From: Alex Williamson @ 2004-11-02 20:06 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel

On Sun, 2004-10-31 at 17:51 +0000, Russell King wrote:
> Ok, here's a major serial update.  Items covered in this update:
...
> People who should test this patch as a minimum:
> 
>  - ia64 people (ACPI port discovery)

   I tried it on an hp rx2600 ia64 system.  All the ports showed up,
ACPI and PCI:

Serial: 8250/16550 driver $Revision: 1.90 $ 6 ports, IRQ sharing enabled
ttyS0 at MMIO 0xf8030000 (irq = 49) is a 16550A
GSI 34 (edge, high) -> CPU 1 (0x0100) vector 65
ttyS1 at MMIO 0xff5e0000 (irq = 65) is a 16550A
GSI 35 (edge, high) -> CPU 0 (0x0000) vector 66
ttyS2 at MMIO 0xff5e2000 (irq = 66) is a 16550A
ACPI: PCI interrupt 0000:e0:01.0[A] -> GSI 82 (level, low) -> IRQ 49
ttyS3 at MMIO 0xf8031000 (irq = 49) is a 16550A
ACPI: PCI interrupt 0000:e0:01.1[A] -> GSI 82 (level, low) -> IRQ 49
ttyS0 at MMIO 0xf8030000 (irq = 49) is a 16550A
ttyS4 at MMIO 0xf8030010 (irq = 49) is a 16550A
ttyS5 at MMIO 0xf8030038 (irq = 49) is a 16550A

The setserial problem I reported w/ MMIO UARTs appears to be fixed.
Thanks,

	Alex

-- 
Alex Williamson                             HP Linux & Open Source Lab


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

* Re: [PATCH] Serial updates
  2004-11-02  4:09 ` Benjamin Herrenschmidt
@ 2004-11-02  4:20   ` Benjamin Herrenschmidt
  2004-11-02 22:43     ` Russell King
  0 siblings, 1 reply; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2004-11-02  4:20 UTC (permalink / raw)
  To: Russell King; +Cc: Linux Kernel list

And here's another one that also fixes a little bug in the
default console selection code ...

--- linux-work.orig/arch/ppc64/kernel/setup.c	2004-10-27 13:05:41.000000000 +1000
+++ linux-work/arch/ppc64/kernel/setup.c	2004-11-02 15:18:26.707500208 +1100
@@ -31,7 +31,7 @@
 #include <linux/cpu.h>
 #include <linux/unistd.h>
 #include <linux/serial.h>
-#include <linux/8250.h>
+#include <linux/serial_8250.h>
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/processor.h>
@@ -901,7 +901,7 @@
 	DBG("Found serial console at ttyS%d\n", offset);
 
 	if (spd) {
-		char opt[16];
+		static char __initdata opt[16];
 		sprintf(opt, "%d", *spd);
 		return add_preferred_console("ttyS", offset, opt);
 	} else
@@ -1123,8 +1123,8 @@
  */
 
 #define MAX_LEGACY_SERIAL_PORTS	8
-static struct old_serial_port	old_serial_ports[MAX_LEGACY_SERIAL_PORTS];
-static unsigned int		old_serial_count;
+static struct plat_serial8250_port serial_ports[MAX_LEGACY_SERIAL_PORTS+1];
+static unsigned int old_serial_count;
 
 void __init generic_find_legacy_serial_ports(unsigned int *default_speed)
 {
@@ -1202,13 +1202,13 @@
 			if (index >= old_serial_count)
 				old_serial_count = index + 1;
 			/* Check if there is a port who already claimed our slot */
-			if (old_serial_ports[index].port != 0) {
+			if (serial_ports[index].iobase != 0) {
 				/* if we still have some room, move it, else override */
 				if (old_serial_count < MAX_LEGACY_SERIAL_PORTS) {
 					DBG("Moved legacy port %d -> %d\n", index,
 					    old_serial_count);
-					old_serial_ports[old_serial_count++] =
-						old_serial_ports[index];
+					serial_ports[old_serial_count++] =
+						serial_ports[index];
 				} else {
 					DBG("Replacing legacy port %d\n", index);
 				}
@@ -1220,18 +1220,17 @@
 			old_serial_count = index + 1;
 
 		/* Now fill the entry */
-		memset(&old_serial_ports[index], 0, sizeof(struct old_serial_port));
-		old_serial_ports[index].uart = 0;
-		old_serial_ports[index].baud_base = clk ? (*clk / 16) : BASE_BAUD;
-		old_serial_ports[index].port = reg->address;
-		old_serial_ports[index].irq = interrupts ? interrupts[0] : 0;
-		old_serial_ports[index].flags = ASYNC_BOOT_AUTOCONF;
+		memset(&serial_ports[index], 0, sizeof(struct plat_serial8250_port));
+		serial_ports[index].uartclk = clk ? *clk : BASE_BAUD * 16;
+		serial_ports[index].iobase = reg->address;
+		serial_ports[index].irq = interrupts ? interrupts[0] : 0;
+		serial_ports[index].flags = ASYNC_BOOT_AUTOCONF;
 
 		DBG("Added legacy port, index: %d, port: %x, irq: %d, clk: %d\n",
 		    index,
-		    old_serial_ports[index].port,
-		    old_serial_ports[index].irq,
-		    old_serial_ports[index].baud_base * 16);
+		    serial_ports[index].iobase,
+		    serial_ports[index].irq,
+		    serial_ports[index].uartclk);
 
 		/* Get phys address of IO reg for port 1 */
 		if (index != 0)
@@ -1279,19 +1278,21 @@
 	DBG(" <- generic_find_legacy_serial_port()\n");
 }
 
-struct old_serial_port *get_legacy_serial_ports(unsigned int *count)
-{
-	*count = old_serial_count;
-	return old_serial_ports;
-}
-#else
-struct old_serial_port *get_legacy_serial_ports(unsigned int *count)
+static struct platform_device serial_device = {
+	.name	= "serial8250",
+	.id	= 0,
+	.dev	= {
+		.platform_data = serial_ports,
+	},
+};
+
+static int __init serial_dev_init(void)
 {
-	*count = 0;
-	return 0;
+	return platform_device_register(&serial_device);
 }
+arch_initcall(serial_dev_init);
+
 #endif /* CONFIG_PPC_ISERIES */
-EXPORT_SYMBOL(get_legacy_serial_ports);
 
 int check_legacy_ioport(unsigned long base_port)
 {
Index: linux-work/include/asm-ppc64/serial.h
===================================================================
--- linux-work.orig/include/asm-ppc64/serial.h	2004-10-26 08:30:21.000000000 +1000
+++ linux-work/include/asm-ppc64/serial.h	2004-11-02 15:17:27.620482800 +1100
@@ -4,8 +4,6 @@
 #ifndef _PPC64_SERIAL_H
 #define _PPC64_SERIAL_H
 
-#include <linux/config.h>
-
 /*
  * This assumes you have a 1.8432 MHz clock for your UART.
  *
@@ -22,9 +20,4 @@
 /* Default baud base if not found in device-tree */
 #define BASE_BAUD ( 1843200 / 16 )
 
-#define ARCH_HAS_GET_LEGACY_SERIAL_PORTS
-struct old_serial_port;
-extern struct old_serial_port *get_legacy_serial_ports(unsigned int *count);
-#define UART_NR	(8 + CONFIG_SERIAL_8250_NR_UARTS)
-
 #endif /* _PPC64_SERIAL_H */



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

* Re: [PATCH] Serial updates
  2004-10-31 17:51 Russell King
  2004-10-31 22:26 ` Andreas Jellinghaus
@ 2004-11-02  4:09 ` Benjamin Herrenschmidt
  2004-11-02  4:20   ` Benjamin Herrenschmidt
  2004-11-02 20:06 ` Alex Williamson
  2 siblings, 1 reply; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2004-11-02  4:09 UTC (permalink / raw)
  To: Russell King; +Cc: Linux Kernel list

On Sun, 2004-10-31 at 17:51 +0000, Russell King wrote:
> Ok, here's a major serial update.  Items covered in this update:

Applied on top of current Linus bk, I get errors

 - PCI_DEVICE_ID_DELL_RACIII undefined (not in my pci_ids.h)

 - ALPHA_KLUDGE_MCR' undeclared  (nobody includes serialP.h from 8250.h)


plus a few warnings

drivers/serial/8250.c: In function `serial8250_exit':
drivers/serial/8250.c:2446: warning: unused variable `i'
drivers/serial/8250.c: In function `register_serial':
drivers/serial/8250.c:2525: warning: long unsigned int format, different type arg (arg 2)

(Line numbers are after adding #include <linux/serialP.h>

ppc64 seem to be happy with slight changes of your ppc64 patch you sent me by email,
here's the corrected version.

I suppose we may want to increase CONFIG_SERIAL_8250_NR_UARTS in the pSeries and
maple defconfigs, but I'll look into doing that separately. The default of 4 is
enough to give ppl a working console at least.

Ben.

--- linux-work.orig/arch/ppc64/kernel/setup.c	2004-10-27 13:05:41.000000000 +1000
+++ linux-work/arch/ppc64/kernel/setup.c	2004-11-02 14:58:17.219370352 +1100
@@ -31,7 +31,7 @@
 #include <linux/cpu.h>
 #include <linux/unistd.h>
 #include <linux/serial.h>
-#include <linux/8250.h>
+#include <linux/serial_8250.h>
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/processor.h>
@@ -1123,8 +1123,8 @@
  */
 
 #define MAX_LEGACY_SERIAL_PORTS	8
-static struct old_serial_port	old_serial_ports[MAX_LEGACY_SERIAL_PORTS];
-static unsigned int		old_serial_count;
+static struct plat_serial8250_port serial_ports[MAX_LEGACY_SERIAL_PORTS+1];
+static unsigned int old_serial_count;
 
 void __init generic_find_legacy_serial_ports(unsigned int *default_speed)
 {
@@ -1202,13 +1202,13 @@
 			if (index >= old_serial_count)
 				old_serial_count = index + 1;
 			/* Check if there is a port who already claimed our slot */
-			if (old_serial_ports[index].port != 0) {
+			if (serial_ports[index].iobase != 0) {
 				/* if we still have some room, move it, else override */
 				if (old_serial_count < MAX_LEGACY_SERIAL_PORTS) {
 					DBG("Moved legacy port %d -> %d\n", index,
 					    old_serial_count);
-					old_serial_ports[old_serial_count++] =
-						old_serial_ports[index];
+					serial_ports[old_serial_count++] =
+						serial_ports[index];
 				} else {
 					DBG("Replacing legacy port %d\n", index);
 				}
@@ -1220,18 +1220,17 @@
 			old_serial_count = index + 1;
 
 		/* Now fill the entry */
-		memset(&old_serial_ports[index], 0, sizeof(struct old_serial_port));
-		old_serial_ports[index].uart = 0;
-		old_serial_ports[index].baud_base = clk ? (*clk / 16) : BASE_BAUD;
-		old_serial_ports[index].port = reg->address;
-		old_serial_ports[index].irq = interrupts ? interrupts[0] : 0;
-		old_serial_ports[index].flags = ASYNC_BOOT_AUTOCONF;
+		memset(&serial_ports[index], 0, sizeof(struct plat_serial8250_port));
+		serial_ports[index].uartclk = clk ? *clk : BASE_BAUD * 16;
+		serial_ports[index].iobase = reg->address;
+		serial_ports[index].irq = interrupts ? interrupts[0] : 0;
+		serial_ports[index].flags = ASYNC_BOOT_AUTOCONF;
 
 		DBG("Added legacy port, index: %d, port: %x, irq: %d, clk: %d\n",
 		    index,
-		    old_serial_ports[index].port,
-		    old_serial_ports[index].irq,
-		    old_serial_ports[index].baud_base * 16);
+		    serial_ports[index].iobase,
+		    serial_ports[index].irq,
+		    serial_ports[index].uartclk);
 
 		/* Get phys address of IO reg for port 1 */
 		if (index != 0)
@@ -1279,19 +1278,21 @@
 	DBG(" <- generic_find_legacy_serial_port()\n");
 }
 
-struct old_serial_port *get_legacy_serial_ports(unsigned int *count)
-{
-	*count = old_serial_count;
-	return old_serial_ports;
-}
-#else
-struct old_serial_port *get_legacy_serial_ports(unsigned int *count)
+static struct platform_device serial_device = {
+	.name	= "serial8250",
+	.id	= 0,
+	.dev	= {
+		.platform_data = serial_ports,
+	},
+};
+
+static int __init serial_dev_init(void)
 {
-	*count = 0;
-	return 0;
+	return platform_device_register(&serial_device);
 }
+arch_initcall(serial_dev_init);
+
 #endif /* CONFIG_PPC_ISERIES */
-EXPORT_SYMBOL(get_legacy_serial_ports);
 
 int check_legacy_ioport(unsigned long base_port)
 {
Index: linux-work/include/asm-ppc64/serial.h
===================================================================
--- linux-work.orig/include/asm-ppc64/serial.h	2004-10-26 08:30:21.000000000 +1000
+++ linux-work/include/asm-ppc64/serial.h	2004-11-02 14:51:17.486179496 +1100
@@ -4,8 +4,6 @@
 #ifndef _PPC64_SERIAL_H
 #define _PPC64_SERIAL_H
 
-#include <linux/config.h>
-
 /*
  * This assumes you have a 1.8432 MHz clock for your UART.
  *
@@ -22,9 +20,4 @@
 /* Default baud base if not found in device-tree */
 #define BASE_BAUD ( 1843200 / 16 )
 
-#define ARCH_HAS_GET_LEGACY_SERIAL_PORTS
-struct old_serial_port;
-extern struct old_serial_port *get_legacy_serial_ports(unsigned int *count);
-#define UART_NR	(8 + CONFIG_SERIAL_8250_NR_UARTS)
-
 #endif /* _PPC64_SERIAL_H */



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

* Re: [PATCH] Serial updates
  2004-10-31 17:51 Russell King
@ 2004-10-31 22:26 ` Andreas Jellinghaus
  2004-11-02  4:09 ` Benjamin Herrenschmidt
  2004-11-02 20:06 ` Alex Williamson
  2 siblings, 0 replies; 13+ messages in thread
From: Andreas Jellinghaus @ 2004-10-31 22:26 UTC (permalink / raw)
  To: linux-kernel

I have trouble with smart card readers and smart cards,
and somehow I think it might be kernel 2.6.*,
as people with the same hw and sw report no problems
with kernel 2.4.

Should I try this patch? anything in it that could help
me? or are there known problems?

In an strace I saw a poll/read loop read data and
got 8 bytes at a time. once it 16 bytes were lost.
I can't reproduce the errors, but they happen very
often (in every run of the regression test suite
I have).

I have no idea if my kernel config could have
anything to do with it, if it helps I will
post/link it.

Andreas


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

* [PATCH] Serial updates
@ 2004-10-31 17:51 Russell King
  2004-10-31 22:26 ` Andreas Jellinghaus
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Russell King @ 2004-10-31 17:51 UTC (permalink / raw)
  To: Linux Kernel List

Ok, here's a major serial update.  Items covered in this update:

- unuse register_serial/unregister_serial.
  Instead, please use serial8250_register_port() and
  serial8250_unregister_port() to talk to the 8250 driver.

  The old interfaces have several restrictions:
  1. do not allow the struct device associated with a port to be known
     to the tty layer.
  2. have various restrictions on the size of IO addresses (see the
     HIGH_BITS_OFFSET stuff - which incidentally 8250_pnp got wrong.)

- provide a mechanism for 8250 platform ports to be dynamically
  registered.  We do this via platform devices - either one or
  multiple platform devices.  You can have none, one, or as many
  as you desire.  8250.c couldn't care.

- any ports listed in include/asm-*/serial.h will still be
  intialised in preference to platform device based ports for the
  time being.  It is intended that everyone will move to using
  the platform device method.

- this means that CONFIG_SERIAL_8250_NR_UARTS slightly changes
  definition.  It is the number of _extra_ ports above those in
  include/asm-*/serial.h that 8250.h will support.  If you have
  removed all ports from include/asm-*/serial.h, then it is
  obviously the total number of ports that 8250.c will support,
  and you need to make sure that it's large enough for your
  platform.

- ppc64 broke in this merge.  That's expected because I backed out
  benh's changes to the serial drivers.  A "get you working again"
  patch is with benh as of last night pending his attention.

The patch is about 50K, so won't fit through lkml, and is available
here instead:

  http://www.arm.linux.org.uk/~rmk/misc/linus-serial.diff

People who should test this patch as a minimum:

 - ia64 people (ACPI port discovery)
 - parisc people (GSC port discovery)
 - pnp using people

Once this lot is in, I'll be following up with a set of patches which
removes the serial device tables in include/asm-arm/arch-*/serial.h.

Diffstat and changeset log follow:

 drivers/serial/8250.c        |  371 +++++++++++++++++++++++--------------------
 drivers/serial/8250.h        |   74 ++++++++
 drivers/serial/8250_acorn.c  |   60 +++---
 drivers/serial/8250_acpi.c   |   74 +++-----
 drivers/serial/8250_pci.c    |    6 
 drivers/serial/8250_pnp.c    |   34 +--
 drivers/serial/au1x00_uart.c |   17 -
 drivers/serial/serial_core.c |   83 +--------
 drivers/serial/serial_cs.c   |   28 +--
 include/linux/8250.h         |   75 --------
 include/linux/serial_8250.h  |   28 +++
 include/linux/serial_core.h  |   10 -
 12 files changed, 420 insertions(+), 440 deletions(-)

through these ChangeSets:

<rmk@flint.arm.linux.org.uk> (04/10/31 1.2354)
	[SERIAL] Fix deadlock on removal of 8250 module.
	
	We must unregister all serial ports before driver_unregister()
	can complete.  This means that we must unregister all ports in
	serial8250_remove, including our legacy ISA ports.  We flag this
	special cleanup operation by setting serial8250_isa_devs to NULL
	and not handling our own platform device any differently from
	any others.

<rmk@flint.arm.linux.org.uk> (04/10/31 1.2353)
	[SERIAL] Don't detect console availability using port->ops.
	
	Use !iobase && !membase rather than !ops for console port
	availability.

<rmk@flint.arm.linux.org.uk> (04/10/31 1.2352)
	[SERIAL] 8250_acpi: Convert to use serial8250_{un,}register_port.

<rmk@flint.arm.linux.org.uk> (04/10/31 1.2351)
	[SERIAL] Don't use UPF_AUTOPROBE, fix two build problems.
	
	The curse of the missing __devexit_p() returns, and asm-*/ obviously
	marks the end of the comment.

<rmk@flint.arm.linux.org.uk> (04/10/31 1.2350)
	[SERIAL] 8250_pnp: Convert to use serial8250_{un,}register_port.

<rmk@flint.arm.linux.org.uk> (04/10/31 1.2349)
	[SERIAL] serial_cs: Convert to use serial8250_{un,}register_port.

<rmk@flint.arm.linux.org.uk> (04/10/31 1.2348)
	[SERIAL] 8250: Warn when ports with zero base_baud are registered.

<rmk@flint.arm.linux.org.uk> (04/10/31 1.2347)
	[SERIAL] 8250_acorn: Convert to use serial8250_{un,}register_port.

<rmk@flint.arm.linux.org.uk> (04/10/30 1.2345)
	[SERIAL] Undo "get_legacy_serial_ports" patch for PPC.
	
	This patch conflicts with work to properly integrate the device model
	into the serial layer, and provide architectures with a *clean* way
	to tell 8250.c about their serial ports at run time.

<rmk@flint.arm.linux.org.uk> (04/10/30 1.2026.4.8)
	[SERIAL] 8250: prevent ports with zero clocks being registered.

<rmk@flint.arm.linux.org.uk> (04/10/30 1.2026.4.7)
	[SERIAL] 8250: add probe and remove device driver methods.
	
	This change allows platform devices named "serial8250" to provide
	lists of serial ports to the 8250 driver at runtime, in addition to
	the hard coded table in include/asm-*/serial.h.
	
	The next step is to deprecate the tables in serial.h.

<rmk@flint.arm.linux.org.uk> (04/10/30 1.2026.4.6)
	[SERIAL] 8250: Add platform device for ISA 8250-compatible devices.
	
	Add a platform device for ISA 8250-compatible serial devices listed
	in the table in include/asm-*/serial.h.  Arrange for unregistered
	serial devices to be owned by this device.
	
	This enables power management for ISA 8250 devices, and starts to
	opens the way for architectures to dynamically provide their own
	lists of 8250 devices via platform device(s).

<rmk@flint.arm.linux.org.uk> (04/10/30 1.2026.4.5)
	[SERIAL] Re-order 8250 serial driver initialisation/finalisation.
	
	Only register the 8250 serial driver with the device model after
	registering and setting up our internal uart ports.  Do the reverse
	on module finalisation.

<rmk@flint.arm.linux.org.uk> (04/10/30 1.2026.4.4)
	[SERIAL] 8250: move basic initialisation of 8250 ports.
	
	This moves the basic initialisation of 8250 ports from
	serial8250_register_ports() into serial8250_isa_init_ports()

<rmk@flint.arm.linux.org.uk> (04/10/30 1.2026.4.3)
	[SERIAL] 8250: Fix resource handling.
	
	serial8250_request_std_resource() is now responsible for claiming
	the standard resources, _and_ calling ioremap if necessary.
	serial8250_release_std_resource() performs the complementary function
	in its entirety.
	serial8250_*_rsa_resource() perform the similar operations for RSA
	ports, with the exception that RSA ports can only be mapped into IO
	space.

<rmk@flint.arm.linux.org.uk> (04/10/30 1.2026.4.2)
	[SERIAL] Clean up serial_core.c write functions.
	
	Since the tty layer now takes care of user space writes,
	__uart_user_write() and associated temporary buffer and temporary
	buffer semaphore have all become unnecessary.  There's also little
	point in having __uart_kern_write() separate from uart_write(), so
	combine the two together.
	
	Adrian Bunk kindly provided the patch to remove __uart_user_write().
	The rest of the work is rmk's.
	
	Signed-off-by: Adrian Bunk
	Signed-off-by: Russell King <rmk@arm.linux.org.uk>

<arjan@nl.rmk.(none)> (04/10/24 1.2026.4.1)
	[SERIAL] Remove dead code.
	
	serial8250_get_irq_map is no longer used anywhere in the kernel (it
	used to be used by the isapnp code but isn't anymore) so it's dead
	code, below is a patch to remove this.



-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

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

* [PATCH] Serial updates
@ 2004-08-30 23:21 Russell King
  0 siblings, 0 replies; 13+ messages in thread
From: Russell King @ 2004-08-30 23:21 UTC (permalink / raw)
  To: Linux Kernel List

BK changelog at the end.  Essentially, this sorts out a couple of things:

1. Try to make the serial driver more "capability"-based rather than
   "port type"-based.  This means that we codify some of the rules
   which otherwise appear in the table - for example, if we have a
   FIFO, we always flush it, but only ever enable it if we have a
   FIFO depth > 1.

2. Some serial ports signal transmit interrupts when their FIFOs are
   not completely empty.  Use separate parameter to indicate how
   many bytes we should transfer on each transmit IRQ.

Overall, this means that "struct serial_uart_config" in
include/linux/serial.h is no longer used by the standard kernel serial
driver.  It could be removed if it weren't used by "clone" drivers...
Note that some cloned drivers define the table, but only use one entry
_and_ one string from it.  Using a single string of course is far more
space efficient. 8)

diff -Nru a/drivers/serial/8250.c b/drivers/serial/8250.c
--- a/drivers/serial/8250.c	2004-08-29 23:26:37 +01:00
+++ b/drivers/serial/8250.c	2004-08-29 23:26:37 +01:00
@@ -130,6 +130,7 @@
 	struct timer_list	timer;		/* "no irq" timer */
 	struct list_head	list;		/* ports on this IRQ */
 	unsigned int		capabilities;	/* port capabilities */
+	unsigned int		tx_loadsz;	/* transmit fifo load size */
 	unsigned short		rev;
 	unsigned char		acr;
 	unsigned char		ier;
@@ -156,23 +157,23 @@
 /*
  * Here we define the default xmit fifo size used for each type of UART.
  */
-static const struct serial_uart_config uart_config[PORT_MAX_8250+1] = {
-	{ "unknown",	1,	0 },
-	{ "8250",	1,	0 },
-	{ "16450",	1,	0 },
-	{ "16550",	1,	0 },
-	{ "16550A",	16,	UART_CLEAR_FIFO | UART_USE_FIFO },
-	{ "Cirrus",	1, 	0 },
-	{ "ST16650",	1,	UART_CLEAR_FIFO | UART_STARTECH },
-	{ "ST16650V2",	32,	UART_CLEAR_FIFO | UART_USE_FIFO | UART_STARTECH },
-	{ "TI16750",	64,	UART_CLEAR_FIFO | UART_USE_FIFO },
-	{ "Startech",	1,	0 },
-	{ "16C950/954",	128,	UART_CLEAR_FIFO | UART_USE_FIFO },
-	{ "ST16654",	64,	UART_CLEAR_FIFO | UART_USE_FIFO | UART_STARTECH },
-	{ "XR16850",	128,	UART_CLEAR_FIFO | UART_USE_FIFO | UART_STARTECH },
-	{ "RSA",	2048,	UART_CLEAR_FIFO | UART_USE_FIFO },
-	{ "NS16550A",	16,	UART_CLEAR_FIFO | UART_USE_FIFO | UART_NATSEMI },
-	{ "XScale",	32,	UART_CLEAR_FIFO | UART_USE_FIFO  },
+static const struct serial8250_config uart_config[PORT_MAX_8250+1] = {
+	{ "unknown",	1,	1,	0 },
+	{ "8250",	1,	1,	0 },
+	{ "16450",	1,	1,	0 },
+	{ "16550",	1,	1,	0 },
+	{ "16550A",	16,	16,	UART_CAP_FIFO },
+	{ "Cirrus",	1, 	1,	0 },
+	{ "ST16650",	1,	1,	UART_CAP_FIFO | UART_CAP_SLEEP | UART_CAP_EFR },
+	{ "ST16650V2",	32,	16,	UART_CAP_FIFO | UART_CAP_SLEEP | UART_CAP_EFR },
+	{ "TI16750",	64,	64,	UART_CAP_FIFO | UART_CAP_SLEEP },
+	{ "Startech",	1,	1,	0 },
+	{ "16C950/954",	128,	128,	UART_CAP_FIFO },
+	{ "ST16654",	64,	32,	UART_CAP_FIFO | UART_CAP_SLEEP | UART_CAP_EFR },
+	{ "XR16850",	128,	128,	UART_CAP_FIFO | UART_CAP_SLEEP | UART_CAP_EFR },
+	{ "RSA",	2048,	2048,	UART_CAP_FIFO },
+	{ "NS16550A",	16,	16,	UART_CAP_FIFO | UART_NATSEMI },
+	{ "XScale",	32,	32,	UART_CAP_FIFO },
 };
 
 static _INLINE_ unsigned int serial_in(struct uart_8250_port *up, int offset)
@@ -243,6 +244,41 @@
 	return value;
 }
 
+/*
+ * FIFO support.
+ */
+static inline void serial8250_clear_fifos(struct uart_8250_port *p)
+{
+	if (p->capabilities & UART_CAP_FIFO) {
+		serial_outp(p, UART_FCR, UART_FCR_ENABLE_FIFO);
+		serial_outp(p, UART_FCR, UART_FCR_ENABLE_FIFO |
+			       UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);
+		serial_outp(p, UART_FCR, 0);
+	}
+}
+
+/*
+ * IER sleep support.  UARTs which have EFRs need the "extended
+ * capability" bit enabled.  Note that on XR16C850s, we need to
+ * reset LCR to write to IER.
+ */
+static inline void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
+{
+	if (p->capabilities & UART_CAP_SLEEP) {
+		if (p->capabilities & UART_CAP_EFR) {
+			serial_outp(p, UART_LCR, 0xBF);
+			serial_outp(p, UART_EFR, UART_EFR_ECB);
+			serial_outp(p, UART_LCR, 0);
+		}
+		serial_outp(p, UART_IER, sleep ? UART_IERX_SLEEP : 0);
+		if (p->capabilities & UART_CAP_EFR) {
+			serial_outp(p, UART_LCR, 0xBF);
+			serial_outp(p, UART_EFR, 0);
+			serial_outp(p, UART_LCR, 0);
+		}
+	}
+}
+
 #ifdef CONFIG_SERIAL_8250_RSA
 /*
  * Attempts to turn on the RSA FIFO.  Returns zero on failure.
@@ -697,8 +733,9 @@
 #endif
 	serial_outp(up, UART_LCR, save_lcr);
 
-	up->port.fifosize = uart_config[up->port.type].dfl_xmit_fifo_size;
+	up->port.fifosize = uart_config[up->port.type].fifo_size;
 	up->capabilities = uart_config[up->port.type].flags;
+	up->tx_loadsz = uart_config[up->port.type].tx_loadsz;
 
 	if (up->port.type == PORT_UNKNOWN)
 		goto out;
@@ -711,10 +748,7 @@
 		serial_outp(up, UART_RSA_FRR, 0);
 #endif
 	serial_outp(up, UART_MCR, save_mcr);
-	serial_outp(up, UART_FCR, (UART_FCR_ENABLE_FIFO |
-				     UART_FCR_CLEAR_RCVR |
-				     UART_FCR_CLEAR_XMIT));
-	serial_outp(up, UART_FCR, 0);
+	serial8250_clear_fifos(up);
 	(void)serial_in(up, UART_RX);
 	serial_outp(up, UART_IER, 0);
 
@@ -923,7 +957,7 @@
 		return;
 	}
 
-	count = up->port.fifosize;
+	count = up->tx_loadsz;
 	do {
 		serial_out(up, UART_TX, xmit->buf[xmit->tail]);
 		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
@@ -1227,12 +1261,7 @@
 	 * Clear the FIFO buffers and disable them.
 	 * (they will be reeanbled in set_termios())
 	 */
-	if (up->capabilities & UART_CLEAR_FIFO) {
-		serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO);
-		serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO |
-				UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);
-		serial_outp(up, UART_FCR, 0);
-	}
+	serial8250_clear_fifos(up);
 
 	/*
 	 * Clear the interrupt registers.
@@ -1254,6 +1283,23 @@
 	}
 
 	/*
+	 * For a XR16C850, we need to set the trigger levels
+	 */
+	if (up->port.type == PORT_16850) {
+		unsigned char fctr;
+
+		serial_outp(up, UART_LCR, 0xbf);
+
+		fctr = serial_inp(up, UART_FCTR) & ~(UART_FCTR_RX|UART_FCTR_TX);
+		serial_outp(up, UART_FCTR, fctr | UART_FCTR_TRGD | UART_FCTR_RX);
+		serial_outp(up, UART_TRG, UART_TRG_96);
+		serial_outp(up, UART_FCTR, fctr | UART_FCTR_TRGD | UART_FCTR_TX);
+		serial_outp(up, UART_TRG, UART_TRG_96);
+
+		serial_outp(up, UART_LCR, 0);
+	}
+
+	/*
 	 * If the "interrupt" for this port doesn't correspond with any
 	 * hardware interrupt, we use a timer-based system.  The original
 	 * driver used to do this with IRQ0.
@@ -1345,10 +1391,7 @@
 	 * Disable break condition and FIFOs
 	 */
 	serial_out(up, UART_LCR, serial_inp(up, UART_LCR) & ~UART_LCR_SBC);
-	serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO |
-				  UART_FCR_CLEAR_RCVR |
-				  UART_FCR_CLEAR_XMIT);
-	serial_outp(up, UART_FCR, 0);
+	serial8250_clear_fifos(up);
 
 #ifdef CONFIG_SERIAL_8250_RSA
 	/*
@@ -1440,7 +1483,7 @@
 	    up->rev == 0x5201)
 		quot ++;
 
-	if (up->capabilities & UART_USE_FIFO) {
+	if (up->capabilities & UART_CAP_FIFO && up->port.fifosize > 1) {
 		if (baud < 2400)
 			fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_1;
 #ifdef CONFIG_SERIAL_8250_RSA
@@ -1514,7 +1557,7 @@
 
 	serial_out(up, UART_IER, up->ier);
 
-	if (up->capabilities & UART_STARTECH) {
+	if (up->capabilities & UART_CAP_EFR) {
 		serial_outp(up, UART_LCR, 0xBF);
 		serial_outp(up, UART_EFR,
 			    termios->c_cflag & CRTSCTS ? UART_EFR_CTS :0);
@@ -1554,71 +1597,12 @@
 serial8250_pm(struct uart_port *port, unsigned int state,
 	      unsigned int oldstate)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
-	if (state) {
-		/* sleep */
-		if (up->capabilities & UART_STARTECH) {
-			/* Arrange to enter sleep mode */
-			serial_outp(up, UART_LCR, 0xBF);
-			serial_outp(up, UART_EFR, UART_EFR_ECB);
-			serial_outp(up, UART_LCR, 0);
-			serial_outp(up, UART_IER, UART_IERX_SLEEP);
-			serial_outp(up, UART_LCR, 0xBF);
-			serial_outp(up, UART_EFR, 0);
-			serial_outp(up, UART_LCR, 0);
-		}
-		if (up->port.type == PORT_16750) {
-			/* Arrange to enter sleep mode */
-			serial_outp(up, UART_IER, UART_IERX_SLEEP);
-		}
-
-		if (up->pm)
-			up->pm(port, state, oldstate);
-	} else {
-		/* wake */
-		if (up->capabilities & UART_STARTECH) {
-			/* Wake up UART */
-			serial_outp(up, UART_LCR, 0xBF);
-			serial_outp(up, UART_EFR, UART_EFR_ECB);
-			/*
-			 * Turn off LCR == 0xBF so we actually set the IER
-			 * register on the XR16C850
-			 */
-			serial_outp(up, UART_LCR, 0);
-			serial_outp(up, UART_IER, 0);
-			/*
-			 * Now reset LCR so we can turn off the ECB bit
-			 */
-			serial_outp(up, UART_LCR, 0xBF);
-			serial_outp(up, UART_EFR, 0);
-			/*
-			 * For a XR16C850, we need to set the trigger levels
-			 */
-			if (up->port.type == PORT_16850) {
-				unsigned char fctr;
+	struct uart_8250_port *p = (struct uart_8250_port *)port;
 
-				fctr = serial_inp(up, UART_FCTR) &
-					 ~(UART_FCTR_RX | UART_FCTR_TX);
-				serial_outp(up, UART_FCTR, fctr |
-						UART_FCTR_TRGD |
-						UART_FCTR_RX);
-				serial_outp(up, UART_TRG, UART_TRG_96);
-				serial_outp(up, UART_FCTR, fctr |
-						UART_FCTR_TRGD |
-						UART_FCTR_TX);
-				serial_outp(up, UART_TRG, UART_TRG_96);
-			}
-			serial_outp(up, UART_LCR, 0);
-		}
+	serial8250_set_sleep(p, state != 0);
 
-		if (up->port.type == PORT_16750) {
-			/* Wake up UART */
-			serial_outp(up, UART_IER, 0);
-		}
-
-		if (up->pm)
-			up->pm(port, state, oldstate);
-	}
+	if (p->pm)
+		p->pm(port, state, oldstate);
 }
 
 /*
diff -Nru a/drivers/serial/8250.h b/drivers/serial/8250.h
--- a/drivers/serial/8250.h	2004-08-29 23:26:37 +01:00
+++ b/drivers/serial/8250.h	2004-08-29 23:26:37 +01:00
@@ -33,6 +33,20 @@
 	unsigned short iomem_reg_shift;
 };
 
+/*
+ * This replaces serial_uart_config in include/linux/serial.h
+ */
+struct serial8250_config {
+	const char	*name;
+	unsigned int	fifo_size;
+	unsigned int	tx_loadsz;
+	unsigned int	flags;
+};
+
+#define UART_CAP_FIFO	(1 << 8)	/* UART has FIFO */
+#define UART_CAP_EFR	(1 << 9)	/* UART has EFR */
+#define UART_CAP_SLEEP	(1 << 10)	/* UART has IER sleep */
+
 #undef SERIAL_DEBUG_PCI
 
 #if defined(__i386__) && (defined(CONFIG_M386) || defined(CONFIG_M486))

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/08/29 13:07:31+01:00 rmk@flint.arm.linux.org.uk 
#   [SERIAL] 8250: Rename UART_STARTECH to UART_CAP_EFR
#   
#   UART_STARTECH is really telling us that the UART has an EFR register,
#   so call this flag UART_CAP_EFR.
# 
# drivers/serial/8250.h
#   2004/08/29 13:05:20+01:00 rmk@flint.arm.linux.org.uk +1 -0
#   Rename UART_STARTECH to UART_CAP_EFR, since that's what it's really
#   telling us - that the UART has an EFR register.
# 
# drivers/serial/8250.c
#   2004/08/29 13:05:19+01:00 rmk@flint.arm.linux.org.uk +10 -8
#   Rename UART_STARTECH to UART_CAP_EFR, since that's what it's really
#   telling us - that the UART has an EFR register.
# 
# ChangeSet
#   2004/08/29 12:59:58+01:00 rmk@flint.arm.linux.org.uk 
#   [SERIAL] 8250: add UART_CAP_SLEEP capability.
# 
# drivers/serial/8250.h
#   2004/08/29 12:57:48+01:00 rmk@flint.arm.linux.org.uk +1 -0
#   Add UART_CAP_SLEEP definition.
# 
# drivers/serial/8250.c
#   2004/08/29 12:57:48+01:00 rmk@flint.arm.linux.org.uk +17 -17
#   Add UART_CAP_SLEEP - this indicates which UART types have IER sleep
#   capability.  We generalise the code in serial8250_set_sleep() since
#   Startech is a superset of the TI16750 sleep code.
# 
# ChangeSet
#   2004/08/29 12:52:25+01:00 rmk@flint.arm.linux.org.uk 
#   [SERIAL] 8250: serial8250_set_sleep
#   
#   Add container function for UART sleep code.  Currently only Startech
#   and TI16750 uses this.
# 
# drivers/serial/8250.c
#   2004/08/29 12:49:56+01:00 rmk@flint.arm.linux.org.uk +24 -46
#   Add serial8250_set_sleep - this contains the code to place UARTs into
#   sleep mode.
# 
# ChangeSet
#   2004/08/29 11:52:58+01:00 rmk@flint.arm.linux.org.uk 
#   [SERIAL] 8250: combine UART_CLEAR_FIFO/UART_USE_FIFO into one flag.
#   
#   Combine UART_CLEAR_FIFO and UART_USE_FIFO into one capability -
#   UART_CAP_FIFO.  There is only one UART with an unused FIFO - ST16650.
#   Since we check the fifo size before enabling, we maintain the
#   existing behaviour.
# 
# drivers/serial/8250.h
#   2004/08/29 11:50:41+01:00 rmk@flint.arm.linux.org.uk +2 -0
#   Add UART_CAP_FIFO flag.
# 
# drivers/serial/8250.c
#   2004/08/29 11:50:41+01:00 rmk@flint.arm.linux.org.uk +12 -12
#   Combine UART_CLEAR_FIFO and UART_USE_FIFO into one capability -
#   UART_CAP_FIFO.  There is only one UART with an unused FIFO, ST16650.
#   Since we check the fifo size before enabling, we maintain the
#   existing behaviour.
# 
# ChangeSet
#   2004/08/29 00:48:16+01:00 rmk@flint.arm.linux.org.uk 
#   [SERIAL] 8250: tell transmit path the data transfer size.
#   
#   Some UARTs give us a transmit interrupt when the TX FIFO is less
#   than half empty.  This means we should not transfer a FIFO-full
#   of data to the device.  Introduce "tx_loadsz" to indicate the
#   size of this transfer.
# 
# drivers/serial/8250.h
#   2004/08/29 00:46:09+01:00 rmk@flint.arm.linux.org.uk +1 -0
#   Add tx_loadsz element to serial8250_config
# 
# drivers/serial/8250.c
#   2004/08/29 00:46:08+01:00 rmk@flint.arm.linux.org.uk +19 -17
#   Add "tx_loadsz".  This gives the size of the data transfer when we
#   receive a transmit interrupt.  Add transmit load size data to the
#   uart_config table.
# 
# ChangeSet
#   2004/08/29 00:29:43+01:00 rmk@flint.arm.linux.org.uk 
#   [SERIAL] 8250: Add serial8250_config structure definition.
#   
#   This structure replaces serial_uart_config to allow the 8250 driver
#   to extend it without breaking all the other users.
# 
# drivers/serial/8250.h
#   2004/08/29 00:27:37+01:00 rmk@flint.arm.linux.org.uk +9 -0
#   Add serial8250_config structure definition.
# 
# drivers/serial/8250.c
#   2004/08/29 00:27:36+01:00 rmk@flint.arm.linux.org.uk +2 -2
#   Rename serial_uart_config structure to serial8250_config, and
#   dfl_xmit_fifo_size to fifo_size.
# 
# ChangeSet
#   2004/08/29 00:06:41+01:00 rmk@flint.arm.linux.org.uk 
#   [SERIAL] 8250: We can only use the FIFO if fifosize > 1.
# 
# drivers/serial/8250.c
#   2004/08/29 00:03:54+01:00 rmk@flint.arm.linux.org.uk +1 -1
#   We can only use the FIFO if fifosize > 1.
# 
# ChangeSet
#   2004/08/28 23:48:25+01:00 rmk@flint.arm.linux.org.uk 
#   [SERIAL] Move XR16C850 Tx/Rx trigger level setup to startup code
# 
# drivers/serial/8250.c
#   2004/08/28 23:46:09+01:00 rmk@flint.arm.linux.org.uk +17 -17
#   Move TX/RX trigger level settings for XR16C850 into startup code
#   rather than power management code.
# 
# ChangeSet
#   2004/08/28 23:34:57+01:00 rmk@flint.arm.linux.org.uk 
#   [SERIAL] Factor out "clear fifo" functionality.
#   
#   Move "clear fifo" into separate function dependent on
#   UART_CLEAR_FIFO capability.  We take note of the comment about
#   Lucent Venus and always use the two-stage enable-then-clear as
#   we do on startup.
# 
# drivers/serial/8250.c
#   2004/08/28 23:32:32+01:00 rmk@flint.arm.linux.org.uk +16 -14
#   Move "clear fifo" into separate function dependent on
#   UART_CLEAR_FIFO capability.  We take note of the comment about
#   Lucent Venus and always use the two-stage enable-then-clear as
#   we do on startup.
# 

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

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

* [PATCH] Serial updates
@ 2004-01-16 22:52 Russell King
  0 siblings, 0 replies; 13+ messages in thread
From: Russell King @ 2004-01-16 22:52 UTC (permalink / raw)
  To: Linux Kernel List

Hi all,

The following patch updates the 2.6.1 serial code for changes by Bjorn
Helgaas.  I've included Bjorn's comments below:

[SERIAL] make ACPI serial module unload work
  
  Patch from Bjorn Helgaas
  
  This patch makes ACPI serial ports work right when the serial driver
  is built as a module.  Previously, loading worked fine, but we
  didn't clean up on module removal.

[SERIAL] make HCDP dependent on serial console
  
  Patch from Bjorn Helgaas
  
  I propose the following HCDP Kconfig patch.  It makes HCDP
  selectable only when serial console has been selected.  One
  desirable side effect is that both are then available only
  when statically compiled in (i.e., not built as a module).

  The HCDP support doesn't actually depend on IA64, but I left
  that in for now because nobody else implements support for it
  and I don't want people confused by a selectable option that
  doesn't do anything.  Maybe a "depends on EFI" or something
  will be useful eventually.

[SERIAL] request resources for ACPI & HCDP ports
  
  Patch from: Bjorn Helgaas
  
  This patch against 2.6.1-rc3 sets UPF_RESOURCES so the
  appropriate ranges will show up in /proc/ioports and /proc/iomem.

diff -Nru a/drivers/serial/8250_acpi.c b/drivers/serial/8250_acpi.c
--- a/drivers/serial/8250_acpi.c	Fri Jan 16 22:06:23 2004
+++ b/drivers/serial/8250_acpi.c	Fri Jan 16 22:06:23 2004
@@ -1,6 +1,7 @@
 /*
- * serial/acpi.c
  * Copyright (c) 2002-2003 Matthew Wilcox for Hewlett-Packard
+ * Copyright (C) 2004 Hewlett-Packard Co
+ *	Bjorn Helgaas <bjorn.helgaas@hp.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -11,13 +12,21 @@
 #include <linux/acpi.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/tty.h>
 #include <linux/serial.h>
+#include <linux/tty.h>
+#include <linux/serial_core.h>
 
 #include <acpi/acpi_bus.h>
 
 #include <asm/io.h>
 #include <asm/serial.h>
 
+struct serial_private {
+	int	line;
+	void	*iomem_base;
+};
+
 static acpi_status acpi_serial_mmio(struct serial_struct *req,
 				    struct acpi_resource_address64 *addr)
 {
@@ -94,38 +103,72 @@
 
 static int acpi_serial_add(struct acpi_device *device)
 {
+	struct serial_private *priv;
 	acpi_status status;
 	struct serial_struct serial_req;
-	int line;
+	int result;
 
 	memset(&serial_req, 0, sizeof(serial_req));
 
+	priv = kmalloc(sizeof(struct serial_private), GFP_KERNEL);
+	if (!priv) {
+		result = -ENOMEM;
+		goto fail;
+	}
+	memset(priv, 0, sizeof(*priv));
+
 	status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
 				     acpi_serial_resource, &serial_req);
-	if (ACPI_FAILURE(status))
-		return -ENODEV;
+	if (ACPI_FAILURE(status)) {
+		result = -ENODEV;
+		goto fail;
+	}
 
-	if (!serial_req.iomem_base && !serial_req.port) {
+	if (serial_req.iomem_base)
+		priv->iomem_base = serial_req.iomem_base;
+	else if (!serial_req.port) {
 		printk(KERN_ERR "%s: no iomem or port address in %s _CRS\n",
 			__FUNCTION__, device->pnp.bus_id);
-		return -ENODEV;
+		result = -ENODEV;
+		goto fail;
 	}
 
 	serial_req.baud_base = BASE_BAUD;
-	serial_req.flags = ASYNC_SKIP_TEST|ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ;
+	serial_req.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF |
+			   UPF_AUTO_IRQ  | UPF_RESOURCES;
 
-	line = register_serial(&serial_req);
-	if (line < 0) {
-		printk(KERN_WARNING "Couldn't register serial port %s: %d",
-			device->pnp.bus_id, line);
-		return -ENODEV;
+	priv->line = register_serial(&serial_req);
+	if (priv->line < 0) {
+		printk(KERN_WARNING "Couldn't register serial port %s: %d\n",
+			device->pnp.bus_id, priv->line);
+		result = -ENODEV;
+		goto fail;
 	}
 
+	acpi_driver_data(device) = priv;
 	return 0;
+
+fail:
+	if (serial_req.iomem_base)
+		iounmap(serial_req.iomem_base);
+	kfree(priv);
+
+	return result;
 }
 
 static int acpi_serial_remove(struct acpi_device *device, int type)
 {
+	struct serial_private *priv;
+
+	if (!device || !acpi_driver_data(device))
+		return -EINVAL;
+
+	priv = acpi_driver_data(device);
+	unregister_serial(priv->line);
+	if (priv->iomem_base)
+		iounmap(priv->iomem_base);
+	kfree(priv);
+
 	return 0;
 }
 
diff -Nru a/drivers/serial/8250_hcdp.c b/drivers/serial/8250_hcdp.c
--- a/drivers/serial/8250_hcdp.c	Fri Jan 16 22:06:23 2004
+++ b/drivers/serial/8250_hcdp.c	Fri Jan 16 22:06:23 2004
@@ -185,7 +185,7 @@
 #else
 		port.irq = gsi;
 #endif
-		port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF;
+		port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_RESOURCES;
 		if (gsi)
 			port.flags |= ASYNC_AUTO_IRQ;
 
diff -Nru a/drivers/serial/Kconfig b/drivers/serial/Kconfig
--- a/drivers/serial/Kconfig	Fri Jan 16 22:06:23 2004
+++ b/drivers/serial/Kconfig	Fri Jan 16 22:06:23 2004
@@ -62,6 +62,15 @@
 
 	  If unsure, say N.
 
+config SERIAL_8250_HCDP
+	bool "Console device discovery via EFI HCDP table"
+	depends on IA64
+	depends on SERIAL_8250_CONSOLE=y
+	---help---
+	  If you wish to make the serial console port described by the EFI
+	  HCDP table available for use as serial console, say Y here.  See
+	  <http://www.dig64.org/specifications/DIG64_HCDPv10a_01.pdf>.
+
 config SERIAL_8250_CS
 	tristate "8250/16550 PCMCIA device support"
 	depends on PCMCIA && SERIAL_8250
@@ -83,15 +92,6 @@
 	---help---
 	  If you wish to enable serial port discovery via the ACPI
 	  namespace, say Y here.  If unsure, say N.
-
-config SERIAL_8250_HCDP
-	bool "8250/16550 device discovery support via EFI HCDP table"
-	depends on IA64 && SERIAL_8250
-	---help---
-	  If you wish to make the serial console port described by the EFI
-	  HCDP table available for use as serial console or general
-	  purpose port, say Y here. See
-	  <http://www.dig64.org/specifications/DIG64_HCDPv10a_01.pdf>.
 
 config SERIAL_8250_NR_UARTS
 	int "Maximum number of non-legacy 8250/16550 serial ports"

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

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

* [PATCH] Serial updates
@ 2004-01-03 23:45 Russell King
  0 siblings, 0 replies; 13+ messages in thread
From: Russell King @ 2004-01-03 23:45 UTC (permalink / raw)
  To: Linux Kernel List

A couple of changes to the 8250 serial driver; these changes are
queued against 2.6.0 and will probably be sent upstream in about
12 hours time.

# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/01/02	rene.herman@nl.rmk.(none)	1.1569
# [SERIAL] add PnP ID to 8250_pnp.c
# 
# Patch from: Rene Herman
# 
# This patch adds the PnP ID for the E-Tech CyberBULLET PC56RVP.
# --------------------------------------------
# 04/01/02	rmk@flint.arm.linux.org.uk	1.1570
# [SERIAL] Remove old RSA resource handlign.
# 
# The resource handling left in autoconfig() is plainly wrong, since
# we've already claimed the necessary resources prior to calling
# autoconfig().  Therefore, we remove the superfluous code from
# autoconfig().
# --------------------------------------------
#
diff -Nru a/drivers/serial/8250.c b/drivers/serial/8250.c
--- a/drivers/serial/8250.c	Sat Jan  3 23:35:52 2004
+++ b/drivers/serial/8250.c	Sat Jan  3 23:35:52 2004
@@ -726,13 +726,6 @@
  out:	
 	spin_unlock_irqrestore(&up->port.lock, flags);
 //	restore_flags(flags);
-#ifdef CONFIG_SERIAL_8250_RSA
-	if (up->port.iobase && up->port.type == PORT_RSA) {
-		release_region(up->port.iobase, 8);
-		request_region(up->port.iobase + UART_RSA_BASE, 16,
-			       "serial_rsa");
-	}
-#endif
 	DEBUG_AUTOCONF("type=%s\n", uart_config[up->port.type].name);
 }
 
diff -Nru a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
--- a/drivers/serial/8250_pnp.c	Sat Jan  3 23:35:52 2004
+++ b/drivers/serial/8250_pnp.c	Sat Jan  3 23:35:52 2004
@@ -74,6 +74,9 @@
 	{	"DMB1032",		0	},
 	/* Creative Modem Blaster V.90 DI5660 */
 	{	"DMB2001",		0	},
+	/* E-Tech */
+	/* E-Tech CyberBULLET PC56RVP */
+	{	"ETT0002",		0	},
 	/* FUJITSU */
 	/* Fujitsu 33600 PnP-I2 R Plug & Play */
 	{	"FUJ0202",		0	},

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

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

end of thread, other threads:[~2004-11-04 21:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-09 18:56 [PATCH] Serial updates Russell King
2004-01-03 23:45 Russell King
2004-01-16 22:52 Russell King
2004-08-30 23:21 Russell King
2004-10-31 17:51 Russell King
2004-10-31 22:26 ` Andreas Jellinghaus
2004-11-02  4:09 ` Benjamin Herrenschmidt
2004-11-02  4:20   ` Benjamin Herrenschmidt
2004-11-02 22:43     ` Russell King
2004-11-02 23:01       ` Andrew Morton
2004-11-02 23:17         ` Russell King
2004-11-04 21:22           ` Tony Lindgren
2004-11-02 20:06 ` Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).