From 21248e454178f5c7ea48b83ba58058667e0893df Mon Sep 17 00:00:00 2001 From: "takata@org.rmk.(none)" Date: Wed, 30 Mar 2005 11:49:58 +0100 Subject: [SERIAL] m32r_sio driver update Patch from Hirokazu Takata 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. Signed-off-by: Hirokazu Takata --- drivers/serial/m32r_sio.c | 131 ++++++++++------------------------------------ include/asm-m32r/serial.h | 41 +-------------- 2 files changed, 31 insertions(+), 141 deletions(-) diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c index bb6509f5fe8bb..08d61f13edc61 100644 --- a/drivers/serial/m32r_sio.c +++ b/drivers/serial/m32r_sio.c @@ -53,13 +53,6 @@ #include "m32r_sio.h" #include "m32r_sio_reg.h" -/* - * Configuration: - * share_irqs - whether we pass SA_SHIRQ to request_irq(). This option - * is unsafe when used on edge-triggered interrupts. - */ -unsigned int share_irqs_sio = M32R_SIO_SHARE_IRQS; - /* * Debugging. */ @@ -86,15 +79,36 @@ unsigned int share_irqs_sio = M32R_SIO_SHARE_IRQS; #include +/* Standard COM flags */ +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) + /* * SERIAL_PORT_DFNS tells us about built-in ports that have no * standard enumeration mechanism. Platforms that can find all * serial ports via mechanisms like ACPI or PCI need not supply it. */ -#ifndef SERIAL_PORT_DFNS -#define SERIAL_PORT_DFNS +#undef SERIAL_PORT_DFNS +#if defined(CONFIG_PLAT_USRV) + +#define SERIAL_PORT_DFNS \ + /* 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 SERIAL_PORT_DFNS \ + { 0, BASE_BAUD, ((unsigned long)PLD_ESIO0CR), PLD_IRQ_SIO0_RCV, \ + STD_COM_FLAGS }, /* ttyS0 */ +#else +#define SERIAL_PORT_DFNS \ + { 0, BASE_BAUD, M32R_SIO_OFFSET, M32R_IRQ_SIO0_R, \ + STD_COM_FLAGS }, /* ttyS0 */ #endif +#endif /* !CONFIG_PLAT_USRV */ + static struct old_serial_port old_serial_port[] = { SERIAL_PORT_DFNS /* defined in asm/serial.h */ }; @@ -581,10 +595,7 @@ static void serial_unlink_irq_chain(struct uart_sio_port *up) } /* - * This function is used to handle ports that do not have an - * interrupt. This doesn't work very well for 16450's, but gives - * barely passable results for a 16550A. (Although at the expense - * of much CPU overhead). + * This function is used to handle ports that do not have an interrupt. */ static void m32r_sio_timeout(unsigned long data) { @@ -966,7 +977,7 @@ static struct uart_ops m32r_sio_pops = { static struct uart_sio_port m32r_sio_ports[UART_NR]; -static void __init m32r_sio_isa_init_ports(void) +static void __init m32r_sio_init_ports(void) { struct uart_sio_port *up; static int first = 1; @@ -986,8 +997,6 @@ static void __init m32r_sio_isa_init_ports(void) up->port.iotype = old_serial_port[i].io_type; up->port.regshift = old_serial_port[i].iomem_reg_shift; up->port.ops = &m32r_sio_pops; - if (share_irqs_sio) - up->port.flags |= UPF_SHARE_IRQ; } } @@ -995,7 +1004,7 @@ static void __init m32r_sio_register_ports(struct uart_driver *drv) { int i; - m32r_sio_isa_init_ports(); + m32r_sio_init_ports(); for (i = 0; i < UART_NR; i++) { struct uart_sio_port *up = &m32r_sio_ports[i]; @@ -1129,7 +1138,7 @@ static int __init m32r_sio_console_init(void) { sio_reset(); sio_init(); - m32r_sio_isa_init_ports(); + m32r_sio_init_ports(); register_console(&m32r_sio_console); return 0; } @@ -1151,81 +1160,6 @@ static struct uart_driver m32r_sio_reg = { .cons = M32R_SIO_CONSOLE, }; -/* - * register_serial and unregister_serial allows for 16x50 serial ports to be - * configured at run-time, to support PCMCIA modems. - */ - -static int __register_m32r_sio(struct serial_struct *req, int line) -{ - struct uart_port port; - - port.iobase = req->port; - port.membase = req->iomem_base; - port.irq = req->irq; - port.uartclk = req->baud_base * 16; - port.fifosize = req->xmit_fifo_size; - port.regshift = req->iomem_reg_shift; - port.iotype = req->io_type; - port.flags = req->flags | UPF_BOOT_AUTOCONF; - port.mapbase = req->iomap_base; - port.line = line; - - if (share_irqs_sio) - port.flags |= UPF_SHARE_IRQ; - - if (HIGH_BITS_OFFSET) - port.iobase |= (long) req->port_high << HIGH_BITS_OFFSET; - - /* - * If a clock rate wasn't specified by the low level - * driver, then default to the standard clock rate. - */ - if (port.uartclk == 0) - port.uartclk = BASE_BAUD * 16; - - return uart_register_port(&m32r_sio_reg, &port); -} - -/** - * register_m32r_sio - configure a 16x50 serial port at runtime - * @req: request structure - * - * Configure the serial port specified by the request. If the - * port exists and is in use an error is returned. If the port - * is not currently in the table it is added. - * - * The port is then probed and if necessary the IRQ is autodetected - * If this fails an error is returned. - * - * On success the port is ready to use and the line number is returned. - */ -int register_m32r_sio(struct serial_struct *req) -{ - return __register_m32r_sio(req, -1); -} - -int __init early_serial_setup(struct uart_port *port) -{ - m32r_sio_isa_init_ports(); - m32r_sio_ports[port->line].port = *port; - m32r_sio_ports[port->line].port.ops = &m32r_sio_pops; - - return 0; -} - -/** - * unregister_m32r_sio - remove a 16x50 serial port at runtime - * @line: serial line number - * - * Remove one serial port. This may be called from interrupt - * context. - */ -void unregister_m32r_sio(int line) -{ - uart_unregister_port(&m32r_sio_reg, line); -} - /** * m32r_sio_suspend_port - suspend one serial port * @line: serial line number @@ -1252,8 +1186,7 @@ static int __init m32r_sio_init(void) { int ret, i; - printk(KERN_INFO "Serial: M32R SIO driver $Revision: 1.9 $ " - "IRQ sharing %sabled\n", share_irqs_sio ? "en" : "dis"); + printk(KERN_INFO "Serial: M32R SIO driver $Revision: 1.11 $ "); for (i = 0; i < NR_IRQS; i++) spin_lock_init(&irq_lists[i].lock); @@ -1278,14 +1211,8 @@ static void __exit m32r_sio_exit(void) module_init(m32r_sio_init); module_exit(m32r_sio_exit); -EXPORT_SYMBOL(register_m32r_sio); -EXPORT_SYMBOL(unregister_m32r_sio); EXPORT_SYMBOL(m32r_sio_suspend_port); EXPORT_SYMBOL(m32r_sio_resume_port); MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Generic M32R SIO serial driver $Revision: 1.9 $"); - -module_param(share_irqs_sio, bool, 0400); -MODULE_PARM_DESC(share_irqs_sio, "Share IRQs with other non-M32R SIO devices" - " (unsafe)"); +MODULE_DESCRIPTION("Generic M32R SIO serial driver $Revision: 1.11 $"); diff --git a/include/asm-m32r/serial.h b/include/asm-m32r/serial.h index d0e56b1bf4511..1bf480f58493e 100644 --- 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 -#include -/* - * 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 */ -- cgit 1.2.3-korg From 9cc45feb3ecd1914c82d65bf9e1955a0671584cc Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 30 Mar 2005 14:22:42 +0100 Subject: [SERIAL] Remove serial8250_late_console_init The serial core will try to register the console each time a port is registered with it. This makes serial8250_late_console_init redundant, so remove it. Signed-off-by: Russell King --- drivers/serial/8250.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 2eae67f9a621f..226f328a86f1e 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c @@ -2194,14 +2194,6 @@ static int __init serial8250_console_init(void) } console_initcall(serial8250_console_init); -static int __init serial8250_late_console_init(void) -{ - if (!(serial8250_console.flags & CON_ENABLED)) - register_console(&serial8250_console); - return 0; -} -late_initcall(serial8250_late_console_init); - static int __init find_port(struct uart_port *p) { int line; -- cgit 1.2.3-korg