From patchwork Wed Feb 20 15:27:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10822365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEC976C2 for ; Wed, 20 Feb 2019 15:28:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B47EE2E721 for ; Wed, 20 Feb 2019 15:28:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A83CD2E835; Wed, 20 Feb 2019 15:28:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4C05F2E721 for ; Wed, 20 Feb 2019 15:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Date:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=OVe0C8CN/ngUwlnwSw7jj9D53VX+sSDDJw/ZFyvbWMY=; b=b5n ZGud7s0jm6GkNOwjpBopmeGpeMj+4qo1emnDcK5yQux5XxALEQXn6nYmNbA40s5kaWokhyI+0lixK afpuvFJpHg0gVzEdM1Df925Bpjl5LjdscyDPYYsjVvpEbuix2iMQv5du2biKh4v+QozNHIZchUbQp s0fd0NvKGNlFUpc6c+10nbOEjp6sLDPWWDxmrZ2fSK07fWlGUlcYyg1HDmoU3LbNPnb9lVwpFwWhy XnyJuC8x8A4hf+P4L3UY7BTP8CPuczRFi/lK+H+SYQzL/R5y1mSjaI3DVN8zrFmVk2pZ2cmSWStkI IDqlwPvM/zTP1iEevI8jtL+jzc0Nxlg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTnL-0002A8-FS; Wed, 20 Feb 2019 15:28:23 +0000 Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTn7-0001uy-FB for linux-arm-kernel@lists.infradead.org; Wed, 20 Feb 2019 15:28:12 +0000 Received: from [31.193.165.228] (port=49448 helo=mx-ginzinger.sigmacloud.services) by mx-ginzinger.sigmacloud.services with esmtps (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1gwTmt-0003bL-0p; Wed, 20 Feb 2019 16:27:55 +0100 Received: from martin-laptop.buero.ginzinger.com (10.10.1.120) by exc1.buero.ginzinger.com (10.1.1.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Wed, 20 Feb 2019 16:27:54 +0100 X-CTCH-RefID: str=0001.0A0B020A.5C6D71FB.003F, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH 1/9] serial: uapi: add SER_RS485_DELAY_IN_USEC flag to struct serial_rs485 Date: Wed, 20 Feb 2019 16:27:23 +0100 Message-ID: <20190220152731.4051-1-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 X-Originating-IP: [10.10.1.120] X-ClientProxiedBy: exc1.buero.ginzinger.com (10.1.1.204) To exc1.buero.ginzinger.com (10.1.1.204) X-EXCLAIMER-MD-ORIGINAL-SUBJECT: [NOSIG][NODISC][PATCH 1/9] serial: uapi: add SER_RS485_DELAY_IN_USEC flag to struct serial_rs485 X-EXCLAIMER-MD-CONFIG: 9dd172f7-de2e-4231-b886-ec11f46e03b3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190220_072809_662099_3D1757F6 X-CRM114-Status: GOOD ( 19.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This extends the user interface for rs485 communication: We add a new flag, SER_RS485_DELAY_IN_USEC, to struct serial_rs485 that indicates that delay_rts_before_send and delay_rts_after_send values are interpreted in microsecond units. Up until now, the code comment defined these values to hold the delays in millisecond units. Especially with fast data rates (1Mbaut or more) that are not too uncommon for RS485, 1ms become quite long. Users need to be able to set shorter delays than 1 ms in order not to slow down the channel unnecessarily. So when delays are needed, but not as long as 1ms, this enables faster communication channels without changing the baudrate. Signed-off-by: Martin Kepplinger --- Hi, We have this totally quirky patch that uses udelay() in our tree for a looong time now because of the above reasons - and because we are lazy. This is an attempt to get rid of said patch on our side and fix this properly. What do you thing about adding a flag in general? The following patches should integrate this idea in devicetree and drivers. These changes are NOT tested on hardware but should behave predictably enough. I use the delays in a driver that doesn't implement them yet at all. I'll do that after this (or something similar) is merged - it's a 2-liner then. Also, a patch to the rs485conf tool, that is sometimes used instead of ioctl() directly, will be prepared as well. thanks martin include/uapi/linux/serial.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/serial.h b/include/uapi/linux/serial.h index 93eb3c496ff1..c16c950ebca2 100644 --- a/include/uapi/linux/serial.h +++ b/include/uapi/linux/serial.h @@ -126,8 +126,15 @@ struct serial_rs485 { #define SER_RS485_TERMINATE_BUS (1 << 5) /* Enable bus termination (if supported) */ - __u32 delay_rts_before_send; /* Delay before send (milliseconds) */ - __u32 delay_rts_after_send; /* Delay after send (milliseconds) */ +#define SER_RS485_DELAY_IN_USEC (1 << 6) /* delay_rts_*_send + values are given in + microseconds */ + __u32 delay_rts_before_send; /* Delay before send (milliseconds + by default. microseconds if flag + is set) */ + __u32 delay_rts_after_send; /* Delay after send (milliseconds + by default. microseconds if flag + is set) */ __u32 padding[5]; /* Memory is cheap, new structs are a royal PITA .. */ }; From patchwork Wed Feb 20 15:27:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10822363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8282E13B5 for ; Wed, 20 Feb 2019 15:28:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6754A2E641 for ; Wed, 20 Feb 2019 15:28:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B7582E7E0; Wed, 20 Feb 2019 15:28:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 86B3C2E641 for ; Wed, 20 Feb 2019 15:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FLGA6d6wiHabpbbxELZUDjUAEeVR59v1kx5UaMifdnw=; b=Wb82wRwWsf6EY9nnizQsJbjuU 03ddyrBkAF6OBJ/y3YUkiJhZOlC0Bqimoqh/sd2LAWIjoIqw7mxXI8rVtkjOvKF4nv86BWi8DIX0C hIkXy/bLGrvGW/QpsAgAUigX725IFfmQLD4dNCDQATWDUoXvCDi3EDMY/n4OMC4RyOoJmGwnAbRou 6fvxC8Lj2nIrQdlS/px13F/sb28twzCrxx+PKnyxG7XY9emmkhI+WzEhxVbhB4J9EqI20zcmPewMR XqXIplVn+JIjBIb0xOlkyWHc7fhNhTSXRM26e4rRQ2x2PcV/NBrfWL04+xAU9bE0a2P1ybvVWDUdg gATBKbyKw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTnC-0001zk-Q8; Wed, 20 Feb 2019 15:28:14 +0000 Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTn7-0001vZ-G2 for linux-arm-kernel@lists.infradead.org; Wed, 20 Feb 2019 15:28:12 +0000 Received: from [31.193.165.228] (port=37651 helo=mx-ginzinger.sigmacloud.services) by mx-ginzinger.sigmacloud.services with esmtps (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1gwTmt-0003bN-2L; Wed, 20 Feb 2019 16:27:55 +0100 Received: from martin-laptop.buero.ginzinger.com (10.10.1.120) by exc1.buero.ginzinger.com (10.1.1.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Wed, 20 Feb 2019 16:27:55 +0100 X-CTCH-RefID: str=0001.0A0B020A.5C6D71FB.0079, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH 2/9] Documentation: serial-rs485: document SER_RS485_DELAY_IN_USEC flag Date: Wed, 20 Feb 2019 16:27:24 +0100 Message-ID: <20190220152731.4051-2-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190220152731.4051-1-martin.kepplinger@ginzinger.com> References: <20190220152731.4051-1-martin.kepplinger@ginzinger.com> X-Originating-IP: [10.10.1.120] X-ClientProxiedBy: exc1.buero.ginzinger.com (10.1.1.204) To exc1.buero.ginzinger.com (10.1.1.204) X-EXCLAIMER-MD-ORIGINAL-SUBJECT: [NOSIG][NODISC][PATCH 2/9] Documentation: serial-rs485: document SER_RS485_DELAY_IN_USEC flag X-EXCLAIMER-MD-CONFIG: 9dd172f7-de2e-4231-b886-ec11f46e03b3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190220_072809_687070_0095780F X-CRM114-Status: GOOD ( 12.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Document the new RS485 flag, SER_RS485_DELAY_IN_USEC that specifies that the rts delay values stored in struct serial_rs485 hold values in microseconds instead of milliseconds (the default). Signed-off-by: Martin Kepplinger --- Documentation/serial/serial-rs485.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt index ce0c1a9b8aab..a1e15e9efc2e 100644 --- a/Documentation/serial/serial-rs485.txt +++ b/Documentation/serial/serial-rs485.txt @@ -75,6 +75,9 @@ /* Set rts delay after send, if needed: */ rs485conf.delay_rts_after_send = ...; + /* Specify the rts delay to be microseconds, not milliseconds */ + rs485conf.flags |= SER_RS485_DELAY_IN_USEC; + /* Set this flag if you want to receive data even while sending data */ rs485conf.flags |= SER_RS485_RX_DURING_TX; From patchwork Wed Feb 20 15:27:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10822369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 84E0213B5 for ; Wed, 20 Feb 2019 15:29:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 698D82DFC8 for ; Wed, 20 Feb 2019 15:29:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C3FC2E1C7; Wed, 20 Feb 2019 15:29:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DA3C92DFC8 for ; Wed, 20 Feb 2019 15:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DoBEAzLbj1JaQKMaZvsJ4us0B8mncYcNQ0Q4ZvIi9DQ=; b=fSsniVNKub2SzhGtUkw3+60t6 1+AVbPnnm2pCjoRi+toLikF7vWzuxHk4keY7i40VDOFDgxibnPs5wQRyIDQpcspdCgMfR9JVumlCN BIPvAoqitm6+8dI7DI8d9f3tOgZOeZbnAELv1ewn4SLS1WTKOC6sX5gbdgrW+PzUzczauwnym+Q78 /V6cnKhm6CgCzlc0PJjWqzun2xp8z92WdE1e60eZTgLQEFNx8/DE1MT94uSYLxaBRFyFkg3NrZ0e/ FAMMurRsIk1t3KRBx4Cyqs5kS3gYwQ2h8oD8X2qa4JQADSNbI2dDrHsh2Nh1HgUqzvESXcPzL6KEd EBMZ3GaOg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTo1-0002qU-Kp; Wed, 20 Feb 2019 15:29:05 +0000 Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTnx-0002oY-Pe for linux-arm-kernel@lists.infradead.org; Wed, 20 Feb 2019 15:29:03 +0000 Received: from [31.193.165.228] (port=30207 helo=mx-ginzinger.sigmacloud.services) by mx-ginzinger.sigmacloud.services with esmtps (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1gwTmu-0003bO-0f; Wed, 20 Feb 2019 16:27:56 +0100 Received: from martin-laptop.buero.ginzinger.com (10.10.1.120) by exc1.buero.ginzinger.com (10.1.1.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Wed, 20 Feb 2019 16:27:55 +0100 X-CTCH-RefID: str=0001.0A0B020A.5C6D71FC.002E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH 3/9] serial: core: add rs485-rts-delay-us devicetree property for RS485 Date: Wed, 20 Feb 2019 16:27:25 +0100 Message-ID: <20190220152731.4051-3-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190220152731.4051-1-martin.kepplinger@ginzinger.com> References: <20190220152731.4051-1-martin.kepplinger@ginzinger.com> X-Originating-IP: [10.10.1.120] X-ClientProxiedBy: exc1.buero.ginzinger.com (10.1.1.204) To exc1.buero.ginzinger.com (10.1.1.204) X-EXCLAIMER-MD-ORIGINAL-SUBJECT: [NOSIG][NODISC][PATCH 3/9] serial: core: add rs485-rts-delay-us devicetree property for RS485 X-EXCLAIMER-MD-CONFIG: 9dd172f7-de2e-4231-b886-ec11f46e03b3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190220_072901_986396_6F74C95F X-CRM114-Status: GOOD ( 15.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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: From patchwork Wed Feb 20 15:27:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10822371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2647B14E1 for ; Wed, 20 Feb 2019 15:30:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C3122EB62 for ; Wed, 20 Feb 2019 15:30:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A2662EB58; Wed, 20 Feb 2019 15:30:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C549F2EB62 for ; Wed, 20 Feb 2019 15:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5ULLsCyVMy7NpIdG4FgmAnE4SzCkYiKmY7w+Py4M4yE=; b=PnJW6fN7+sNE9hiAiEBzAaSVA Ln1hiO3ai7Guez3sctqCSc92oQe4Fg8r4R5KC9bhocD08pqe3gst6ry4qX6QiohxCokfo9XaSZdBJ Iy81m/uiRv61DwBv+HVX1BQ5qVR1pjK0ichVDaxp4ubAOZkVowLi07F34EazVGruvOGlDJIupIc7K CP1I8pIyC45CH41rzJiTs67o06KgplI9v54Z6C3++vJ5qtJierHJgkp/LPewtihMMneVVQhVxCqod KbUa6Nx0tIxQWULWAmYc6t5v40pRQA/i4vstJmKe0mY8eWQ0HQg/OBdgjo7PtFxLIKXLa1IhYbQoS aC+hXjpnA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTp6-0004Rq-FS; Wed, 20 Feb 2019 15:30:12 +0000 Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTp2-0004K7-U5 for linux-arm-kernel@lists.infradead.org; Wed, 20 Feb 2019 15:30:10 +0000 Received: from [31.193.165.228] (port=61585 helo=mx-ginzinger.sigmacloud.services) by mx-ginzinger.sigmacloud.services with esmtps (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1gwTmu-0003bP-2H; Wed, 20 Feb 2019 16:27:56 +0100 Received: from martin-laptop.buero.ginzinger.com (10.10.1.120) by exc1.buero.ginzinger.com (10.1.1.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Wed, 20 Feb 2019 16:27:56 +0100 X-CTCH-RefID: str=0001.0A0B020A.5C6D71FC.0081, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH 4/9] serial: 8250: add support for rs485 RTS delays in microseconds Date: Wed, 20 Feb 2019 16:27:26 +0100 Message-ID: <20190220152731.4051-4-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190220152731.4051-1-martin.kepplinger@ginzinger.com> References: <20190220152731.4051-1-martin.kepplinger@ginzinger.com> X-Originating-IP: [10.10.1.120] X-ClientProxiedBy: exc1.buero.ginzinger.com (10.1.1.204) To exc1.buero.ginzinger.com (10.1.1.204) X-EXCLAIMER-MD-ORIGINAL-SUBJECT: [NOSIG][NODISC][PATCH 4/9] serial: 8250: add support for rs485 RTS delays in microseconds X-EXCLAIMER-MD-CONFIG: 9dd172f7-de2e-4231-b886-ec11f46e03b3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190220_073009_285233_9C0A24FE X-CRM114-Status: GOOD ( 15.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Read struct serial_rs485's flag SER_RS485_DELAY_IN_USEC and apply the delay accordingly. Signed-off-by: Martin Kepplinger --- drivers/tty/serial/8250/8250_omap.c | 13 +++++++++++-- drivers/tty/serial/8250/8250_port.c | 25 +++++++++++++++++++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index 0a8316632d75..cbce43ac60b1 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -720,8 +720,17 @@ static int omap_8250_rs485_config(struct uart_port *port, struct uart_8250_port *up = up_to_u8250p(port); /* Clamp the delays to [0, 100ms] */ - rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, 100U); - rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, 100U); + if (rs485->flags & SER_RS485_DELAY_IN_USEC) { + rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, + 100000U); + rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, + 100000U); + } else { + rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, + 100U); + rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, + 100U); + } port->rs485 = *rs485; diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index d2f3310abe54..0cee4aa8323d 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1483,6 +1483,15 @@ static void start_hrtimer_ms(struct hrtimer *hrt, unsigned long msec) hrtimer_start(hrt, t, HRTIMER_MODE_REL); } +static void start_hrtimer_us(struct hrtimer *hrt, unsigned long usec) +{ + long sec = usec / 1000000; + long nsec = (usec % 1000000) * 1000000000; + ktime_t t = ktime_set(sec, nsec); + + hrtimer_start(hrt, t, HRTIMER_MODE_REL); +} + static void __stop_tx_rs485(struct uart_8250_port *p) { struct uart_8250_em485 *em485 = p->em485; @@ -1493,8 +1502,12 @@ static void __stop_tx_rs485(struct uart_8250_port *p) */ if (p->port.rs485.delay_rts_after_send > 0) { em485->active_timer = &em485->stop_tx_timer; - start_hrtimer_ms(&em485->stop_tx_timer, - p->port.rs485.delay_rts_after_send); + if (p->port.rs485.flags & SER_RS485_DELAY_IN_USEC) + start_hrtimer_us(&em485->stop_tx_timer, + p->port.rs485.delay_rts_after_send); + else + start_hrtimer_ms(&em485->stop_tx_timer, + p->port.rs485.delay_rts_after_send); } else { __do_stop_tx_rs485(p); } @@ -1600,8 +1613,12 @@ static inline void start_tx_rs485(struct uart_port *port) if (up->port.rs485.delay_rts_before_send > 0) { em485->active_timer = &em485->start_tx_timer; - start_hrtimer_ms(&em485->start_tx_timer, - up->port.rs485.delay_rts_before_send); + if (up->port.rs485.flags & SER_RS485_DELAY_IN_USEC) + start_hrtimer_us(&em485->start_tx_timer, + up->port.rs485.delay_rts_before_send); + else + start_hrtimer_ms(&em485->start_tx_timer, + up->port.rs485.delay_rts_before_send); return; } } From patchwork Wed Feb 20 15:27:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10822367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7895A6C2 for ; Wed, 20 Feb 2019 15:28:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C05C2E721 for ; Wed, 20 Feb 2019 15:28:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F81D2E835; Wed, 20 Feb 2019 15:28:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E3B102E721 for ; Wed, 20 Feb 2019 15:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Ig3b/3xSvkThVsM33DPLfuM+DIBH/nuqPVv0/Mal140=; b=ogv+0Hk5K5rebRgiGir0j+xz/ Z6UTywBKUGMtkI+YfWcpe65msTQ/WzuC8ZrZRGvI3x9M42BzYSCwEUh+dtdas4OpbH967J58pHtKb PzEXHyAjOCDbQmj76s4vxio9seVk3IeQWPWMpaeDCWzQwMYugV9wxSzAB8zEXDSYbNSc/JM1QvMHd W9sCgNf6sqpUznYnxP4OQx+9R4owjp8yuG9Olb67SWB/HFOlHKYyDyhvssqNmcYf1nnQ/jpseHdik RHvKuDPJGVYCSF9h24B21g/EoAskCPj8GTzA7FR/NjFPqAkK/G+s/uWvkb1G1SHu5azTKstxGmE33 01gHb+XIw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTnh-0002Vn-6P; Wed, 20 Feb 2019 15:28:45 +0000 Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTnF-00021c-Le for linux-arm-kernel@lists.infradead.org; Wed, 20 Feb 2019 15:28:21 +0000 Received: from [31.193.165.228] (port=40473 helo=mx-ginzinger.sigmacloud.services) by mx-ginzinger.sigmacloud.services with esmtps (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1gwTmv-0003bQ-0a; Wed, 20 Feb 2019 16:27:57 +0100 Received: from martin-laptop.buero.ginzinger.com (10.10.1.120) by exc1.buero.ginzinger.com (10.1.1.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Wed, 20 Feb 2019 16:27:56 +0100 X-CTCH-RefID: str=0001.0A0B020A.5C6D71FD.0021, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH 5/9] serial: omap-serial: add support for rs485 RTS delays in microseconds Date: Wed, 20 Feb 2019 16:27:27 +0100 Message-ID: <20190220152731.4051-5-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190220152731.4051-1-martin.kepplinger@ginzinger.com> References: <20190220152731.4051-1-martin.kepplinger@ginzinger.com> X-Originating-IP: [10.10.1.120] X-ClientProxiedBy: exc1.buero.ginzinger.com (10.1.1.204) To exc1.buero.ginzinger.com (10.1.1.204) X-EXCLAIMER-MD-ORIGINAL-SUBJECT: [NOSIG][NODISC][PATCH 5/9] serial: omap-serial: add support for rs485 RTS delays in microseconds X-EXCLAIMER-MD-CONFIG: 9dd172f7-de2e-4231-b886-ec11f46e03b3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190220_072818_190484_E7F30DFF X-CRM114-Status: GOOD ( 16.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Read struct serial_rs485's flag SER_RS485_DELAY_IN_USEC and apply the delay accordingly. Signed-off-by: Martin Kepplinger --- drivers/tty/serial/omap-serial.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 6420ae581a80..adcd75ce5112 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -310,7 +310,11 @@ static void serial_omap_stop_tx(struct uart_port *port) res = (port->rs485.flags & SER_RS485_RTS_AFTER_SEND) ? 1 : 0; if (gpio_get_value(up->rts_gpio) != res) { - if (port->rs485.delay_rts_after_send > 0) + if (port->rs485.delay_rts_after_send > 0 && + port->rs485.flags & SER_RS485_DELAY_IN_USEC) + udelay( + port->rs485.delay_rts_after_send); + else if (port->rs485.delay_rts_after_send > 0) mdelay( port->rs485.delay_rts_after_send); gpio_set_value(up->rts_gpio, res); @@ -420,7 +424,11 @@ static void serial_omap_start_tx(struct uart_port *port) res = (port->rs485.flags & SER_RS485_RTS_ON_SEND) ? 1 : 0; if (gpio_get_value(up->rts_gpio) != res) { gpio_set_value(up->rts_gpio, res); - if (port->rs485.delay_rts_before_send > 0) + if (port->rs485.delay_rts_before_send > 0 && + port->rs485.flags & SER_RS485_DELAY_IN_USEC) + udelay(port->rs485.delay_rts_before_send); + else if (port->rs485.delay_rts_before_send > 0 && + !(port->rs485.flags & SER_RS485_DELAY_IN_USEC) mdelay(port->rs485.delay_rts_before_send); } } @@ -1407,8 +1415,17 @@ serial_omap_config_rs485(struct uart_port *port, struct serial_rs485 *rs485) serial_out(up, UART_IER, 0); /* Clamp the delays to [0, 100ms] */ - rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, 100U); - rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, 100U); + if (port->rs485.flags & SER_RS485_DELAY_IN_USEC) { + rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, + 100000U); + rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, + 100000U); + } else { + rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, + 100); + rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, + 100U); + } /* store new config */ port->rs485 = *rs485; From patchwork Wed Feb 20 15:31:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10822375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F310413B5 for ; Wed, 20 Feb 2019 15:31:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA0822ECAD for ; Wed, 20 Feb 2019 15:31:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D83C92ECB5; Wed, 20 Feb 2019 15:31:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7E40D2ECB3 for ; Wed, 20 Feb 2019 15:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Date:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=8bxlh+omPi30Wq8qsrjtybVFeGDEPlLhb4STQzR1aAw=; b=I/f Z9kMNP8SR6dgQAzFzQZRyH/nVA3d2Z/ICdsbxi8jXuYAjaC5/d2jo0qFrTkSkL+LkhCqc2BtcDJ5j c1E5stJh8dGQF4DSgf3N+9EiQwgQMrYA8IEfcR932z/bewYppovEFeY/WPNWaXvua5J+k7OdiIdZC jULVQKwH1fzj7Ki6hNXEh3wAEUIh26GLUzH1VuGiHn8gv5pfNlAH76ROSp9s4eaK5yC1vHiOHLBEn AM+SaJV2mSAFiaVkQS8Fwllxte7jRTVl63A7UMpVYCOZVlOXRZFf09ZWlWuZWcEg0zjTAGTj9B+D3 2+cK3bLLytWBcpxZiWthGyTHrzG0ViA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTqX-0004jP-05; Wed, 20 Feb 2019 15:31:41 +0000 Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTqT-0004j1-1z for linux-arm-kernel@lists.infradead.org; Wed, 20 Feb 2019 15:31:39 +0000 Received: from [31.193.165.228] (port=48458 helo=mx-ginzinger.sigmacloud.services) by mx-ginzinger.sigmacloud.services with esmtps (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1gwTqJ-0003nP-3A; Wed, 20 Feb 2019 16:31:28 +0100 Received: from martin-laptop.buero.ginzinger.com (10.10.1.120) by exc1.buero.ginzinger.com (10.1.1.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Wed, 20 Feb 2019 16:31:27 +0100 X-CTCH-RefID: str=0001.0A0B0211.5C6D72D0.0008, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH 6/9] serial: sc16is7xx: add support for rs485 RTS delays in microseconds Date: Wed, 20 Feb 2019 16:31:16 +0100 Message-ID: <20190220153119.4423-1-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 X-Originating-IP: [10.10.1.120] X-ClientProxiedBy: exc1.buero.ginzinger.com (10.1.1.204) To exc1.buero.ginzinger.com (10.1.1.204) X-EXCLAIMER-MD-ORIGINAL-SUBJECT: [NOSIG][NODISC][PATCH 6/9] serial: sc16is7xx: add support for rs485 RTS delays in microseconds X-EXCLAIMER-MD-CONFIG: 9dd172f7-de2e-4231-b886-ec11f46e03b3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190220_073137_251731_99396039 X-CRM114-Status: GOOD ( 14.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Read struct serial_rs485's flag SER_RS485_DELAY_IN_USEC and apply the delay accordingly. Signed-off-by: Martin Kepplinger --- 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); From patchwork Wed Feb 20 15:31:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10822381 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0DAC214E1 for ; Wed, 20 Feb 2019 15:32:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E69432E706 for ; Wed, 20 Feb 2019 15:32:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA2222EB99; Wed, 20 Feb 2019 15:32:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 92E742E706 for ; Wed, 20 Feb 2019 15:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FimV74s0MqOgYzLFpJiYE9/5JRCkM07egXUrYAxHPmE=; b=HrvYSudbZ7lazIaUSWqjurNgm pzF8i4UBhzbvqTyngYRJOYt6hQu+rtmF+9+DhDWDo0jph5qMeImm3lL3gj9OdnWeuEqqsMjYh+K+p 6NtrVO5XC9jWWx3spMEhkLexIGbyWLWpCpmaj9Mzhq3Pnf6dwIL4is114RxAW79pM0IDCFSKwXOQ7 FDzZ6Q3WgcHDPElyrYg6GcxYXWWvnpMaLnYmLFszWDHudp4LHGAvDYGfho/5qHw8f20pHcVGtR/0B xfsa7l/YlKHrLJGaiAj5bT4zcVIJrGvtYchuc2Dq4NjejHtzkULSW5StuNINI1lmtr83qFgw1sZeN Qm+GFucOA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTrV-0005ay-T9; Wed, 20 Feb 2019 15:32:41 +0000 Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTrS-0005aM-So for linux-arm-kernel@lists.infradead.org; Wed, 20 Feb 2019 15:32:40 +0000 Received: from [31.193.165.228] (port=33014 helo=mx-ginzinger.sigmacloud.services) by mx-ginzinger.sigmacloud.services with esmtps (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1gwTqK-0003nR-1X; Wed, 20 Feb 2019 16:31:28 +0100 Received: from martin-laptop.buero.ginzinger.com (10.10.1.120) by exc1.buero.ginzinger.com (10.1.1.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Wed, 20 Feb 2019 16:31:27 +0100 X-CTCH-RefID: str=0001.0A0B0211.5C6D72D0.004F, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH 7/9] serial: atmel_serial: set SER_RS485_DELAY_IN_USEC accordingly Date: Wed, 20 Feb 2019 16:31:17 +0100 Message-ID: <20190220153119.4423-2-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190220153119.4423-1-martin.kepplinger@ginzinger.com> References: <20190220153119.4423-1-martin.kepplinger@ginzinger.com> X-Originating-IP: [10.10.1.120] X-ClientProxiedBy: exc1.buero.ginzinger.com (10.1.1.204) To exc1.buero.ginzinger.com (10.1.1.204) X-EXCLAIMER-MD-ORIGINAL-SUBJECT: [NOSIG][NODISC][PATCH 7/9] serial: atmel_serial: set SER_RS485_DELAY_IN_USEC accordingly X-EXCLAIMER-MD-CONFIG: 9dd172f7-de2e-4231-b886-ec11f46e03b3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190220_073239_083754_FFCC0BE4 X-CRM114-Status: GOOD ( 12.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Unset the SER_RS485_DELAY_IN_USEC flag during rs485 config for userspace to get the correct setting. Signed-off-by: Martin Kepplinger --- 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; From patchwork Wed Feb 20 15:31:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10822377 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2BEFB14E1 for ; Wed, 20 Feb 2019 15:32:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D50C2ECBB for ; Wed, 20 Feb 2019 15:32:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F40542ECD3; Wed, 20 Feb 2019 15:32:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9AF572EB22 for ; Wed, 20 Feb 2019 15:31:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QpHFYLDOBBR+zE2pDkibwTnwau8L81lgHs3/6MrU9RI=; b=bohYkA1/5RXs43RrEFvE9ZhkR 2D+pUCWaCCqERFPjY6O7E/lIXFMkHzW6dnhczjQydYw1mf+J0qlZ7J4TsCiyqzNSBBKFrc1Y+C3oz n0oYSAElQKhsIj9pRTfrYdkRJptwwKcGjP8uPRjekR+il7khCByVYTLRVvZbq+EUqUkAKqCGB/zV7 f+u2vGNM0tCFa35hbW9x4e+1QXNJ0DBo04ypx9G3VcLUL6MVgDaiRi66w2GhWWxDozKJwxTWdqEFk k7Cul7zwyTqBpzfN7gzUFDaJWA0U4c2zDtmaC9pKx/DnVZK7oN3Tg7QyE/sxd9IohmfPoLCyVkMR9 8VZT0cYLg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTql-00051x-BE; Wed, 20 Feb 2019 15:31:55 +0000 Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTqc-0004oz-CG for linux-arm-kernel@lists.infradead.org; Wed, 20 Feb 2019 15:31:52 +0000 Received: from [31.193.165.228] (port=23272 helo=mx-ginzinger.sigmacloud.services) by mx-ginzinger.sigmacloud.services with esmtps (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1gwTqK-0003nS-35; Wed, 20 Feb 2019 16:31:29 +0100 Received: from martin-laptop.buero.ginzinger.com (10.10.1.120) by exc1.buero.ginzinger.com (10.1.1.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Wed, 20 Feb 2019 16:31:28 +0100 X-CTCH-RefID: str=0001.0A0B0211.5C6D72D0.008C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH 8/9] serial: fsl_lpuart: set SER_RS485_DELAY_IN_USEC accordingly Date: Wed, 20 Feb 2019 16:31:18 +0100 Message-ID: <20190220153119.4423-3-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190220153119.4423-1-martin.kepplinger@ginzinger.com> References: <20190220153119.4423-1-martin.kepplinger@ginzinger.com> X-Originating-IP: [10.10.1.120] X-ClientProxiedBy: exc1.buero.ginzinger.com (10.1.1.204) To exc1.buero.ginzinger.com (10.1.1.204) X-EXCLAIMER-MD-ORIGINAL-SUBJECT: [NOSIG][NODISC][PATCH 8/9] serial: fsl_lpuart: set SER_RS485_DELAY_IN_USEC accordingly X-EXCLAIMER-MD-CONFIG: 9dd172f7-de2e-4231-b886-ec11f46e03b3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190220_073146_825930_13190EB5 X-CRM114-Status: GOOD ( 14.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Clear SER_RS485_DELAY_IN_USEC for userspace to get correct settings. Signed-off-by: Martin Kepplinger --- 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 */ From patchwork Wed Feb 20 15:31:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10822379 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8BA7814E1 for ; Wed, 20 Feb 2019 15:32:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7358D2ECC0 for ; Wed, 20 Feb 2019 15:32:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 676F02ECC7; Wed, 20 Feb 2019 15:32:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 104352ECC3 for ; Wed, 20 Feb 2019 15:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2jhkMHkIcIdZ/JClm9uF6bSXvt83yr2CLhtwTur//hk=; b=T0ExUXTC+F+9rKzWN7QsYekoy X+Yz8MHJG9MWY+mNSK7Ca2hViOMFm4cvuTjTuzsuXf2nu+OndmCAEHSEQJ1kRqxExzWi13Q0CQXvM WCW8Czpt5d/SYeeY0Y4seM3Osau5b3hYKD6+rrls/YFYBZ35mAkjhml41m/ItZlxUqWB6X9kQpq4J L6QQ+yRKozZ/+Smnv4I4r1y07soSCrYb1+b+9lL8GqJX7SYgdBchdi+PTpe7jqaAP4/ts300av45S OPrHSlLMgkXCc6ZtYMPwtGaHmtfGN0rmb5f/cO+VnE8C+ASnVZKHVbah4P9A4/IjmIWifYxJisjd3 SWIMy4QeA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTr5-0005Je-B2; Wed, 20 Feb 2019 15:32:15 +0000 Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTr1-0005Hq-90 for linux-arm-kernel@lists.infradead.org; Wed, 20 Feb 2019 15:32:13 +0000 Received: from [31.193.165.228] (port=36730 helo=mx-ginzinger.sigmacloud.services) by mx-ginzinger.sigmacloud.services with esmtps (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1gwTqL-0003nT-1R; Wed, 20 Feb 2019 16:31:29 +0100 Received: from martin-laptop.buero.ginzinger.com (10.10.1.120) by exc1.buero.ginzinger.com (10.1.1.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Wed, 20 Feb 2019 16:31:28 +0100 X-CTCH-RefID: str=0001.0A0B0211.5C6D72D1.003E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH 9/9] serial: st32-usart: set SER_RS485_DELAY_IN_USEC accordingly Date: Wed, 20 Feb 2019 16:31:19 +0100 Message-ID: <20190220153119.4423-4-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190220153119.4423-1-martin.kepplinger@ginzinger.com> References: <20190220153119.4423-1-martin.kepplinger@ginzinger.com> X-Originating-IP: [10.10.1.120] X-ClientProxiedBy: exc1.buero.ginzinger.com (10.1.1.204) To exc1.buero.ginzinger.com (10.1.1.204) X-EXCLAIMER-MD-ORIGINAL-SUBJECT: [NOSIG][NODISC][PATCH 9/9] serial: st32-usart: set SER_RS485_DELAY_IN_USEC accordingly X-EXCLAIMER-MD-CONFIG: 9dd172f7-de2e-4231-b886-ec11f46e03b3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190220_073211_639031_CB4A7A69 X-CRM114-Status: GOOD ( 13.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Unset SER_RS485_DELAY_IN_USEC for userspace to get correct settings. Signed-off-by: Martin Kepplinger --- 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) {