aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2014-09-05 15:02:37 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-08 19:32:36 -0400
commitb99b121b2aa42e60e5b73fdd3a49863337839c7b (patch)
tree99ea90710937cf97b3c534f4aeada8e1d337a921
parentae14a7954f5124208e6e93cafb3099f83acd43f5 (diff)
tty: serial: 8250_core: allow to overwrite & export serial8250_startup()
The OMAP version of the 8250 can actually use 1:1 serial8250_startup(). However it needs to be extended by a wake up irq which should to be requested & enabled at ->startup() time and disabled at ->shutdown() time. v2…v3: properly copy callbacks v1…v2: add shutdown callback Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/8250/8250_core.c25
-rw-r--r--include/linux/serial_8250.h2
-rw-r--r--include/linux/serial_core.h2
3 files changed, 27 insertions, 2 deletions
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 90e0d5e2b7ee..872c020607a8 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -1930,7 +1930,7 @@ static void serial8250_put_poll_char(struct uart_port *port,
1930 1930
1931#endif /* CONFIG_CONSOLE_POLL */ 1931#endif /* CONFIG_CONSOLE_POLL */
1932 1932
1933static int serial8250_startup(struct uart_port *port) 1933int serial8250_do_startup(struct uart_port *port)
1934{ 1934{
1935 struct uart_8250_port *up = up_to_u8250p(port); 1935 struct uart_8250_port *up = up_to_u8250p(port);
1936 unsigned long flags; 1936 unsigned long flags;
@@ -2181,8 +2181,16 @@ dont_test_tx_en:
2181 2181
2182 return 0; 2182 return 0;
2183} 2183}
2184EXPORT_SYMBOL_GPL(serial8250_do_startup);
2184 2185
2185static void serial8250_shutdown(struct uart_port *port) 2186static int serial8250_startup(struct uart_port *port)
2187{
2188 if (port->startup)
2189 return port->startup(port);
2190 return serial8250_do_startup(port);
2191}
2192
2193void serial8250_do_shutdown(struct uart_port *port)
2186{ 2194{
2187 struct uart_8250_port *up = up_to_u8250p(port); 2195 struct uart_8250_port *up = up_to_u8250p(port);
2188 unsigned long flags; 2196 unsigned long flags;
@@ -2232,6 +2240,15 @@ static void serial8250_shutdown(struct uart_port *port)
2232 if (port->irq) 2240 if (port->irq)
2233 serial_unlink_irq_chain(up); 2241 serial_unlink_irq_chain(up);
2234} 2242}
2243EXPORT_SYMBOL_GPL(serial8250_do_shutdown);
2244
2245static void serial8250_shutdown(struct uart_port *port)
2246{
2247 if (port->shutdown)
2248 port->shutdown(port);
2249 else
2250 serial8250_do_shutdown(port);
2251}
2235 2252
2236static unsigned int serial8250_get_divisor(struct uart_port *port, unsigned int baud) 2253static unsigned int serial8250_get_divisor(struct uart_port *port, unsigned int baud)
2237{ 2254{
@@ -3466,6 +3483,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
3466 /* Possibly override set_termios call */ 3483 /* Possibly override set_termios call */
3467 if (up->port.set_termios) 3484 if (up->port.set_termios)
3468 uart->port.set_termios = up->port.set_termios; 3485 uart->port.set_termios = up->port.set_termios;
3486 if (up->port.startup)
3487 uart->port.startup = up->port.startup;
3488 if (up->port.shutdown)
3489 uart->port.shutdown = up->port.shutdown;
3469 if (up->port.pm) 3490 if (up->port.pm)
3470 uart->port.pm = up->port.pm; 3491 uart->port.pm = up->port.pm;
3471 if (up->port.handle_break) 3492 if (up->port.handle_break)
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 6dd671765312..6fc9d7bee05e 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -124,6 +124,8 @@ extern void serial8250_early_out(struct uart_port *port, int offset, int value);
124extern int setup_early_serial8250_console(char *cmdline); 124extern int setup_early_serial8250_console(char *cmdline);
125extern void serial8250_do_set_termios(struct uart_port *port, 125extern void serial8250_do_set_termios(struct uart_port *port,
126 struct ktermios *termios, struct ktermios *old); 126 struct ktermios *termios, struct ktermios *old);
127extern int serial8250_do_startup(struct uart_port *port);
128extern void serial8250_do_shutdown(struct uart_port *port);
127extern void serial8250_do_pm(struct uart_port *port, unsigned int state, 129extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
128 unsigned int oldstate); 130 unsigned int oldstate);
129extern int fsl8250_handle_irq(struct uart_port *port); 131extern int fsl8250_handle_irq(struct uart_port *port);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 8cb267b1fcd5..3bd7d55eebce 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -122,6 +122,8 @@ struct uart_port {
122 void (*set_termios)(struct uart_port *, 122 void (*set_termios)(struct uart_port *,
123 struct ktermios *new, 123 struct ktermios *new,
124 struct ktermios *old); 124 struct ktermios *old);
125 int (*startup)(struct uart_port *port);
126 void (*shutdown)(struct uart_port *port);
125 int (*handle_irq)(struct uart_port *); 127 int (*handle_irq)(struct uart_port *);
126 void (*pm)(struct uart_port *, unsigned int state, 128 void (*pm)(struct uart_port *, unsigned int state,
127 unsigned int old); 129 unsigned int old);