serial: 8250: Check UART_SCR is writable
authorPeter Hurley <peter@hurleysoftware.com>
Mon, 9 Mar 2015 18:05:01 +0000 (14:05 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Mar 2015 21:21:08 +0000 (22:21 +0100)
Au1x00/RT2800+ doesn't implement the 8250 scratch register (and
this may be true of other h/w currently supported by the 8250 driver);
read back the canary value written to the scratch register to enable
the console h/w restart after resume from system suspend.

Fixes: 4516d50aabedb ("serial: 8250: Use canary to restart console ...")
Reported-by: Mason <slash.tmp@free.fr>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_core.c

index 0a8f11b69e68fc201be78060946f0f14e390bbee..3e7cf371137800ce2b9e432263e0e1634ae7dc43 100644 (file)
@@ -3585,7 +3585,8 @@ void serial8250_suspend_port(int line)
            port->type != PORT_8250) {
                unsigned char canary = 0xa5;
                serial_out(up, UART_SCR, canary);
-               up->canary = canary;
+               if (serial_in(up, UART_SCR) == canary)
+                       up->canary = canary;
        }
 
        uart_suspend_port(&serial8250_reg, port);