Hi,
Here are two more cleanup patches for imx-serial. Both
issues were found by code reading, no real-world issues
are known.
-- Sebastian
Sebastian Reichel (2):
serial: imx: drop CTS/RTS handling from shutdown
serial: imx: disable UCR4_OREN on shutdown
drivers/tty/serial/imx.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--
2.17.0
According to Documentation/serial/driver the shutdown function should
not disable RTS, so drop it.
Suggested-by: Uwe Kleine-König <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/tty/serial/imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 6c53e74244ec..a0fc0327c8a5 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1450,7 +1450,7 @@ static void imx_uart_shutdown(struct uart_port *port)
spin_lock_irqsave(&sport->port.lock, flags);
ucr2 = imx_uart_readl(sport, UCR2);
- ucr2 &= ~(UCR2_TXEN | UCR2_CTSC | UCR2_CTS | UCR2_ATEN);
+ ucr2 &= ~(UCR2_TXEN | UCR2_ATEN);
imx_uart_writel(sport, ucr2, UCR2);
spin_unlock_irqrestore(&sport->port.lock, flags);
--
2.17.0
On Thu, May 24, 2018 at 07:30:24PM +0200, Sebastian Reichel wrote:
> UCR4_OREN is (depending on the configuration) enabled in startup,
> but is never disabled. Fix this by disabling it in shutdown.
>
> Reported-by: Nandor Han <[email protected]>
> Signed-off-by: Sebastian Reichel <[email protected]>
> ---
> drivers/tty/serial/imx.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index a0fc0327c8a5..31e1df8a8d29 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -1422,7 +1422,7 @@ static void imx_uart_shutdown(struct uart_port *port)
> {
> struct imx_port *sport = (struct imx_port *)port;
> unsigned long flags;
> - u32 ucr1, ucr2;
> + u32 ucr1, ucr2, ucr4;
>
> if (sport->dma_is_enabled) {
> dmaengine_terminate_sync(sport->dma_chan_tx);
> @@ -1452,6 +1452,10 @@ static void imx_uart_shutdown(struct uart_port *port)
> ucr2 = imx_uart_readl(sport, UCR2);
> ucr2 &= ~(UCR2_TXEN | UCR2_ATEN);
> imx_uart_writel(sport, ucr2, UCR2);
> +
> + ucr4 = imx_uart_readl(sport, UCR4);
> + ucr4 &= ~UCR4_OREN;
> + imx_uart_writel(sport, ucr4, UCR4);
Not sure this is necessary, but I assume it cannot hurt either, so
Acked-by: Uwe Kleine-K?nig <[email protected]>
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
UCR4_OREN is (depending on the configuration) enabled in startup,
but is never disabled. Fix this by disabling it in shutdown.
Reported-by: Nandor Han <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/tty/serial/imx.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index a0fc0327c8a5..31e1df8a8d29 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1422,7 +1422,7 @@ static void imx_uart_shutdown(struct uart_port *port)
{
struct imx_port *sport = (struct imx_port *)port;
unsigned long flags;
- u32 ucr1, ucr2;
+ u32 ucr1, ucr2, ucr4;
if (sport->dma_is_enabled) {
dmaengine_terminate_sync(sport->dma_chan_tx);
@@ -1452,6 +1452,10 @@ static void imx_uart_shutdown(struct uart_port *port)
ucr2 = imx_uart_readl(sport, UCR2);
ucr2 &= ~(UCR2_TXEN | UCR2_ATEN);
imx_uart_writel(sport, ucr2, UCR2);
+
+ ucr4 = imx_uart_readl(sport, UCR4);
+ ucr4 &= ~UCR4_OREN;
+ imx_uart_writel(sport, ucr4, UCR4);
spin_unlock_irqrestore(&sport->port.lock, flags);
/*
--
2.17.0
On Thu, May 24, 2018 at 07:30:23PM +0200, Sebastian Reichel wrote:
> According to Documentation/serial/driver the shutdown function should
> not disable RTS, so drop it.
>
> Suggested-by: Uwe Kleine-K?nig <[email protected]>
Great idea! :-)
Acked-by: Uwe Kleine-K?nig <[email protected]>
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |