* [PATCH 1/1] tty: serial: imx: allow breaks to be received when using dma
@ 2017-10-20 22:13 ` Troy Kisky
0 siblings, 0 replies; 6+ messages in thread
From: Troy Kisky @ 2017-10-20 22:13 UTC (permalink / raw)
To: gregkh, nandor.han
Cc: Troy Kisky, linux-serial, u.kleine-koenig, fabio.estevam,
linux-arm-kernel, l.stach
This allows me to login after sending a break when service
serial-getty@ttymxc0.service is running
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
---
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 506fcd742b47..39033f460a24 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -934,7 +934,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;
}
@@ -1035,6 +1034,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);
@@ -1043,12 +1043,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.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 1/1] tty: serial: imx: allow breaks to be received when using dma
@ 2017-10-20 22:13 ` Troy Kisky
0 siblings, 0 replies; 6+ messages in thread
From: Troy Kisky @ 2017-10-20 22:13 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
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
---
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 506fcd742b47..39033f460a24 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -934,7 +934,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;
}
@@ -1035,6 +1034,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);
@@ -1043,12 +1043,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.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] tty: serial: imx: allow breaks to be received when using dma
2017-10-20 22:13 ` Troy Kisky
@ 2017-10-20 22:17 ` Troy Kisky
-1 siblings, 0 replies; 6+ messages in thread
From: Troy Kisky @ 2017-10-20 22:17 UTC (permalink / raw)
To: gregkh, nandor.han
Cc: fabio.estevam, l.stach, linux-arm-kernel, linux-serial, u.kleine-koenig
On 10/20/2017 3:13 PM, Troy Kisky wrote:
> This allows me to login after sending a break when service
> serial-getty@ttymxc0.service is running
>
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> ---
> 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 506fcd742b47..39033f460a24 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -934,7 +934,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;
> }
> @@ -1035,6 +1034,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);
> @@ -1043,12 +1043,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) {
>
Does this need to use
spin_lock_irqsave(&sport->port.lock, flags);
I would have, but dma_rx_callback doesn't.
BR
Troy
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/1] tty: serial: imx: allow breaks to be received when using dma
@ 2017-10-20 22:17 ` Troy Kisky
0 siblings, 0 replies; 6+ messages in thread
From: Troy Kisky @ 2017-10-20 22:17 UTC (permalink / raw)
To: linux-arm-kernel
On 10/20/2017 3:13 PM, Troy Kisky wrote:
> This allows me to login after sending a break when service
> serial-getty at ttymxc0.service is running
>
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> ---
> 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 506fcd742b47..39033f460a24 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -934,7 +934,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;
> }
> @@ -1035,6 +1034,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);
> @@ -1043,12 +1043,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) {
>
Does this need to use
spin_lock_irqsave(&sport->port.lock, flags);
I would have, but dma_rx_callback doesn't.
BR
Troy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] tty: serial: imx: allow breaks to be received when using dma
2017-10-20 22:17 ` Troy Kisky
@ 2017-12-11 20:52 ` Troy Kisky
-1 siblings, 0 replies; 6+ messages in thread
From: Troy Kisky @ 2017-12-11 20:52 UTC (permalink / raw)
To: gregkh, nandor.han
Cc: linux-serial, u.kleine-koenig, fabio.estevam, linux-arm-kernel, l.stach
On 10/20/2017 3:17 PM, Troy Kisky wrote:
> On 10/20/2017 3:13 PM, Troy Kisky wrote:
>> This allows me to login after sending a break when service
>> serial-getty@ttymxc0.service is running
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>> ---
>> 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 506fcd742b47..39033f460a24 100644
>> --- a/drivers/tty/serial/imx.c
>> +++ b/drivers/tty/serial/imx.c
>> @@ -934,7 +934,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;
>> }
>> @@ -1035,6 +1034,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);
>> @@ -1043,12 +1043,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) {
>>
>
>
>
> Does this need to use
> spin_lock_irqsave(&sport->port.lock, flags);
>
>
> I would have, but dma_rx_callback doesn't.
>
> BR
> Troy
>
>
I think the path is fine as is. Should I send a rebased version ?
Thanks
Troy
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/1] tty: serial: imx: allow breaks to be received when using dma
@ 2017-12-11 20:52 ` Troy Kisky
0 siblings, 0 replies; 6+ messages in thread
From: Troy Kisky @ 2017-12-11 20:52 UTC (permalink / raw)
To: linux-arm-kernel
On 10/20/2017 3:17 PM, Troy Kisky wrote:
> On 10/20/2017 3:13 PM, Troy Kisky wrote:
>> This allows me to login after sending a break when service
>> serial-getty at ttymxc0.service is running
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>> ---
>> 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 506fcd742b47..39033f460a24 100644
>> --- a/drivers/tty/serial/imx.c
>> +++ b/drivers/tty/serial/imx.c
>> @@ -934,7 +934,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;
>> }
>> @@ -1035,6 +1034,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);
>> @@ -1043,12 +1043,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) {
>>
>
>
>
> Does this need to use
> spin_lock_irqsave(&sport->port.lock, flags);
>
>
> I would have, but dma_rx_callback doesn't.
>
> BR
> Troy
>
>
I think the path is fine as is. Should I send a rebased version ?
Thanks
Troy
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-12-11 20:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-20 22:13 [PATCH 1/1] tty: serial: imx: allow breaks to be received when using dma Troy Kisky
2017-10-20 22:13 ` Troy Kisky
2017-10-20 22:17 ` Troy Kisky
2017-10-20 22:17 ` Troy Kisky
2017-12-11 20:52 ` Troy Kisky
2017-12-11 20:52 ` Troy Kisky
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.