LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 6/9] serial: sc16is7xx: add support for rs485 RTS delays in microseconds
@ 2019-02-20 15:31 Martin Kepplinger
2019-02-20 15:31 ` [PATCH 7/9] serial: atmel_serial: set SER_RS485_DELAY_IN_USEC accordingly Martin Kepplinger
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Martin Kepplinger @ 2019-02-20 15:31 UTC (permalink / raw)
To: gregkh, robh+dt, mark.rutland, jslaby, corbet, richard.genoud,
nicolas.ferre, alexandre.belloni, ludovic.desroches,
mcoquelin.stm32, alexandre.torgue, linux-serial, devicetree,
linux-arm-kernel, linux-stm32
Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]
Read struct serial_rs485's flag SER_RS485_DELAY_IN_USEC and apply the delay
accordingly.
Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
---
drivers/tty/serial/sc16is7xx.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 635178cf3eed..b0e00b9fb177 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -743,7 +743,13 @@ static void sc16is7xx_tx_proc(struct kthread_work *ws)
struct uart_port *port = &(to_sc16is7xx_one(ws, tx_work)->port);
if ((port->rs485.flags & SER_RS485_ENABLED) &&
- (port->rs485.delay_rts_before_send > 0))
+ (port->rs485.delay_rts_before_send > 0) &&
+ (port->rs485.flags & SER_RS485_DELAY_IN_USEC))
+ usleep_range(port->rs485.delay_rts_before_send,
+ port->rs485.delay_rts_before_send);
+ else if ((port->rs485.flags & SER_RS485_ENABLED) &&
+ (port->rs485.delay_rts_before_send > 0) &&
+ !(port->rs485.flags & SER_RS485_DELAY_IN_USEC))
msleep(port->rs485.delay_rts_before_send);
sc16is7xx_handle_tx(port);
--
2.20.1
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3616 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 7/9] serial: atmel_serial: set SER_RS485_DELAY_IN_USEC accordingly
2019-02-20 15:31 [PATCH 6/9] serial: sc16is7xx: add support for rs485 RTS delays in microseconds Martin Kepplinger
@ 2019-02-20 15:31 ` Martin Kepplinger
2019-02-20 15:31 ` [PATCH 8/9] serial: fsl_lpuart: " Martin Kepplinger
2019-02-20 15:31 ` [PATCH 9/9] serial: st32-usart: " Martin Kepplinger
2 siblings, 0 replies; 4+ messages in thread
From: Martin Kepplinger @ 2019-02-20 15:31 UTC (permalink / raw)
To: gregkh, robh+dt, mark.rutland, jslaby, corbet, richard.genoud,
nicolas.ferre, alexandre.belloni, ludovic.desroches,
mcoquelin.stm32, alexandre.torgue, linux-serial, devicetree,
linux-arm-kernel, linux-stm32
Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 800 bytes --]
Unset the SER_RS485_DELAY_IN_USEC flag during rs485 config for
userspace to get the correct setting.
Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
---
drivers/tty/serial/atmel_serial.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 05147fe24343..36ab1c131d36 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -346,6 +346,9 @@ static int atmel_config_rs485(struct uart_port *port,
port->rs485 = *rs485conf;
+ /* delays are in milliseconds */
+ rs485conf->flags &= ~SER_RS485_DELAY_IN_USEC;
+
if (rs485conf->flags & SER_RS485_ENABLED) {
dev_dbg(port->dev, "Setting UART to RS485\n");
atmel_port->tx_done_mask = ATMEL_US_TXEMPTY;
--
2.20.1
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3616 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 8/9] serial: fsl_lpuart: set SER_RS485_DELAY_IN_USEC accordingly
2019-02-20 15:31 [PATCH 6/9] serial: sc16is7xx: add support for rs485 RTS delays in microseconds Martin Kepplinger
2019-02-20 15:31 ` [PATCH 7/9] serial: atmel_serial: set SER_RS485_DELAY_IN_USEC accordingly Martin Kepplinger
@ 2019-02-20 15:31 ` Martin Kepplinger
2019-02-20 15:31 ` [PATCH 9/9] serial: st32-usart: " Martin Kepplinger
2 siblings, 0 replies; 4+ messages in thread
From: Martin Kepplinger @ 2019-02-20 15:31 UTC (permalink / raw)
To: gregkh, robh+dt, mark.rutland, jslaby, corbet, richard.genoud,
nicolas.ferre, alexandre.belloni, ludovic.desroches,
mcoquelin.stm32, alexandre.torgue, linux-serial, devicetree,
linux-arm-kernel, linux-stm32
Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 736 bytes --]
Clear SER_RS485_DELAY_IN_USEC for userspace to get correct settings.
Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
---
drivers/tty/serial/fsl_lpuart.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index ea1c85e3b432..a63aa22e3a25 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1124,6 +1124,7 @@ static int lpuart_config_rs485(struct uart_port *port,
rs485->delay_rts_before_send = 0;
rs485->delay_rts_after_send = 0;
rs485->flags &= ~SER_RS485_RX_DURING_TX;
+ rs485->flags &= ~SER_RS485_DELAY_IN_USEC;
if (rs485->flags & SER_RS485_ENABLED) {
/* Enable auto RS-485 RTS mode */
--
2.20.1
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3616 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 9/9] serial: st32-usart: set SER_RS485_DELAY_IN_USEC accordingly
2019-02-20 15:31 [PATCH 6/9] serial: sc16is7xx: add support for rs485 RTS delays in microseconds Martin Kepplinger
2019-02-20 15:31 ` [PATCH 7/9] serial: atmel_serial: set SER_RS485_DELAY_IN_USEC accordingly Martin Kepplinger
2019-02-20 15:31 ` [PATCH 8/9] serial: fsl_lpuart: " Martin Kepplinger
@ 2019-02-20 15:31 ` Martin Kepplinger
2 siblings, 0 replies; 4+ messages in thread
From: Martin Kepplinger @ 2019-02-20 15:31 UTC (permalink / raw)
To: gregkh, robh+dt, mark.rutland, jslaby, corbet, richard.genoud,
nicolas.ferre, alexandre.belloni, ludovic.desroches,
mcoquelin.stm32, alexandre.torgue, linux-serial, devicetree,
linux-arm-kernel, linux-stm32
Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 673 bytes --]
Unset SER_RS485_DELAY_IN_USEC for userspace to get correct settings.
Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
---
drivers/tty/serial/stm32-usart.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index e8d7a7bb4339..4daf5fc71644 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -112,6 +112,7 @@ static int stm32_config_rs485(struct uart_port *port,
port->rs485 = *rs485conf;
+ rs485conf->flags &= ~SER_RS485_DELAY_IN_USEC;
rs485conf->flags |= SER_RS485_RX_DURING_TX;
if (rs485conf->flags & SER_RS485_ENABLED) {
--
2.20.1
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3616 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-20 15:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-20 15:31 [PATCH 6/9] serial: sc16is7xx: add support for rs485 RTS delays in microseconds Martin Kepplinger
2019-02-20 15:31 ` [PATCH 7/9] serial: atmel_serial: set SER_RS485_DELAY_IN_USEC accordingly Martin Kepplinger
2019-02-20 15:31 ` [PATCH 8/9] serial: fsl_lpuart: " Martin Kepplinger
2019-02-20 15:31 ` [PATCH 9/9] serial: st32-usart: " Martin Kepplinger
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).