serial: 8250: 8250_omap: Clear UART_HAS_RHR_IT_DIS bit
[platform/kernel/linux-starfive.git] / drivers / tty / serial / 8250 / 8250_omap.c
index 26dd089..c7ab296 100644 (file)
@@ -914,7 +914,7 @@ static void __dma_rx_do_complete(struct uart_8250_port *p)
        if (priv->habit & UART_HAS_RHR_IT_DIS) {
                reg = serial_in(p, UART_OMAP_IER2);
                reg &= ~UART_OMAP_IER2_RHR_IT_DIS;
-               serial_out(p, UART_OMAP_IER2, UART_OMAP_IER2_RHR_IT_DIS);
+               serial_out(p, UART_OMAP_IER2, reg);
        }
 
        dmaengine_tx_status(rxchan, cookie, &state);
@@ -1060,7 +1060,7 @@ static int omap_8250_rx_dma(struct uart_8250_port *p)
        if (priv->habit & UART_HAS_RHR_IT_DIS) {
                reg = serial_in(p, UART_OMAP_IER2);
                reg |= UART_OMAP_IER2_RHR_IT_DIS;
-               serial_out(p, UART_OMAP_IER2, UART_OMAP_IER2_RHR_IT_DIS);
+               serial_out(p, UART_OMAP_IER2, reg);
        }
 
        dma_async_issue_pending(dma->rxchan);
@@ -1617,7 +1617,7 @@ static int omap8250_suspend(struct device *dev)
 {
        struct omap8250_priv *priv = dev_get_drvdata(dev);
        struct uart_8250_port *up = serial8250_get_port(priv->line);
-       int err;
+       int err = 0;
 
        serial8250_suspend_port(priv->line);
 
@@ -1627,7 +1627,8 @@ static int omap8250_suspend(struct device *dev)
        if (!device_may_wakeup(dev))
                priv->wer = 0;
        serial_out(up, UART_OMAP_WER, priv->wer);
-       err = pm_runtime_force_suspend(dev);
+       if (uart_console(&up->port) && console_suspend_enabled)
+               err = pm_runtime_force_suspend(dev);
        flush_work(&priv->qos_work);
 
        return err;
@@ -1636,11 +1637,15 @@ static int omap8250_suspend(struct device *dev)
 static int omap8250_resume(struct device *dev)
 {
        struct omap8250_priv *priv = dev_get_drvdata(dev);
+       struct uart_8250_port *up = serial8250_get_port(priv->line);
        int err;
 
-       err = pm_runtime_force_resume(dev);
-       if (err)
-               return err;
+       if (uart_console(&up->port) && console_suspend_enabled) {
+               err = pm_runtime_force_resume(dev);
+               if (err)
+                       return err;
+       }
+
        serial8250_resume_port(priv->line);
        /* Paired with pm_runtime_resume_and_get() in omap8250_suspend() */
        pm_runtime_mark_last_busy(dev);
@@ -1717,16 +1722,6 @@ static int omap8250_runtime_suspend(struct device *dev)
 
        if (priv->line >= 0)
                up = serial8250_get_port(priv->line);
-       /*
-        * When using 'no_console_suspend', the console UART must not be
-        * suspended. Since driver suspend is managed by runtime suspend,
-        * preventing runtime suspend (by returning error) will keep device
-        * active during suspend.
-        */
-       if (priv->is_suspending && !console_suspend_enabled) {
-               if (up && uart_console(&up->port))
-                       return -EBUSY;
-       }
 
        if (priv->habit & UART_ERRATA_CLOCK_DISABLE) {
                int ret;