Re: [RFC PATCH] tty: serial: msm_serial: Don't reset uart on set_termios

2016-06-15 Thread Stephen Boyd
On 06/13/2016 12:02 PM, Bjorn Andersson wrote:
> Upon opening the tty, uart_open() ends up calling msm_set_baud_rate()
> which resets the uart block. If this happens as we're coming out of
> msm_console_write() a full fifo worth of console output will be
> discarded.
>
> Cc: Stephen Boyd 
> Signed-off-by: Bjorn Andersson 
> ---
>
> As reported here:
> https://bugs.96boards.org/show_bug.cgi?id=378

Urgh. As mentioned in commit a12f1b406f2d (tty: serial: msm: Reset
uartdm after baud rate change, 2014-10-29) we actually need to reset the
hardware sometimes. Perhaps as discussed over IRC we need to take a
different approach here and only reset the hardware if the baud actually
changes? One way to test this would be to try running a getty on the
console and see if input still works.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project



Re: [RFC PATCH] tty: serial: msm_serial: Don't reset uart on set_termios

2016-06-15 Thread Stephen Boyd
On 06/13/2016 12:02 PM, Bjorn Andersson wrote:
> Upon opening the tty, uart_open() ends up calling msm_set_baud_rate()
> which resets the uart block. If this happens as we're coming out of
> msm_console_write() a full fifo worth of console output will be
> discarded.
>
> Cc: Stephen Boyd 
> Signed-off-by: Bjorn Andersson 
> ---
>
> As reported here:
> https://bugs.96boards.org/show_bug.cgi?id=378

Urgh. As mentioned in commit a12f1b406f2d (tty: serial: msm: Reset
uartdm after baud rate change, 2014-10-29) we actually need to reset the
hardware sometimes. Perhaps as discussed over IRC we need to take a
different approach here and only reset the hardware if the baud actually
changes? One way to test this would be to try running a getty on the
console and see if input still works.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project



Re: [RFC PATCH] tty: serial: msm_serial: Don't reset uart on set_termios

2016-06-15 Thread Pramod Gurav
On 14 June 2016 at 00:32, Bjorn Andersson  wrote:
> Upon opening the tty, uart_open() ends up calling msm_set_baud_rate()
> which resets the uart block. If this happens as we're coming out of
> msm_console_write() a full fifo worth of console output will be
> discarded.
>
> Cc: Stephen Boyd 
> Signed-off-by: Bjorn Andersson 
> ---
>
> As reported here:
> https://bugs.96boards.org/show_bug.cgi?id=378
>
>  drivers/tty/serial/msm_serial.c | 18 --
>  1 file changed, 18 deletions(-)

Thanks for the patch.

I no longer see these corruptions with this patch. This is what I used
to see on my DB410C with debain FS:
http://paste.ubuntu.com/17319106/

Tested-by: Pramod Gurav 

Regards,
Pramod


Re: [RFC PATCH] tty: serial: msm_serial: Don't reset uart on set_termios

2016-06-15 Thread Pramod Gurav
On 14 June 2016 at 00:32, Bjorn Andersson  wrote:
> Upon opening the tty, uart_open() ends up calling msm_set_baud_rate()
> which resets the uart block. If this happens as we're coming out of
> msm_console_write() a full fifo worth of console output will be
> discarded.
>
> Cc: Stephen Boyd 
> Signed-off-by: Bjorn Andersson 
> ---
>
> As reported here:
> https://bugs.96boards.org/show_bug.cgi?id=378
>
>  drivers/tty/serial/msm_serial.c | 18 --
>  1 file changed, 18 deletions(-)

Thanks for the patch.

I no longer see these corruptions with this patch. This is what I used
to see on my DB410C with debain FS:
http://paste.ubuntu.com/17319106/

Tested-by: Pramod Gurav 

Regards,
Pramod


[RFC PATCH] tty: serial: msm_serial: Don't reset uart on set_termios

2016-06-13 Thread Bjorn Andersson
Upon opening the tty, uart_open() ends up calling msm_set_baud_rate()
which resets the uart block. If this happens as we're coming out of
msm_console_write() a full fifo worth of console output will be
discarded.

Cc: Stephen Boyd 
Signed-off-by: Bjorn Andersson 
---

As reported here:
https://bugs.96boards.org/show_bug.cgi?id=378

 drivers/tty/serial/msm_serial.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index b7d80bd57db9..93a10ac44933 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -813,23 +813,6 @@ static unsigned int msm_get_mctrl(struct uart_port *port)
return TIOCM_CAR | TIOCM_CTS | TIOCM_DSR | TIOCM_RTS;
 }
 
-static void msm_reset(struct uart_port *port)
-{
-   struct msm_port *msm_port = UART_TO_MSM(port);
-
-   /* reset everything */
-   msm_write(port, UART_CR_CMD_RESET_RX, UART_CR);
-   msm_write(port, UART_CR_CMD_RESET_TX, UART_CR);
-   msm_write(port, UART_CR_CMD_RESET_ERR, UART_CR);
-   msm_write(port, UART_CR_CMD_RESET_BREAK_INT, UART_CR);
-   msm_write(port, UART_CR_CMD_RESET_CTS, UART_CR);
-   msm_write(port, UART_CR_CMD_SET_RFR, UART_CR);
-
-   /* Disable DM modes */
-   if (msm_port->is_uartdm)
-   msm_write(port, 0, UARTDM_DMEN);
-}
-
 static void msm_set_mctrl(struct uart_port *port, unsigned int mctrl)
 {
unsigned int mr;
@@ -972,7 +955,6 @@ static int msm_set_baud_rate(struct uart_port *port, 
unsigned int baud,
msm_write(port, 10, UART_TFWR);
 
msm_write(port, UART_CR_CMD_PROTECTION_EN, UART_CR);
-   msm_reset(port);
 
/* Enable RX and TX */
msm_write(port, UART_CR_TX_ENABLE | UART_CR_RX_ENABLE, UART_CR);
-- 
2.5.0



[RFC PATCH] tty: serial: msm_serial: Don't reset uart on set_termios

2016-06-13 Thread Bjorn Andersson
Upon opening the tty, uart_open() ends up calling msm_set_baud_rate()
which resets the uart block. If this happens as we're coming out of
msm_console_write() a full fifo worth of console output will be
discarded.

Cc: Stephen Boyd 
Signed-off-by: Bjorn Andersson 
---

As reported here:
https://bugs.96boards.org/show_bug.cgi?id=378

 drivers/tty/serial/msm_serial.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index b7d80bd57db9..93a10ac44933 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -813,23 +813,6 @@ static unsigned int msm_get_mctrl(struct uart_port *port)
return TIOCM_CAR | TIOCM_CTS | TIOCM_DSR | TIOCM_RTS;
 }
 
-static void msm_reset(struct uart_port *port)
-{
-   struct msm_port *msm_port = UART_TO_MSM(port);
-
-   /* reset everything */
-   msm_write(port, UART_CR_CMD_RESET_RX, UART_CR);
-   msm_write(port, UART_CR_CMD_RESET_TX, UART_CR);
-   msm_write(port, UART_CR_CMD_RESET_ERR, UART_CR);
-   msm_write(port, UART_CR_CMD_RESET_BREAK_INT, UART_CR);
-   msm_write(port, UART_CR_CMD_RESET_CTS, UART_CR);
-   msm_write(port, UART_CR_CMD_SET_RFR, UART_CR);
-
-   /* Disable DM modes */
-   if (msm_port->is_uartdm)
-   msm_write(port, 0, UARTDM_DMEN);
-}
-
 static void msm_set_mctrl(struct uart_port *port, unsigned int mctrl)
 {
unsigned int mr;
@@ -972,7 +955,6 @@ static int msm_set_baud_rate(struct uart_port *port, 
unsigned int baud,
msm_write(port, 10, UART_TFWR);
 
msm_write(port, UART_CR_CMD_PROTECTION_EN, UART_CR);
-   msm_reset(port);
 
/* Enable RX and TX */
msm_write(port, UART_CR_TX_ENABLE | UART_CR_RX_ENABLE, UART_CR);
-- 
2.5.0