Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1363999 > unrolled thread

[PATCH v2] tty/serial/8250: fix RS485 half-duplex RX

Started byyegorslists@googlemail.com
First post2016-03-24 09:10 +0100
Last post2016-03-31 10:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] tty/serial/8250: fix RS485 half-duplex RX yegorslists@googlemail.com - 2016-03-24 09:10 +0100
    Re: [PATCH v2] tty/serial/8250: fix RS485 half-duplex RX Yegor Yefremov <yegorslists@googlemail.com> - 2016-03-31 07:30 +0200
    Re: [PATCH v2] tty/serial/8250: fix RS485 half-duplex RX "Matwey V. Kornilov" <matwey@sai.msu.ru> - 2016-03-31 10:20 +0200

#1363999 — [PATCH v2] tty/serial/8250: fix RS485 half-duplex RX

Fromyegorslists@googlemail.com
Date2016-03-24 09:10 +0100
Subject[PATCH v2] tty/serial/8250: fix RS485 half-duplex RX
Message-ID<rg8v8-8at-21@gated-at.bofh.it>
From: Yegor Yefremov <yegorslists@googlemail.com>

When in half-duplex mode RX will be disabled before TX, but not
enabled after deactivating transmitter. This patch enables
UART_IER_RLSI and UART_IER_RDI interrupts after TX is over.

Cc: Matwey V. Kornilov <matwey@sai.msu.ru>
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Fixes: e490c9144cfa ("tty: Add software emulated RS485 support for 8250")
---
Changes:
	v2: change subject and add 'Fixes' tag

 drivers/tty/serial/8250/8250_port.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index e213da0..00ad263 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1403,9 +1403,18 @@ static void __do_stop_tx_rs485(struct uart_8250_port *p)
 	/*
 	 * Empty the RX FIFO, we are not interested in anything
 	 * received during the half-duplex transmission.
+	 * Enable previously disabled RX interrupts.
 	 */
-	if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX))
+	if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) {
 		serial8250_clear_fifos(p);
+
+		serial8250_rpm_get(p);
+
+		p->ier |= UART_IER_RLSI | UART_IER_RDI;
+		serial_port_out(&p->port, UART_IER, p->ier);
+
+		serial8250_rpm_put(p);
+	}
 }
 
 static void serial8250_em485_handle_stop_tx(unsigned long arg)
-- 
2.1.4

[toc] | [next] | [standalone]


#1367814

FromYegor Yefremov <yegorslists@googlemail.com>
Date2016-03-31 07:30 +0200
Message-ID<riDl7-5t-1@gated-at.bofh.it>
In reply to#1363999
On Thu, Mar 24, 2016 at 9:03 AM,  <yegorslists@googlemail.com> wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
>
> When in half-duplex mode RX will be disabled before TX, but not
> enabled after deactivating transmitter. This patch enables
> UART_IER_RLSI and UART_IER_RDI interrupts after TX is over.
>
> Cc: Matwey V. Kornilov <matwey@sai.msu.ru>
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> Fixes: e490c9144cfa ("tty: Add software emulated RS485 support for 8250")

Transferring from Acked-by from v1:

Acked-by: Matwey V. Kornilov <matwey@sai.msu.ru>

> ---
> Changes:
>         v2: change subject and add 'Fixes' tag
>
>  drivers/tty/serial/8250/8250_port.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index e213da0..00ad263 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -1403,9 +1403,18 @@ static void __do_stop_tx_rs485(struct uart_8250_port *p)
>         /*
>          * Empty the RX FIFO, we are not interested in anything
>          * received during the half-duplex transmission.
> +        * Enable previously disabled RX interrupts.
>          */
> -       if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX))
> +       if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) {
>                 serial8250_clear_fifos(p);
> +
> +               serial8250_rpm_get(p);
> +
> +               p->ier |= UART_IER_RLSI | UART_IER_RDI;
> +               serial_port_out(&p->port, UART_IER, p->ier);
> +
> +               serial8250_rpm_put(p);
> +       }
>  }
>
>  static void serial8250_em485_handle_stop_tx(unsigned long arg)
> --
> 2.1.4
>

[toc] | [prev] | [next] | [standalone]


#1367956

From"Matwey V. Kornilov" <matwey@sai.msu.ru>
Date2016-03-31 10:20 +0200
Message-ID<riFZF-24w-29@gated-at.bofh.it>
In reply to#1363999
2016-03-24 11:03 GMT+03:00  <yegorslists@googlemail.com>:
> From: Yegor Yefremov <yegorslists@googlemail.com>
>
> When in half-duplex mode RX will be disabled before TX, but not
> enabled after deactivating transmitter. This patch enables
> UART_IER_RLSI and UART_IER_RDI interrupts after TX is over.
>
> Cc: Matwey V. Kornilov <matwey@sai.msu.ru>
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> Fixes: e490c9144cfa ("tty: Add software emulated RS485 support for 8250")

Acked-by: Matwey V. Kornilov <matwey@sai.msu.ru>

> ---
> Changes:
>         v2: change subject and add 'Fixes' tag
>
>  drivers/tty/serial/8250/8250_port.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index e213da0..00ad263 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -1403,9 +1403,18 @@ static void __do_stop_tx_rs485(struct uart_8250_port *p)
>         /*
>          * Empty the RX FIFO, we are not interested in anything
>          * received during the half-duplex transmission.
> +        * Enable previously disabled RX interrupts.
>          */
> -       if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX))
> +       if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) {
>                 serial8250_clear_fifos(p);
> +
> +               serial8250_rpm_get(p);
> +
> +               p->ier |= UART_IER_RLSI | UART_IER_RDI;
> +               serial_port_out(&p->port, UART_IER, p->ier);
> +
> +               serial8250_rpm_put(p);
> +       }
>  }
>
>  static void serial8250_em485_handle_stop_tx(unsigned long arg)
> --
> 2.1.4
>



-- 
With best regards,
Matwey V. Kornilov.
Sternberg Astronomical Institute, Lomonosov Moscow State University, Russia
119991, Moscow, Universitetsky pr-k 13, +7 (495) 9392382

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web