aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2012-09-07 14:06:23 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-26 16:25:41 -0400
commit835d844d1a28efba81d5aca7385e24c29d3a6db2 (patch)
tree646b3c447cd5cba0b976c951ebe0b4f58e50e2e9 /drivers
parent4dac2116547b4aab7ac327edb344bb68ed1e8839 (diff)
8250_pnp: do pnp probe before legacy probe
We first probe the legacy serial ports and then check pnp. If there is a non-standard configuration then this might not work, also this change is needed so we can blacklist Winbond CIR based on PNP ID. For this to work the 8250_pnp driver must be merged into the 8250 module. Signed-off-by: Sean Young <sean@mess.org> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/8250/8250.c31
-rw-r--r--drivers/tty/serial/8250/8250.h9
-rw-r--r--drivers/tty/serial/8250/8250_pnp.c11
-rw-r--r--drivers/tty/serial/8250/Kconfig16
-rw-r--r--drivers/tty/serial/8250/Makefile5
5 files changed, 41 insertions, 31 deletions
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index 932a216aa5bc..a2042c6673af 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -2675,6 +2675,9 @@ static void __init serial8250_isa_init_ports(void)
2675 return; 2675 return;
2676 first = 0; 2676 first = 0;
2677 2677
2678 if (nr_uarts > UART_NR)
2679 nr_uarts = UART_NR;
2680
2678 for (i = 0; i < nr_uarts; i++) { 2681 for (i = 0; i < nr_uarts; i++) {
2679 struct uart_8250_port *up = &serial8250_ports[i]; 2682 struct uart_8250_port *up = &serial8250_ports[i];
2680 struct uart_port *port = &up->port; 2683 struct uart_port *port = &up->port;
@@ -2684,6 +2687,7 @@ static void __init serial8250_isa_init_ports(void)
2684 2687
2685 init_timer(&up->timer); 2688 init_timer(&up->timer);
2686 up->timer.function = serial8250_timeout; 2689 up->timer.function = serial8250_timeout;
2690 up->cur_iotype = 0xFF;
2687 2691
2688 /* 2692 /*
2689 * ALPHA_KLUDGE_MCR needs to be killed. 2693 * ALPHA_KLUDGE_MCR needs to be killed.
@@ -2735,13 +2739,9 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)
2735 2739
2736 for (i = 0; i < nr_uarts; i++) { 2740 for (i = 0; i < nr_uarts; i++) {
2737 struct uart_8250_port *up = &serial8250_ports[i]; 2741 struct uart_8250_port *up = &serial8250_ports[i];
2738 up->cur_iotype = 0xFF;
2739 }
2740 2742
2741 serial8250_isa_init_ports(); 2743 if (up->port.dev)
2742 2744 continue;
2743 for (i = 0; i < nr_uarts; i++) {
2744 struct uart_8250_port *up = &serial8250_ports[i];
2745 2745
2746 up->port.dev = dev; 2746 up->port.dev = dev;
2747 2747
@@ -2866,9 +2866,6 @@ static struct console serial8250_console = {
2866 2866
2867static int __init serial8250_console_init(void) 2867static int __init serial8250_console_init(void)
2868{ 2868{
2869 if (nr_uarts > UART_NR)
2870 nr_uarts = UART_NR;
2871
2872 serial8250_isa_init_ports(); 2869 serial8250_isa_init_ports();
2873 register_console(&serial8250_console); 2870 register_console(&serial8250_console);
2874 return 0; 2871 return 0;
@@ -3151,7 +3148,8 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
3151 3148
3152 uart = serial8250_find_match_or_unused(&up->port); 3149 uart = serial8250_find_match_or_unused(&up->port);
3153 if (uart) { 3150 if (uart) {
3154 uart_remove_one_port(&serial8250_reg, &uart->port); 3151 if (uart->port.dev)
3152 uart_remove_one_port(&serial8250_reg, &uart->port);
3155 3153
3156 uart->port.iobase = up->port.iobase; 3154 uart->port.iobase = up->port.iobase;
3157 uart->port.membase = up->port.membase; 3155 uart->port.membase = up->port.membase;
@@ -3235,8 +3233,7 @@ static int __init serial8250_init(void)
3235{ 3233{
3236 int ret; 3234 int ret;
3237 3235
3238 if (nr_uarts > UART_NR) 3236 serial8250_isa_init_ports();
3239 nr_uarts = UART_NR;
3240 3237
3241 printk(KERN_INFO "Serial: 8250/16550 driver, " 3238 printk(KERN_INFO "Serial: 8250/16550 driver, "
3242 "%d ports, IRQ sharing %sabled\n", nr_uarts, 3239 "%d ports, IRQ sharing %sabled\n", nr_uarts,
@@ -3251,11 +3248,15 @@ static int __init serial8250_init(void)
3251 if (ret) 3248 if (ret)
3252 goto out; 3249 goto out;
3253 3250
3251 ret = serial8250_pnp_init();
3252 if (ret)
3253 goto unreg_uart_drv;
3254
3254 serial8250_isa_devs = platform_device_alloc("serial8250", 3255 serial8250_isa_devs = platform_device_alloc("serial8250",
3255 PLAT8250_DEV_LEGACY); 3256 PLAT8250_DEV_LEGACY);
3256 if (!serial8250_isa_devs) { 3257 if (!serial8250_isa_devs) {
3257 ret = -ENOMEM; 3258 ret = -ENOMEM;
3258 goto unreg_uart_drv; 3259 goto unreg_pnp;
3259 } 3260 }
3260 3261
3261 ret = platform_device_add(serial8250_isa_devs); 3262 ret = platform_device_add(serial8250_isa_devs);
@@ -3271,6 +3272,8 @@ static int __init serial8250_init(void)
3271 platform_device_del(serial8250_isa_devs); 3272 platform_device_del(serial8250_isa_devs);
3272put_dev: 3273put_dev:
3273 platform_device_put(serial8250_isa_devs); 3274 platform_device_put(serial8250_isa_devs);
3275unreg_pnp:
3276 serial8250_pnp_exit();
3274unreg_uart_drv: 3277unreg_uart_drv:
3275#ifdef CONFIG_SPARC 3278#ifdef CONFIG_SPARC
3276 sunserial_unregister_minors(&serial8250_reg, UART_NR); 3279 sunserial_unregister_minors(&serial8250_reg, UART_NR);
@@ -3295,6 +3298,8 @@ static void __exit serial8250_exit(void)
3295 platform_driver_unregister(&serial8250_isa_driver); 3298 platform_driver_unregister(&serial8250_isa_driver);
3296 platform_device_unregister(isa_dev); 3299 platform_device_unregister(isa_dev);
3297 3300
3301 serial8250_pnp_exit();
3302
3298#ifdef CONFIG_SPARC 3303#ifdef CONFIG_SPARC
3299 sunserial_unregister_minors(&serial8250_reg, UART_NR); 3304 sunserial_unregister_minors(&serial8250_reg, UART_NR);
3300#else 3305#else
diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 0c5e908df0b5..5a76f9c8d36b 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -97,3 +97,12 @@ static inline void serial_dl_write(struct uart_8250_port *up, int value)
97#else 97#else
98#define ALPHA_KLUDGE_MCR 0 98#define ALPHA_KLUDGE_MCR 0
99#endif 99#endif
100
101#ifdef CONFIG_SERIAL_8250_PNP
102int serial8250_pnp_init(void);
103void serial8250_pnp_exit(void);
104#else
105static inline int serial8250_pnp_init(void) { return 0; }
106static inline void serial8250_pnp_exit(void) { }
107#endif
108
diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
index fde5aa60d51e..28bf830603aa 100644
--- a/drivers/tty/serial/8250/8250_pnp.c
+++ b/drivers/tty/serial/8250/8250_pnp.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Probe module for 8250/16550-type ISAPNP serial ports. 2 * Probe for 8250/16550-type ISAPNP serial ports.
3 * 3 *
4 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. 4 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
5 * 5 *
@@ -507,18 +507,13 @@ static struct pnp_driver serial_pnp_driver = {
507 .id_table = pnp_dev_table, 507 .id_table = pnp_dev_table,
508}; 508};
509 509
510static int __init serial8250_pnp_init(void) 510int serial8250_pnp_init(void)
511{ 511{
512 return pnp_register_driver(&serial_pnp_driver); 512 return pnp_register_driver(&serial_pnp_driver);
513} 513}
514 514
515static void __exit serial8250_pnp_exit(void) 515void serial8250_pnp_exit(void)
516{ 516{
517 pnp_unregister_driver(&serial_pnp_driver); 517 pnp_unregister_driver(&serial_pnp_driver);
518} 518}
519 519
520module_init(serial8250_pnp_init);
521module_exit(serial8250_pnp_exit);
522
523MODULE_LICENSE("GPL");
524MODULE_DESCRIPTION("Generic 8250/16x50 PnP serial driver");
diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index a27dd0569bd7..f3d283f2e3aa 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -33,6 +33,14 @@ config SERIAL_8250
33 Most people will say Y or M here, so that they can use serial mice, 33 Most people will say Y or M here, so that they can use serial mice,
34 modems and similar devices connecting to the standard serial ports. 34 modems and similar devices connecting to the standard serial ports.
35 35
36config SERIAL_8250_PNP
37 bool "8250/16550 PNP device support" if EXPERT
38 depends on SERIAL_8250 && PNP
39 default y
40 ---help---
41 This builds standard PNP serial support. You may be able to
42 disable this feature if you only need legacy serial support.
43
36config SERIAL_8250_CONSOLE 44config SERIAL_8250_CONSOLE
37 bool "Console on 8250/16550 and compatible serial port" 45 bool "Console on 8250/16550 and compatible serial port"
38 depends on SERIAL_8250=y 46 depends on SERIAL_8250=y
@@ -85,14 +93,6 @@ config SERIAL_8250_PCI
85 disable this feature if you only need legacy serial support. 93 disable this feature if you only need legacy serial support.
86 Saves about 9K. 94 Saves about 9K.
87 95
88config SERIAL_8250_PNP
89 tristate "8250/16550 PNP device support" if EXPERT
90 depends on SERIAL_8250 && PNP
91 default SERIAL_8250
92 help
93 This builds standard PNP serial support. You may be able to
94 disable this feature if you only need legacy serial support.
95
96config SERIAL_8250_HP300 96config SERIAL_8250_HP300
97 tristate 97 tristate
98 depends on SERIAL_8250 && HP300 98 depends on SERIAL_8250 && HP300
diff --git a/drivers/tty/serial/8250/Makefile b/drivers/tty/serial/8250/Makefile
index d7533c7d2c1a..108fe7fe13e2 100644
--- a/drivers/tty/serial/8250/Makefile
+++ b/drivers/tty/serial/8250/Makefile
@@ -2,8 +2,9 @@
2# Makefile for the 8250 serial device drivers. 2# Makefile for the 8250 serial device drivers.
3# 3#
4 4
5obj-$(CONFIG_SERIAL_8250) += 8250.o 5obj-$(CONFIG_SERIAL_8250) += 8250_core.o
6obj-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.o 68250_core-y := 8250.o
78250_core-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.o
7obj-$(CONFIG_SERIAL_8250_GSC) += 8250_gsc.o 8obj-$(CONFIG_SERIAL_8250_GSC) += 8250_gsc.o
8obj-$(CONFIG_SERIAL_8250_PCI) += 8250_pci.o 9obj-$(CONFIG_SERIAL_8250_PCI) += 8250_pci.o
9obj-$(CONFIG_SERIAL_8250_HP300) += 8250_hp300.o 10obj-$(CONFIG_SERIAL_8250_HP300) += 8250_hp300.o