* [PATCH v3 1/1] tty: serial: imx: allow breaks to be received when using dma
@ 2018-02-20 18:20 Troy Kisky
2018-02-20 18:20 ` Troy Kisky
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Troy Kisky @ 2018-02-20 18:20 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Tested-by: Martin Hicks <mort@bork.org>
---
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(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 1d7ca382bc12..2eb8c4a20d68 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -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) {
--
2.14.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 1/1] tty: serial: imx: allow breaks to be received when using dma
2018-02-20 18:20 [PATCH v3 1/1] tty: serial: imx: allow breaks to be received when using dma Troy Kisky
@ 2018-02-20 18:20 ` Troy Kisky
2018-02-20 18:25 ` Fabio Estevam
2018-02-20 19:59 ` Uwe Kleine-König
2 siblings, 0 replies; 6+ messages in thread
From: Troy Kisky @ 2018-02-20 18:20 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Tested-by: Martin Hicks <mort@bork.org>
---
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(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 1d7ca382bc12..2eb8c4a20d68 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -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) {
--
2.14.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 1/1] tty: serial: imx: allow breaks to be received when using dma
2018-02-20 18:20 [PATCH v3 1/1] tty: serial: imx: allow breaks to be received when using dma Troy Kisky
2018-02-20 18:20 ` Troy Kisky
@ 2018-02-20 18:25 ` Fabio Estevam
2018-02-20 19:59 ` Uwe Kleine-König
2 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2018-02-20 18:25 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Feb 20, 2018 at 3:20 PM, Troy Kisky
<troy.kisky@boundarydevices.com> wrote:
> 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.
>
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> Tested-by: Martin Hicks <mort@bork.org>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/1] tty: serial: imx: allow breaks to be received when using dma
2018-02-20 18:20 [PATCH v3 1/1] tty: serial: imx: allow breaks to be received when using dma Troy Kisky
2018-02-20 18:20 ` Troy Kisky
2018-02-20 18:25 ` Fabio Estevam
@ 2018-02-20 19:59 ` Uwe Kleine-König
2018-02-20 20:25 ` Troy Kisky
2 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2018-02-20 19:59 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Feb 20, 2018 at 10:20:37AM -0800, Troy Kisky wrote:
> 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.
>
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> Tested-by: Martin Hicks <mort@bork.org>
>
> ---
> 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(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 1d7ca382bc12..2eb8c4a20d68 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -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);
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.
> + } 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) {
> --
> 2.14.1
>
>
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/1] tty: serial: imx: allow breaks to be received when using dma
2018-02-20 19:59 ` Uwe Kleine-König
@ 2018-02-20 20:25 ` Troy Kisky
2018-02-21 8:17 ` Uwe Kleine-König
0 siblings, 1 reply; 6+ messages in thread
From: Troy Kisky @ 2018-02-20 20:25 UTC (permalink / raw)
To: linux-arm-kernel
On 2/20/2018 11:59 AM, Uwe Kleine-K?nig wrote:
> On Tue, Feb 20, 2018 at 10:20:37AM -0800, Troy Kisky wrote:
>> 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.
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>> Tested-by: Martin Hicks <mort@bork.org>
>>
>> ---
>> 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(-)
>>
>> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
>> index 1d7ca382bc12..2eb8c4a20d68 100644
>> --- a/drivers/tty/serial/imx.c
>> +++ b/drivers/tty/serial/imx.c
>> @@ -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);
>
> 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.
>
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 ?
>> + } 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) {
>> --
>> 2.14.1
>>
>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/1] tty: serial: imx: allow breaks to be received when using dma
2018-02-20 20:25 ` Troy Kisky
@ 2018-02-21 8:17 ` Uwe Kleine-König
0 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2018-02-21 8:17 UTC (permalink / raw)
To: linux-arm-kernel
Hello Troy,
On Tue, Feb 20, 2018 at 12:25:16PM -0800, Troy Kisky wrote:
> >> @@ -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);
> >
> > 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.
> >
>
>
> 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 ?
You're right about both SYSRQ and SAK. I think uart_handle_break is the
right one for the latter.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-02-21 8:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-20 18:20 [PATCH v3 1/1] tty: serial: imx: allow breaks to be received when using dma Troy Kisky
2018-02-20 18:20 ` Troy Kisky
2018-02-20 18:25 ` Fabio Estevam
2018-02-20 19:59 ` Uwe Kleine-König
2018-02-20 20:25 ` Troy Kisky
2018-02-21 8:17 ` Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).