serial: 8250_bcm7271: Save/restore RTS in suspend/resume
Subsystems (2)
PATCH v2 1/1 serial: 8250_bcm7271: Save/restore RTS in suspend/resume
From: Doug Berger <[email protected]>
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.
--- drivers/tty/serial/8250/8250_bcm7271.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/tty/serial/8250/8250_bcm7271.c +18 -6
@@ -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 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerQuoted 70 lines · Florian Fainelli
From: Doug Berger <[email protected]>
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 <[email protected]>Signed-off-by Florian Fainelli <[email protected]>--- drivers/tty/serial/8250/8250_bcm7271.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)drivers/tty/serial/8250/8250_bcm7271.c +18
-6@@ -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 ; }Signature · 1 line
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
Jiri Slaby
maintainerQuoted 17 lines · Florian Fainelli
From: Doug Berger <[email protected]>
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 <[email protected]>Signed-off-by Florian Fainelli <[email protected]>--- drivers/tty/serial/8250/8250_bcm7271.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)drivers/tty/serial/8250/8250_bcm7271.c +0
-0
...
drivers/tty/serial/8250/8250_bcm7271.c static int __maybe_unused brcmuart_resume(struct device *dev) · line 1193
Quoted 12 lines
drivers/tty/serial/8250/8250_bcm7271.c +7
-1@@ -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);
Calling ->set_mctrl w/o port->lock doesn't look really safe.
regards,
Signature · 2 lines
js suse labs
Quoted 19 lines · Jiri Slaby
Quoted 17 lines · Florian Fainelli
From: Doug Berger <[email protected]>
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 <[email protected]>Signed-off-by Florian Fainelli <[email protected]>---
drivers/tty/serial/8250/8250_bcm7271.c| 24 ++++++++++++++++++------1 file changed, 18 insertions(+), 6 deletions(-)drivers/tty/serial/8250/8250_bcm7271.c +0
-0...
Quoted 15 lines
drivers/tty/serial/8250/8250_bcm7271.c static int __maybe_unused · line 1194
Quoted 13 lines
drivers/tty/serial/8250/8250_bcm7271.c +7
-1@@ -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);Calling ->set_mctrl w/o
port->lockdoesn't look really safe.
Good point, I will check with Doug whether this was intentional and if so, why, and if not why should we move it up under the spinlock.
Thanks!
Signature · 1 line
Florian