serial: imx: Only wakeup via RTSDEN bit if the system has RTS/CTS
authorFabio Estevam <fabio.estevam@nxp.com>
Thu, 4 Jan 2018 17:58:34 +0000 (15:58 -0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Jan 2018 15:45:17 +0000 (16:45 +0100)
The wakeup mechanism via RTSDEN bit relies on the system using the RTS/CTS
lines, so only allow such wakeup method when the system actually has
RTS/CTS support.

Fixes: bc85734b126f ("serial: imx: allow waking up on RTSD")
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Martin Kaiser <martin@kaiser.cx>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/imx.c

index c2b29fd..7143da3 100644 (file)
@@ -2225,12 +2225,14 @@ static void serial_imx_enable_wakeup(struct imx_port *sport, bool on)
                val &= ~UCR3_AWAKEN;
        writel(val, sport->port.membase + UCR3);
 
-       val = readl(sport->port.membase + UCR1);
-       if (on)
-               val |= UCR1_RTSDEN;
-       else
-               val &= ~UCR1_RTSDEN;
-       writel(val, sport->port.membase + UCR1);
+       if (sport->have_rtscts) {
+               val = readl(sport->port.membase + UCR1);
+               if (on)
+                       val |= UCR1_RTSDEN;
+               else
+                       val &= ~UCR1_RTSDEN;
+               writel(val, sport->port.membase + UCR1);
+       }
 }
 
 static int imx_serial_port_suspend_noirq(struct device *dev)