Re: [PATCH v2] serial: 8250_bcm7271: Save/restore RTS in suspend/resume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 29, 2022 at 09:02:08AM -0700, Florian Fainelli wrote:
> From: Doug Berger <opendmb@xxxxxxxxx>
> 
> Commit 9cabe26e65a8 ("serial: 8250_bcm7271: UART errors after resuming
> from S2") prevented an early enabling of RTS during resume, but it did
> not actively restore the RTS state after resume.
> 
> Fixes: 9cabe26e65a8 ("serial: 8250_bcm7271: UART errors after resuming from S2")
> Signed-off-by: Doug Berger <opendmb@xxxxxxxxx>
> Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
> ---
>  drivers/tty/serial/8250/8250_bcm7271.c | 24 ++++++++++++++++++------
>  1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c
> index 9b878d023dac..b9cea38c8aff 100644
> --- a/drivers/tty/serial/8250/8250_bcm7271.c
> +++ b/drivers/tty/serial/8250/8250_bcm7271.c
> @@ -1139,16 +1139,19 @@ static int __maybe_unused brcmuart_suspend(struct device *dev)
>  	struct brcmuart_priv *priv = dev_get_drvdata(dev);
>  	struct uart_8250_port *up = serial8250_get_port(priv->line);
>  	struct uart_port *port = &up->port;
> -
> -	serial8250_suspend_port(priv->line);
> -	clk_disable_unprepare(priv->baud_mux_clk);
> +	unsigned long flags;
>  
>  	/*
>  	 * This will prevent resume from enabling RTS before the
> -	 *  baud rate has been resored.
> +	 *  baud rate has been restored.
>  	 */
> +	spin_lock_irqsave(&port->lock, flags);
>  	priv->saved_mctrl = port->mctrl;
> -	port->mctrl = 0;
> +	port->mctrl &= ~TIOCM_RTS;
> +	spin_unlock_irqrestore(&port->lock, flags);
> +
> +	serial8250_suspend_port(priv->line);
> +	clk_disable_unprepare(priv->baud_mux_clk);
>  
>  	return 0;
>  }
> @@ -1158,6 +1161,7 @@ static int __maybe_unused brcmuart_resume(struct device *dev)
>  	struct brcmuart_priv *priv = dev_get_drvdata(dev);
>  	struct uart_8250_port *up = serial8250_get_port(priv->line);
>  	struct uart_port *port = &up->port;
> +	unsigned long flags;
>  	int ret;
>  
>  	ret = clk_prepare_enable(priv->baud_mux_clk);
> @@ -1180,7 +1184,15 @@ static int __maybe_unused brcmuart_resume(struct device *dev)
>  		start_rx_dma(serial8250_get_port(priv->line));
>  	}
>  	serial8250_resume_port(priv->line);
> -	port->mctrl = priv->saved_mctrl;
> +
> +	if (priv->saved_mctrl & TIOCM_RTS) {
> +		/* Restore RTS */
> +		spin_lock_irqsave(&port->lock, flags);
> +		port->mctrl |= TIOCM_RTS;
> +		spin_unlock_irqrestore(&port->lock, flags);
> +		port->ops->set_mctrl(port, port->mctrl);
> +	}
> +
>  	return 0;
>  }
>  
> -- 
> 2.25.1
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/SubmittingPatches for what needs to be done
  here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux