tty: serial: imx: allow breaks to be received when using dma
Subsystems (2)
PATCH v3 1/1 tty: serial: imx: allow breaks to be received when using dma
This allows me to login after sending a break when service serial-getty at ttymxc0.service is running
The "tty_insert_flip_char(port, 0, TTY_BREAK)" in clear_rx_errors fixes this by allowing the higher layers to see a break.
---
v2: rebase only
v3: change commit message as requested by Fabio,
add tested-by
--- drivers/tty/serial/imx.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/tty/serial/imx.c +13 -7
@@ -927,7 +927,6 @@ static void dma_rx_callback(void *data) status =dmaengine_tx_status (chan, (dma_cookie_t )0 , &state);if (status ==DMA_ERROR ) { -dev_err (sport->port.dev,"DMA transaction error.\n" );clear_rx_errors (sport);return ; }
@@ -1028,6 +1027,7 @@ static int start_rx_dma(struct imx_port *sport)static void clear_rx_errors (struct imx_port *sport) { +struct tty_port *port = &sport->port.state->port;unsigned int status_usr1, status_usr2; status_usr1 =readl (sport->port.membase +USR1 );
@@ -1036,12 +1036,18 @@ static void clear_rx_errors(struct imx_port *sport)if (status_usr2 &USR2_BRCD ) { sport->port.icount.brk++;writel (USR2_BRCD , sport->port.membase +USR2 ); - }else if (status_usr1 &USR1_FRAMERR ) { - sport->port.icount.frame++; -writel (USR1_FRAMERR , sport->port.membase +USR1 ); - }else if (status_usr1 &USR1_PARITYERR ) { - sport->port.icount.parity++; -writel (USR1_PARITYERR , sport->port.membase +USR1 ); +if (tty_insert_flip_char (port,0 ,TTY_BREAK ) ==0 ) + sport->port.icount.buf_overrun++; +tty_flip_buffer_push (port); + }else { +dev_err (sport->port.dev,"DMA transaction error.\n" ); +if (status_usr1 &USR1_FRAMERR ) { + sport->port.icount.frame++; +writel (USR1_FRAMERR , sport->port.membase +USR1 ); + }else if (status_usr1 &USR1_PARITYERR ) { + sport->port.icount.parity++; +writel (USR1_PARITYERR , sport->port.membase +USR1 ); + } }if (status_usr2 &USR2_ORE ) {
Signature · 1 line
2.14.1
PATCH v3 1/1 tty: serial: imx: allow breaks to be received when using dma
This allows me to login after sending a break when service serial-getty at ttymxc0.service is running
The "tty_insert_flip_char(port, 0, TTY_BREAK)" in clear_rx_errors fixes this by allowing the higher layers to see a break.
---
v2: rebase only
v3: change commit message as requested by Fabio,
add tested-by
--- drivers/tty/serial/imx.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/tty/serial/imx.c +13 -7
@@ -927,7 +927,6 @@ static void dma_rx_callback(void *data) status =dmaengine_tx_status (chan, (dma_cookie_t )0 , &state);if (status ==DMA_ERROR ) { -dev_err (sport->port.dev,"DMA transaction error.\n" );clear_rx_errors (sport);return ; }
@@ -1028,6 +1027,7 @@ static int start_rx_dma(struct imx_port *sport)static void clear_rx_errors (struct imx_port *sport) { +struct tty_port *port = &sport->port.state->port;unsigned int status_usr1, status_usr2; status_usr1 =readl (sport->port.membase +USR1 );
@@ -1036,12 +1036,18 @@ static void clear_rx_errors(struct imx_port *sport)if (status_usr2 &USR2_BRCD ) { sport->port.icount.brk++;writel (USR2_BRCD , sport->port.membase +USR2 ); - }else if (status_usr1 &USR1_FRAMERR ) { - sport->port.icount.frame++; -writel (USR1_FRAMERR , sport->port.membase +USR1 ); - }else if (status_usr1 &USR1_PARITYERR ) { - sport->port.icount.parity++; -writel (USR1_PARITYERR , sport->port.membase +USR1 ); +if (tty_insert_flip_char (port,0 ,TTY_BREAK ) ==0 ) + sport->port.icount.buf_overrun++; +tty_flip_buffer_push (port); + }else { +dev_err (sport->port.dev,"DMA transaction error.\n" ); +if (status_usr1 &USR1_FRAMERR ) { + sport->port.icount.frame++; +writel (USR1_FRAMERR , sport->port.membase +USR1 ); + }else if (status_usr1 &USR1_PARITYERR ) { + sport->port.icount.parity++; +writel (USR1_PARITYERR , sport->port.membase +USR1 ); + } }if (status_usr2 &USR2_ORE ) {
Signature · 1 line
2.14.1
Fabio Estevam
reviewerPATCH v3 1/1 tty: serial: imx: allow breaks to be received when using dma
In reply to Troy KiskyQuoted 8 lines · Troy Kisky
This allows me to login after sending a break when service serial-getty at ttymxc0.service is running
The "
tty_insert_flip_char(port, 0, TTY_BREAK)" inclear_rx_errorsfixes this by allowing the higher layers to see a break.Signed-off-by Troy Kisky <[email protected]>Tested-by Martin Hicks <[email protected]>
PATCH v3 1/1 tty: serial: imx: allow breaks to be received when using dma
In reply to Troy KiskyQuoted 40 lines · Troy Kisky
This allows me to login after sending a break when service serial-getty at ttymxc0.service is running
The "
tty_insert_flip_char(port, 0, TTY_BREAK)" inclear_rx_errorsfixes this by allowing the higher layers to see a break.Signed-off-by Troy Kisky <[email protected]>Tested-by Martin Hicks <[email protected]>---
v2: rebase only
v3: change commit message as requested by Fabio,
add tested-by--- drivers/tty/serial/imx.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)drivers/tty/serial/imx.c +1
-1@@ -927,7 +927,6 @@ static void dma_rx_callback(void *data) status =dmaengine_tx_status (chan, (dma_cookie_t )0 , &state);if (status ==DMA_ERROR ) { -dev_err (sport->port.dev,"DMA transaction error.\n" );clear_rx_errors (sport);return ; }@@ -1028,6 +1027,7 @@ static int start_rx_dma(struct imx_port *sport)static void clear_rx_errors (struct imx_port *sport) { +struct tty_port *port = &sport->port.state->port;unsigned int status_usr1, status_usr2; status_usr1 =readl (sport->port.membase +USR1 );@@ -1036,12 +1036,18 @@ static void clear_rx_errors(struct imx_port *sport)if (status_usr2 &USR2_BRCD ) { sport->port.icount.brk++;
drivers/tty/serial/imx.c static void clear_rx_errors(struct imx_port *sport) · line 1041
Quoted 10 lines
drivers/tty/serial/imx.c +3
-6writel (USR2_BRCD , sport->port.membase +USR2 ); - }else if (status_usr1 &USR1_FRAMERR ) { - sport->port.icount.frame++; -writel (USR1_FRAMERR , sport->port.membase +USR1 ); - }else if (status_usr1 &USR1_PARITYERR ) { - sport->port.icount.parity++; -writel (USR1_PARITYERR , sport->port.membase +USR1 ); +if (tty_insert_flip_char (port,0 ,TTY_BREAK ) ==0 ) + sport->port.icount.buf_overrun++; +tty_flip_buffer_push (port);
I think this needs to call uart_handle_break() as imx_rxint() does. Not sure how to properly handle SYSRQ in the dma case though.
Quoted 16 lines
drivers/tty/serial/imx.c +9
-0+ }else { +dev_err (sport->port.dev,"DMA transaction error.\n" ); +if (status_usr1 &USR1_FRAMERR ) { + sport->port.icount.frame++; +writel (USR1_FRAMERR , sport->port.membase +USR1 ); + }else if (status_usr1 &USR1_PARITYERR ) { + sport->port.icount.parity++; +writel (USR1_PARITYERR , sport->port.membase +USR1 ); + } }if (status_usr2 &USR2_ORE ) {Signature · 1 line
2.14.1
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH v3 1/1 tty: serial: imx: allow breaks to be received when using dma
Quoted 46 lines · Uwe Kleine-K?nig
Quoted 45 lines · Troy Kisky
This allows me to login after sending a break when service serial-getty at ttymxc0.service is running
The "
tty_insert_flip_char(port, 0, TTY_BREAK)" inclear_rx_errorsfixes this by allowing the higher layers to see a break.Signed-off-by Troy Kisky <[email protected]>Tested-by Martin Hicks <[email protected]>---
v2: rebase only
v3: change commit message as requested by Fabio,
add tested-by--- drivers/tty/serial/imx.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)drivers/tty/serial/imx.c +1
-5@@ -927,7 +927,6 @@ static void dma_rx_callback(void *data) status =dmaengine_tx_status (chan, (dma_cookie_t )0 , &state);if (status ==DMA_ERROR ) { -dev_err (sport->port.dev,"DMA transaction error.\n" );clear_rx_errors (sport);return ; }@@ -1028,6 +1027,7 @@ static int start_rx_dma(struct imx_port *sport)static void clear_rx_errors (struct imx_port *sport) { +struct tty_port *port = &sport->port.state->port;unsigned int status_usr1, status_usr2; status_usr1 =readl (sport->port.membase +USR1 );@@ -1036,12 +1036,18 @@ static void clear_rx_errors(struct imx_port *sport)if (status_usr2 &USR2_BRCD ) { sport->port.icount.brk++;writel (USR2_BRCD , sport->port.membase +USR2 ); - }else if (status_usr1 &USR1_FRAMERR ) { - sport->port.icount.frame++; -writel (USR1_FRAMERR , sport->port.membase +USR1 ); - }else if (status_usr1 &USR1_PARITYERR ) {
Quoted 9 lines
drivers/tty/serial/imx.c static void clear_rx_errors(struct imx_port *sport) · line 1041
Quoted 5 lines
drivers/tty/serial/imx.c +3
-2- sport->port.icount.parity++; -writel (USR1_PARITYERR , sport->port.membase +USR1 ); +if (tty_insert_flip_char (port,0 ,TTY_BREAK ) ==0 ) + sport->port.icount.buf_overrun++; +tty_flip_buffer_push (port);I think this needs to call
uart_handle_break()asimx_rxint()does. Not sure how to properly handle SYSRQ in the dma case though.
SYSRQ is only for the console port, and console port is never dma. But UPF_SAK may be an issue. I don't know enough about "Secure Attention Key" to say.
Should I add uart_handle_break anyway ?
Quoted 17 lines
Quoted 16 lines
drivers/tty/serial/imx.c +9
-0+ }else { +dev_err (sport->port.dev,"DMA transaction error.\n" ); +if (status_usr1 &USR1_FRAMERR ) { + sport->port.icount.frame++; +writel (USR1_FRAMERR , sport->port.membase +USR1 ); + }else if (status_usr1 &USR1_PARITYERR ) { + sport->port.icount.parity++; +writel (USR1_PARITYERR , sport->port.membase +USR1 ); + } }if (status_usr2 &USR2_ORE ) {Signature · 1 line
2.14.1
PATCH v3 1/1 tty: serial: imx: allow breaks to be received when using dma
Hello Troy,
Quoted 27 lines · Troy Kisky
Quoted 16 lines
Quoted 16 lines
drivers/tty/serial/imx.c +1
-4@@ -1028,6 +1027,7 @@ static int start_rx_dma(struct imx_port *sport)static void clear_rx_errors (struct imx_port *sport) { +struct tty_port *port = &sport->port.state->port;unsigned int status_usr1, status_usr2; status_usr1 =readl (sport->port.membase +USR1 );@@ -1036,12 +1036,18 @@ static void clear_rx_errors(struct imx_port *sport)if (status_usr2 &USR2_BRCD ) { sport->port.icount.brk++;writel (USR2_BRCD , sport->port.membase +USR2 ); - }else if (status_usr1 &USR1_FRAMERR ) { - sport->port.icount.frame++; -writel (USR1_FRAMERR , sport->port.membase +USR1 ); - }else if (status_usr1 &USR1_PARITYERR ) {Quoted 9 lines
drivers/tty/serial/imx.c static void clear_rx_errors(struct imx_port *sport) · line 1041
Quoted 5 lines
drivers/tty/serial/imx.c +3
-2- sport->port.icount.parity++; -writel (USR1_PARITYERR , sport->port.membase +USR1 ); +if (tty_insert_flip_char (port,0 ,TTY_BREAK ) ==0 ) + sport->port.icount.buf_overrun++; +tty_flip_buffer_push (port);I think this needs to call
uart_handle_break()asimx_rxint()does. Not sure how to properly handle SYSRQ in the dma case though.
Quoted 5 lines
SYSRQ is only for the console port, and console port is never dma. But
UPF_SAKmay be an issue. I don't know enough about "Secure Attention Key" to say.Should I add
uart_handle_breakanyway ?
You're right about both SYSRQ and SAK. I think uart_handle_break is the right one for the latter.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |