lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 21 Feb 2019 18:17:52 +0100
From:   Martin Kepplinger <martin.kepplinger@...zinger.com>
To:     <gregkh@...uxfoundation.org>, <robh+dt@...nel.org>,
        <mark.rutland@....com>, <jslaby@...e.com>, <corbet@....net>,
        <richard.genoud@...il.com>, <nicolas.ferre@...rochip.com>,
        <alexandre.belloni@...tlin.com>, <ludovic.desroches@...rochip.com>,
        <mcoquelin.stm32@...il.com>, <alexandre.torgue@...com>,
        <linux-serial@...r.kernel.org>, <devicetree@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-stm32@...md-mailman.stormreply.com>
CC:     <linux-kernel@...r.kernel.org>,
        Martin Kepplinger <martin.kepplinger@...zinger.com>
Subject: [PATCH v2 3/9] serial: core: add rs485-rts-delay-us devicetree property for RS485

struct serial_rs485 now optionally holds the rts delay values in
microseconds. Users can set these delays in their devicetree descriptions,
so this adds the microseconds-option with the "rs485-rts-delay-us" boolean
property.

Signed-off-by: Martin Kepplinger <martin.kepplinger@...zinger.com>
---
 Documentation/devicetree/bindings/serial/rs485.txt |  1 +
 drivers/tty/serial/serial_core.c                   | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/serial/rs485.txt b/Documentation/devicetree/bindings/serial/rs485.txt
index b92592dff6dd..77396c62b383 100644
--- a/Documentation/devicetree/bindings/serial/rs485.txt
+++ b/Documentation/devicetree/bindings/serial/rs485.txt
@@ -12,6 +12,7 @@ Optional properties:
   * b is the delay between end of data sent and rts signal in milliseconds
       it corresponds to the delay after sending data and actual release of the line.
   If this property is not specified, <0 0> is assumed.
+- rs485-rts-delay-us: the same as rs485-rts-delay, but in microseconds.
 - rs485-rts-active-low: drive RTS low when sending (default is high).
 - linux,rs485-enabled-at-boot-time: empty property telling to enable the rs485
   feature at boot time. It can be disabled later with proper ioctl.
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 556f50aa1b58..4fb265b2c0fe 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -3097,6 +3097,17 @@ void uart_get_rs485_mode(struct device *dev, struct serial_rs485 *rs485conf)
 		rs485conf->delay_rts_after_send = 0;
 	}
 
+	ret = device_property_read_u32_array(dev, "rs485-rts-delay-us",
+					     rs485_delay, 2);
+	if (!ret) {
+		rs485conf->delay_rts_before_send = rs485_delay[0];
+		rs485conf->delay_rts_after_send = rs485_delay[1];
+		rs485conf->flags |= SER_RS485_DELAY_IN_USEC;
+	} else {
+		rs485conf->delay_rts_before_send = 0;
+		rs485conf->delay_rts_after_send = 0;
+	}
+
 	/*
 	 * Clear full-duplex and enabled flags, set RTS polarity to active high
 	 * to get to a defined state with the following properties:
-- 
2.20.1


Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (3616 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ