Commit fcc32e8d authored by Russell King's avatar Russell King

[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).
parent e5e0d098
...@@ -2216,6 +2216,12 @@ static struct device_driver serial8250_isa_driver = { ...@@ -2216,6 +2216,12 @@ static struct device_driver serial8250_isa_driver = {
.resume = serial8250_resume, .resume = serial8250_resume,
}; };
/*
* This "device" covers _all_ ISA 8250-compatible serial devices listed
* in the table in include/asm-*/serial.h
*/
static struct platform_device *serial8250_isa_devs;
/* /*
* serial8250_register_port and serial8250_unregister_port allows for * serial8250_register_port and serial8250_unregister_port allows for
* 16x50 serial ports to be configured at run-time, to support PCMCIA * 16x50 serial ports to be configured at run-time, to support PCMCIA
...@@ -2336,7 +2342,7 @@ void serial8250_unregister_port(int line) ...@@ -2336,7 +2342,7 @@ void serial8250_unregister_port(int line)
uart_remove_one_port(&serial8250_reg, &uart->port); uart_remove_one_port(&serial8250_reg, &uart->port);
uart->port.flags &= ~UPF_BOOT_AUTOCONF; uart->port.flags &= ~UPF_BOOT_AUTOCONF;
uart->port.type = PORT_UNKNOWN; uart->port.type = PORT_UNKNOWN;
uart->port.dev = NULL; uart->port.dev = &serial8250_isa_devs->dev;
uart_add_one_port(&serial8250_reg, &uart->port); uart_add_one_port(&serial8250_reg, &uart->port);
up(&serial_sem); up(&serial_sem);
} }
...@@ -2357,14 +2363,20 @@ static int __init serial8250_init(void) ...@@ -2357,14 +2363,20 @@ static int __init serial8250_init(void)
if (ret) if (ret)
goto out; goto out;
serial8250_register_ports(&serial8250_reg, NULL); serial8250_isa_devs = platform_device_register_simple("serial8250",
-1, NULL, 0);
ret = driver_register(&serial8250_isa_driver); if (IS_ERR(serial8250_isa_devs)) {
if (ret) ret = PTR_ERR(serial8250_isa_devs);
goto unreg; goto unreg;
}
goto out; serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev);
ret = driver_register(&serial8250_isa_driver);
if (ret == 0)
goto out;
platform_device_unregister(serial8250_isa_devs);
unreg: unreg:
uart_unregister_driver(&serial8250_reg); uart_unregister_driver(&serial8250_reg);
out: out:
...@@ -2377,8 +2389,13 @@ static void __exit serial8250_exit(void) ...@@ -2377,8 +2389,13 @@ static void __exit serial8250_exit(void)
driver_unregister(&serial8250_isa_driver); driver_unregister(&serial8250_isa_driver);
for (i = 0; i < UART_NR; i++) for (i = 0; i < UART_NR; i++) {
uart_remove_one_port(&serial8250_reg, &serial8250_ports[i].port); struct uart_8250_port *up = &serial8250_ports[i];
if (up->port.dev == &serial8250_isa_devs->dev)
uart_remove_one_port(&serial8250_reg, &up->port);
}
platform_device_unregister(serial8250_isa_devs);
uart_unregister_driver(&serial8250_reg); uart_unregister_driver(&serial8250_reg);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment