summaryrefslogtreecommitdiff
path: root/include/linux/serial_8250.h
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2015-01-22 12:24:30 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-02-02 10:11:27 -0800
commit4516d50aabedbe5ae334155193e4d35c02390d9a (patch)
tree19bcf6aba42e65701008dce683481dce7008fef9 /include/linux/serial_8250.h
parent06a4c710673184f5c750bdb2f8579e0ae1cc252c (diff)
serial: 8250: Use canary to restart console after suspend
When using no_console_suspend, the serial console may be powered off anyway during system sleep. Upon resume, the port may be in its default power-on state, but is expected to continue console i/o before the device has received its pm callback. The resultant garbage i/o can cause all kinds of havoc on the remote end. Use the scratch register as a canary to discover if the console has been powered-off. Write a non-zero value to the scratch register at port suspend and reprogram the port before any console i/o if the scratch register != canary before port resume. This workaround is disabled for omap_8250 (which uses different divisor programming). Credit to Doug Anderson <dianders@chromium.org> for the idea of using the scratch register canary to discover port power-down. Cc: Doug Anderson <dianders@chromium.org> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/serial_8250.h')
-rw-r--r--include/linux/serial_8250.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 245b959f1ff6..a8efa235b7c1 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -85,6 +85,9 @@ struct uart_8250_port {
unsigned char mcr_force; /* mask of forced bits */
unsigned char cur_iotype; /* Running I/O type */
unsigned int rpm_tx_active;
+ unsigned char canary; /* non-zero during system sleep
+ * if no_console_suspend
+ */
/*
* Some bits in registers are cleared on a read, so they must