aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2007-05-08 03:36:07 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:23 -0400
commit7e92b4fc345f5b6f57585fbe5ffdb0f24d7c9b26 (patch)
treea8e9dac38a9c8dd22bd182c13e2ae0e6d32bd729
parentd0d4f69bb65a8c1c1430c577a583632709b874c6 (diff)
x86, serial: convert legacy COM ports to platform devices
Make x86 COM ports into platform devices and don't probe for them if we have PNP. This prevents double discovery, where a device was found both by the legacy probe and by 8250_pnp, e.g., serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A 00:02: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A This also means IRDA devices without a UART PNP ID will no longer be claimed by the serial driver, which might require changes in IRDA drivers and administration. In addition to this patch, you may need to configure a setserial init script, e.g., /etc/init.d/setserial, so it doesn't poke legacy UART stuff back in. On Debian, "dpkg-reconfigure setserial" with the "kernel" option does this. To force the old legacy probe behavior even when we have PNPBIOS or ACPI, load the new legacy_serial module (or build 8250 static) with the "legacy_serial.force" option. [akpm@linux-foundation.org: fix makefiles] Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: Keith Owens <kaos@ocs.com.au> Cc: Len Brown <lenb@kernel.org> Cc: Adam Belay <ambx1@neo.rr.com> Cc: Matthieu CASTET <castet.matthieu@free.fr> Cc: Jean Tourrilhes <jt@hpl.hp.com> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: Ville Syrjala <syrjala@sci.fi> Cc: Russell King <rmk+serial@arm.linux.org.uk> Cc: Samuel Ortiz <samuel@sortiz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/kernel-parameters.txt5
-rw-r--r--arch/i386/kernel/Makefile1
-rw-r--r--arch/i386/kernel/legacy_serial.c67
-rw-r--r--arch/x86_64/kernel/Makefile2
-rw-r--r--drivers/serial/Kconfig14
-rw-r--r--include/asm-i386/serial.h16
-rw-r--r--include/asm-x86_64/serial.h16
7 files changed, 84 insertions, 37 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index fa885174fd75..bebebe4fd469 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -816,6 +816,11 @@ and is between 256 and 4096 characters. It is defined in the file
816 lasi= [HW,SCSI] PARISC LASI driver for the 53c700 chip 816 lasi= [HW,SCSI] PARISC LASI driver for the 53c700 chip
817 Format: addr:<io>,irq:<irq> 817 Format: addr:<io>,irq:<irq>
818 818
819 legacy_serial.force [HW,IA-32,X86-64]
820 Probe for COM ports at legacy addresses even
821 if PNPBIOS or ACPI should describe them. This
822 is for working around firmware defects.
823
819 llsc*= [IA64] See function print_params() in 824 llsc*= [IA64] See function print_params() in
820 arch/ia64/sn/kernel/llsc4.c. 825 arch/ia64/sn/kernel/llsc4.c.
821 826
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index 4f98516b9f94..91cff8dc9e1a 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -34,6 +34,7 @@ obj-y += sysenter.o vsyscall.o
34obj-$(CONFIG_ACPI_SRAT) += srat.o 34obj-$(CONFIG_ACPI_SRAT) += srat.o
35obj-$(CONFIG_EFI) += efi.o efi_stub.o 35obj-$(CONFIG_EFI) += efi.o efi_stub.o
36obj-$(CONFIG_DOUBLEFAULT) += doublefault.o 36obj-$(CONFIG_DOUBLEFAULT) += doublefault.o
37obj-$(CONFIG_SERIAL_8250) += legacy_serial.o
37obj-$(CONFIG_VM86) += vm86.o 38obj-$(CONFIG_VM86) += vm86.o
38obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 39obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
39obj-$(CONFIG_HPET_TIMER) += hpet.o 40obj-$(CONFIG_HPET_TIMER) += hpet.o
diff --git a/arch/i386/kernel/legacy_serial.c b/arch/i386/kernel/legacy_serial.c
new file mode 100644
index 000000000000..21510118544e
--- /dev/null
+++ b/arch/i386/kernel/legacy_serial.c
@@ -0,0 +1,67 @@
1/*
2 * Legacy COM port devices for x86 platforms without PNPBIOS or ACPI.
3 * Data taken from include/asm-i386/serial.h.
4 *
5 * (c) Copyright 2007 Hewlett-Packard Development Company, L.P.
6 * Bjorn Helgaas <bjorn.helgaas@hp.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/pnp.h>
15#include <linux/serial_8250.h>
16
17/* Standard COM flags (except for COM4, because of the 8514 problem) */
18#ifdef CONFIG_SERIAL_DETECT_IRQ
19#define COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ)
20#define COM4_FLAGS (UPF_BOOT_AUTOCONF | UPF_AUTO_IRQ)
21#else
22#define COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST)
23#define COM4_FLAGS UPF_BOOT_AUTOCONF
24#endif
25
26#define PORT(_base,_irq,_flags) \
27 { \
28 .iobase = _base, \
29 .irq = _irq, \
30 .uartclk = 1843200, \
31 .iotype = UPIO_PORT, \
32 .flags = _flags, \
33 }
34
35static struct plat_serial8250_port x86_com_data[] = {
36 PORT(0x3F8, 4, COM_FLAGS),
37 PORT(0x2F8, 3, COM_FLAGS),
38 PORT(0x3E8, 4, COM_FLAGS),
39 PORT(0x2E8, 3, COM4_FLAGS),
40 { },
41};
42
43static struct platform_device x86_com_device = {
44 .name = "serial8250",
45 .id = PLAT8250_DEV_PLATFORM,
46 .dev = {
47 .platform_data = x86_com_data,
48 },
49};
50
51static int force_legacy_probe;
52module_param_named(force, force_legacy_probe, bool, 0);
53MODULE_PARM_DESC(force, "Force legacy serial port probe");
54
55static int __init serial8250_x86_com_init(void)
56{
57 if (pnp_platform_devices && !force_legacy_probe)
58 return -ENODEV;
59
60 return platform_device_register(&x86_com_device);
61}
62
63module_init(serial8250_x86_com_init);
64
65MODULE_AUTHOR("Bjorn Helgaas");
66MODULE_LICENSE("GPL");
67MODULE_DESCRIPTION("Generic 8250/16x50 legacy probe module");
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index 4d94c51803d8..de1de8a2fd84 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
32obj-$(CONFIG_IOMMU) += pci-gart.o aperture.o 32obj-$(CONFIG_IOMMU) += pci-gart.o aperture.o
33obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary.o tce.o 33obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary.o tce.o
34obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o 34obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
35obj-$(CONFIG_SERIAL_8250) += legacy_serial.o
35obj-$(CONFIG_KPROBES) += kprobes.o 36obj-$(CONFIG_KPROBES) += kprobes.o
36obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o 37obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o
37obj-$(CONFIG_X86_VSMP) += vsmp.o 38obj-$(CONFIG_X86_VSMP) += vsmp.o
@@ -49,6 +50,7 @@ CFLAGS_vsyscall.o := $(PROFILING) -g0
49 50
50therm_throt-y += ../../i386/kernel/cpu/mcheck/therm_throt.o 51therm_throt-y += ../../i386/kernel/cpu/mcheck/therm_throt.o
51bootflag-y += ../../i386/kernel/bootflag.o 52bootflag-y += ../../i386/kernel/bootflag.o
53legacy_serial-y += ../../i386/kernel/legacy_serial.o
52cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o 54cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o
53topology-y += ../../i386/kernel/topology.o 55topology-y += ../../i386/kernel/topology.o
54microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o 56microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 924e9bd757f0..e8efe938c4e7 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -73,17 +73,21 @@ config SERIAL_8250_PCI
73 depends on SERIAL_8250 && PCI 73 depends on SERIAL_8250 && PCI
74 default SERIAL_8250 74 default SERIAL_8250
75 help 75 help
76 This builds standard PCI serial support. You may be able to 76 Say Y here if you have PCI serial ports.
77 disable this feature if you only need legacy serial support. 77
78 Saves about 9K. 78 To compile this driver as a module, choose M here: the module
79 will be called 8250_pci.
79 80
80config SERIAL_8250_PNP 81config SERIAL_8250_PNP
81 tristate "8250/16550 PNP device support" if EMBEDDED 82 tristate "8250/16550 PNP device support" if EMBEDDED
82 depends on SERIAL_8250 && PNP 83 depends on SERIAL_8250 && PNP
83 default SERIAL_8250 84 default SERIAL_8250
84 help 85 help
85 This builds standard PNP serial support. You may be able to 86 Say Y here if you have serial ports described by PNPBIOS or ACPI.
86 disable this feature if you only need legacy serial support. 87 These are typically ports built into the system board.
88
89 To compile this driver as a module, choose M here: the module
90 will be called 8250_pnp.
87 91
88config SERIAL_8250_HP300 92config SERIAL_8250_HP300
89 tristate 93 tristate
diff --git a/include/asm-i386/serial.h b/include/asm-i386/serial.h
index bd67480ca109..57a4306cdf63 100644
--- a/include/asm-i386/serial.h
+++ b/include/asm-i386/serial.h
@@ -11,19 +11,3 @@
11 * megabits/second; but this requires the faster clock. 11 * megabits/second; but this requires the faster clock.
12 */ 12 */
13#define BASE_BAUD ( 1843200 / 16 ) 13#define BASE_BAUD ( 1843200 / 16 )
14
15/* Standard COM flags (except for COM4, because of the 8514 problem) */
16#ifdef CONFIG_SERIAL_DETECT_IRQ
17#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
18#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
19#else
20#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
21#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
22#endif
23
24#define SERIAL_PORT_DFNS \
25 /* UART CLK PORT IRQ FLAGS */ \
26 { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
27 { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \
28 { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \
29 { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
diff --git a/include/asm-x86_64/serial.h b/include/asm-x86_64/serial.h
index b0496e0d72a6..8ebd765c674a 100644
--- a/include/asm-x86_64/serial.h
+++ b/include/asm-x86_64/serial.h
@@ -11,19 +11,3 @@
11 * megabits/second; but this requires the faster clock. 11 * megabits/second; but this requires the faster clock.
12 */ 12 */
13#define BASE_BAUD ( 1843200 / 16 ) 13#define BASE_BAUD ( 1843200 / 16 )
14
15/* Standard COM flags (except for COM4, because of the 8514 problem) */
16#ifdef CONFIG_SERIAL_DETECT_IRQ
17#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
18#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
19#else
20#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
21#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
22#endif
23
24#define SERIAL_PORT_DFNS \
25 /* UART CLK PORT IRQ FLAGS */ \
26 { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
27 { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \
28 { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \
29 { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */