From patchwork Thu Feb 21 17:17:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10824405 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 7A105922 for ; Thu, 21 Feb 2019 17:18:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FDC42022B for ; Thu, 21 Feb 2019 17:18:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EBB831181; Thu, 21 Feb 2019 17:18:37 +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 6AB9E2022B for ; Thu, 21 Feb 2019 17:18:36 +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=gNh6J9M0ynyKej3o8eurLzbBYvXilI45gBwbMYuZz94=; b=H7e KfD39XTgB1HHvw1S5N9HswzGIews1V7FnzWQ9o3zJD7tKvfNgrH7J3Wz39w5h22Wsam7e/mlmhT1A apwVowRrb/YE12yQKZ/zDcVkYXH78SKTue1wMg1J5m9yPZ2IoTKFR5BkSCiDTlASbEE12BXQnPu1m ZPdxp3iIJPYLXf1D8cW3Yh+EA4X9KP+6xzPVWsnenGUuegfyfSsBg/VSm2n4YXpAaRJeze2m062B3 7Jj5kwdIWbkRl1BpAPj55vlivLHBsehOoZRRQ0Gv7Oq2/FGGbn5/lZEczG1M7vMBZMFWDa0fh/+Gg ZUH7iznNDlT85hvWmhcH/q72ENtnDfQ==; 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 1gwrzW-00062b-Kl; Thu, 21 Feb 2019 17:18:34 +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 1gwrzS-00061Z-OL for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 17:18:32 +0000 Received: from [31.193.165.228] (port=9228 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 1gwrzH-00028o-2Y; Thu, 21 Feb 2019 18:18:19 +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; Thu, 21 Feb 2019 18:18:19 +0100 X-CTCH-RefID: str=0001.0A0B020F.5C6EDD5B.0066, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH v2 1/9] serial: uapi: add SER_RS485_DELAY_IN_USEC flag to struct serial_rs485 Date: Thu, 21 Feb 2019 18:17:50 +0100 Message-ID: <20190221171758.10322-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 v2 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-20190221_091830_947255_6116577E X-CRM114-Status: GOOD ( 19.37 ) 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: Martin Kepplinger , 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 --- revision history ---------------- v2: re-send as a proper series after fixing my mailserver v1: initial implementation idea So 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 Thu Feb 21 17:17:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10824423 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 A5BCA922 for ; Thu, 21 Feb 2019 17:20:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8597931B58 for ; Thu, 21 Feb 2019 17:20:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79F7E31EF8; Thu, 21 Feb 2019 17:20:54 +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 2CE7F31F24 for ; Thu, 21 Feb 2019 17:20:54 +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=O1ZeFwTRpKKCnCjLMMBxycHYmvv9AVxkQjCtjm2cAIs=; b=b5REfok4iQP9V2MvkYSeC+DJn V4FHWtD3qC76K070plWvHG83Wr8OT46XO2tOiwOlTbeXTU8ggFN0AwapjdHBDEU8L794nVIPbZMSF eQCg77KoKdPCYbVhLBWx6JgfKqqS/JBp5ty2rw1fIK8nxDR2MPhXhkU1vSjLhRDtKFR74Nl8MWJqC gfjojA08DDaT+2GJWB/1sBcQpVCYziOkDLmZ1PkAGTcXfxkoRSSA+zaDw3FA4Jj/ptugR1MrJdSDj LyyZarvKaS8MNaTHxUI0jtQ+SdDjJpepi8plv/vSjzPT2Bmk/hPav6wQ89jBAhH8H6qSpvVTKXMF7 PLdxNzlxQ==; 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 1gws1k-00015M-UQ; Thu, 21 Feb 2019 17:20:52 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gws0i-0007Mr-SZ for linux-arm-kernel@bombadil.infradead.org; Thu, 21 Feb 2019 17:19:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=py4wnjzdmZ4tjfbGvXGUdgrgonczbqHS7x/MAN/KbgU=; b=KK7EaspsY9600IxlPBxt2r+ul XqSmXAVlR/nfs2ZMslWuUJC4Lq3fYOdR8ENbztPjbMMruP1dFGQCclqw/ERXQQa7nCtmJn3GDlT7t gY//UIFYeKGQVZAwUPHmP0kCsd5eKGRu2wytrqixw25EBE6argcvyKpmkqZNbNwENVKzoHmR+QHHC pi5uu6B5A8UMR/SwAn1cyPiwLtq5NTugJ9YFrzykotD5ZdlJInkbPxVU2PG5K2vSbFJKoJUhV3H0L NcrwCJYy0ZWRqif5fTsJQ4uNORhKOKs68K3uv8MY9DEEeMRjdFedECtz3HG/NWJRNDdZNbFeHFKJ3 0hdYr154g==; Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gws0g-0002zs-BN for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 17:19:47 +0000 Received: from [31.193.165.228] (port=49494 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 1gwrzI-00028q-0v; Thu, 21 Feb 2019 18:18:20 +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; Thu, 21 Feb 2019 18:18:19 +0100 X-CTCH-RefID: str=0001.0A0B020F.5C6EDD5C.0024, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH v2 2/9] Documentation: serial-rs485: document SER_RS485_DELAY_IN_USEC flag Date: Thu, 21 Feb 2019 18:17:51 +0100 Message-ID: <20190221171758.10322-2-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221171758.10322-1-martin.kepplinger@ginzinger.com> References: <20190221171758.10322-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 v2 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-20190221_121946_539957_2AA6F8CA X-CRM114-Status: GOOD ( 10.45 ) 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: Martin Kepplinger , 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 Thu Feb 21 17:17:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10824407 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 D03C0922 for ; Thu, 21 Feb 2019 17:18:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEA1431B64 for ; Thu, 21 Feb 2019 17:18:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A181931BA7; Thu, 21 Feb 2019 17:18:54 +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 4AE9C31B64 for ; Thu, 21 Feb 2019 17:18:54 +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=iS6itpo2wca+hWalN1wgKyseilGIPBkWHmc/o7jJSIc=; b=un78H2FEOAn0mPf0fz7S1uEr8 ntAE7BD6ygyLzs+n63/R4SC5oLN/ti0VVjFgSyqBvmOjYlK0bBgsY8dv5GgXnsr5kai/BO+wWpQ/f ropMNYnxva1Wsj/PgLG1wUrdV0mmntooQiepAGOR5V+QE78LbCJWWcPwDZUrx06cXAINQSCP6O0oS ZnXaF5vP7GlZvKx5nbqZPZYqxWOrKFANoE9llA+t0yVKNlxmkA+Udtd3uzgq4xlzy6Qe1VbpRSGMB Nh/y6PqFcoYg8STCrwdi7H2Tu3MZD20hJDUrjUhodCOZ2OIhqL7NnEdF1lSZhmnf4HKVrY3Q3cCqa v0ugPczvA==; 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 1gwrzj-0006Ih-Gm; Thu, 21 Feb 2019 17:18:47 +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 1gwrzY-00063n-Nc for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 17:18:40 +0000 Received: from [31.193.165.228] (port=5985 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 1gwrzI-00028r-2f; Thu, 21 Feb 2019 18:18:20 +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; Thu, 21 Feb 2019 18:18:20 +0100 X-CTCH-RefID: str=0001.0A0B020F.5C6EDD5C.006A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH v2 3/9] serial: core: add rs485-rts-delay-us devicetree property for RS485 Date: Thu, 21 Feb 2019 18:17:52 +0100 Message-ID: <20190221171758.10322-3-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221171758.10322-1-martin.kepplinger@ginzinger.com> References: <20190221171758.10322-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 v2 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-20190221_091837_193043_6CAC1092 X-CRM114-Status: GOOD ( 16.73 ) 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: Martin Kepplinger , 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 Thu Feb 21 17:17:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10824409 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 D716113B5 for ; Thu, 21 Feb 2019 17:19:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACEC729F84 for ; Thu, 21 Feb 2019 17:19:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C746311DB; Thu, 21 Feb 2019 17:19:01 +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 00D7F2BA10 for ; Thu, 21 Feb 2019 17:19:00 +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=T7Eo/gNrE4u1bniNFdxN7jNkudx96I20403Wk4JZT+o=; b=DNakpWqtl0MNcomrAyOALjgCF Lr64kegDXfbibD+8k9CPNdJR6joZl/CxAFytwX3CZDGVsnPNZnUr+/ZZ2K06777mU/k6yOADj5D6l G7fbH2lpwcRF7MyAIH4eO+2TxCwui/7CAUzfE0Yd/ZIfjo8jFeXzurTtbODZ4K2z9gHcdliz42mqL BS4D63NwKtmblWmJBWbBM+ToH/5IvXzu1ryX0Vf4dOn9EL2e6bB1knM9V7K4D6mGLMAYg+8wSCxr2 0uRhmyPCXIRpyyCUMDma/MSK4xueeML1AV7BwafXyPCi7h6OYPyR32i0QslvQdv7bigMH1Px3sAze YppJf46dA==; 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 1gwrzt-0006X0-UM; Thu, 21 Feb 2019 17:18:57 +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 1gwrzZ-00065G-PU for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 17:18:42 +0000 Received: from [31.193.165.228] (port=45893 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 1gwrzJ-00028u-15; Thu, 21 Feb 2019 18:18:21 +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; Thu, 21 Feb 2019 18:18:20 +0100 X-CTCH-RefID: str=0001.0A0B020F.5C6EDD5D.0031, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH v2 4/9] serial: 8250: add support for rs485 RTS delays in microseconds Date: Thu, 21 Feb 2019 18:17:53 +0100 Message-ID: <20190221171758.10322-4-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221171758.10322-1-martin.kepplinger@ginzinger.com> References: <20190221171758.10322-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 v2 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-20190221_091838_379105_3B1B20D4 X-CRM114-Status: GOOD ( 15.62 ) 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: Martin Kepplinger , 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 Thu Feb 21 17:17:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10824411 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 D91F91399 for ; Thu, 21 Feb 2019 17:19:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4E5D313DE for ; Thu, 21 Feb 2019 17:19:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A893831434; Thu, 21 Feb 2019 17:19:20 +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 514ED313DE for ; Thu, 21 Feb 2019 17:19:20 +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=MsrxCVNXl9+bwBaLMCBIAM5FSld8tXEZR7SZDzVZBxM=; b=ErPLB2fY9W4t8ncBAGG1GvajX aweoik6GGvIv1mQesTndNgnFCTh9YOMWSb65b5xHl3RI4LANi9Fcql39QXrdR4vPvHlGVSsN9afhn /P1huttwt6vyEWXDn2acMJNYylaGIARCU/PvDQUnr2YGCdnxK6umXepiSOasWZTkz9+z96gSczBbv jhtk4xNEHH8QJ9VURM5YT2TFL8CS03Xsbcjv7caAN3fnan/qfNcUW9wOT07zdran7mHa7NFTVyLmE aLw4US3mOTx8e5xG8LZnkKQkFGAlhD5TcjA2iU/XGYBUKXnj+kXhYoS+xSd29IycjqW43zBK44UWA Iq5uw85lw==; 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 1gws05-0006nU-Ub; Thu, 21 Feb 2019 17:19:09 +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 1gwrze-0006CJ-OK for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 17:18:45 +0000 Received: from [31.193.165.228] (port=9990 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 1gwrzJ-00028z-2k; Thu, 21 Feb 2019 18:18:21 +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; Thu, 21 Feb 2019 18:18:21 +0100 X-CTCH-RefID: str=0001.0A0B020F.5C6EDD5D.0076, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH v2 5/9] serial: omap-serial: add support for rs485 RTS delays in microseconds Date: Thu, 21 Feb 2019 18:17:54 +0100 Message-ID: <20190221171758.10322-5-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221171758.10322-1-martin.kepplinger@ginzinger.com> References: <20190221171758.10322-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 v2 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-20190221_091843_191124_2E5384D2 X-CRM114-Status: GOOD ( 18.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: Martin Kepplinger , 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 Thu Feb 21 17:17:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10824421 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 6D2B313B5 for ; Thu, 21 Feb 2019 17:20:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4830D31EF8 for ; Thu, 21 Feb 2019 17:20:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BE3331F1B; Thu, 21 Feb 2019 17:20:34 +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 5DD2531F08 for ; Thu, 21 Feb 2019 17:20: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: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=a06ojgpWL+eD4g8l+tbBFDFKIaSuTlSJTIEDSwHnbRM=; b=A8Xfe6gO9XB9RJ+brJNeS4y0w KOlEAsxD8Os5B87KPRhiRGUsAsYgaywC+wS5tk5ZTM6rrxc9oVRjuq0Ipc+r86bODPsoX8sZg0gAX wEplfA9rLr61SootjxD4OWMxlwE66k48MERS9sVn7Mq6WkJiEBn0IkDnUwR1M61gjSRLaZhxFlOL5 GAVMtSkWZ+jTF4J+DQ8IDMQAgSLhSTFlf3XF88imBqaQL8Wf0G0dEmz4xn8Ii4YsgQOQhfHP0X17M oHlzrEn2471SKGdDS3c+eUEeIDR0Lz3MoxsRb3AGHyl46AS/Uq4tNnjmhJ1vp/caKcCEKBkjTIVfi B/7dzSnRA==; 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 1gws1D-0000ZV-4F; Thu, 21 Feb 2019 17:20:19 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gws0V-00079c-1f for linux-arm-kernel@bombadil.infradead.org; Thu, 21 Feb 2019 17:19:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=roLePFMWs+/AqquyrTSvSa96DoJ/SGN4Kbh1bpEZHRI=; b=yMSr93B4SJlIXxM6ClZ40zSmH 9mSN0AE+dg/6q0axT8IcHhKuL5dztX8FR/4lRDGalrFcie8NY60zbBQfOHuAcf1yzlrUHUggMU6xd 8mhfgdqjdOWL7uE5R1WR7QNS/EF9rGpJJcVxfq0l1hK03Ew4P5IqVmODK5zGxB6mgk2+cdaBaKHw9 w62NfL0ibZh4xfXy9uuCUcoh0EIoqg3GJxrL6/7u9YZcccx1Dt3vD47/oNcfSKjCKyQVSM2i1iaZu 6tw0/Nrir7KX5WdDFrZxPaRNchdBIh7twor0RTQKfN7CM+mNS+Pm8xmNRAuG/HUZXkLnxRTUc4DMt NP2nfv53Q==; Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gws0Q-0002yq-10 for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 17:19:32 +0000 Received: from [31.193.165.228] (port=42442 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 1gwrzK-000295-17; Thu, 21 Feb 2019 18:18:22 +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; Thu, 21 Feb 2019 18:18:21 +0100 X-CTCH-RefID: str=0001.0A0B020F.5C6EDD5E.0042, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH v2 6/9] serial: sc16is7xx: add support for rs485 RTS delays in microseconds Date: Thu, 21 Feb 2019 18:17:55 +0100 Message-ID: <20190221171758.10322-6-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221171758.10322-1-martin.kepplinger@ginzinger.com> References: <20190221171758.10322-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 v2 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-20190221_121930_201036_AE3A9A79 X-CRM114-Status: GOOD ( 11.47 ) 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: Martin Kepplinger , 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 Thu Feb 21 17:17:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10824415 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 F16AB184E for ; Thu, 21 Feb 2019 17:19:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFBFA31A21 for ; Thu, 21 Feb 2019 17:19:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C384631EF4; Thu, 21 Feb 2019 17:19:50 +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 4849831EEC for ; Thu, 21 Feb 2019 17:19:50 +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=LEiqOWQoH9bKhpaGxto9pQPBi32E0xVg89BJaRQZWMo=; b=LK1DjJNLyqwXsDZo4USnswRQs w3r7fHwT1Cu71Hw+lK5GFvFsRwfc/9uJ3ceSO+7LYU3PyJiuR3b/LsxJqEzL2U6RNhsIKXM7ZBZX5 jv2LiomqVZTEJhkREK9Md4No8/zgU5QUdB36OihrD2jFEzBBbAAxiuqXjXTLOTPWdn4lRQRHpkA7W airtrLalPbQlRWF/ngRG3Si49XYdqxwE8N8TthcvtmtfKStmhLJbmWwkgVv3C7ISOLWbuBeeZJ2/s SPQPNoBvk9CM7/fitP9I9kvwB8BrjSw5kJiFQxT87WQgk+j5hcr34thid0UtTksY7jyCAhGPL3RnY MUUBIAkDA==; 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 1gws0h-0007M6-Jp; Thu, 21 Feb 2019 17:19:47 +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 1gwrzj-0006IC-Jd for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 17:18:59 +0000 Received: from [31.193.165.228] (port=21721 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 1gwrzK-00029A-2l; Thu, 21 Feb 2019 18:18:22 +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; Thu, 21 Feb 2019 18:18:22 +0100 X-CTCH-RefID: str=0001.0A0B020F.5C6EDD5E.0090, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH v2 7/9] serial: atmel_serial: set SER_RS485_DELAY_IN_USEC accordingly Date: Thu, 21 Feb 2019 18:17:56 +0100 Message-ID: <20190221171758.10322-7-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221171758.10322-1-martin.kepplinger@ginzinger.com> References: <20190221171758.10322-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 v2 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-20190221_091848_021078_EF28BF27 X-CRM114-Status: GOOD ( 14.16 ) 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: Martin Kepplinger , 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 Thu Feb 21 17:17:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10824413 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 01021184E for ; Thu, 21 Feb 2019 17:19:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D101031EEF for ; Thu, 21 Feb 2019 17:19:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4A8231EF4; Thu, 21 Feb 2019 17:19:41 +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 72A0931EEF for ; Thu, 21 Feb 2019 17:19:41 +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=YeYeaXVRDIb2WINYuQuc+vR/G9zzVHsetUCvlVs8P4c=; b=kFRtGw9zWm65QfLYSE165AAga jBEr6LtWaZztkCjPRZUbZ3wBXNigUiLfIn81KEo4X8KsDvBmAVusKinOm7VLyD/0eu06609O+JcUm w3b3IFxVhVvucoyL1T7n+7p7d8WH2cxGd2Tl7xjqROjb0tOIIik23HKVy89OlEuMLJM87dSvZOXZu 5GQluoDjTPWn+cGQ+9c4QRdaytUmB88IaC2gVgaWxylBwKUifggPUFhGI2pIfkph1IsNBvDUTjqC7 o8QW8rmBW8CxXqotNpXMKu5dX8xmvANYu67zhtOjUbfxxy/naJIDx01XM9UkokTv1+RvvAHTtWZRc 7JbWRBoHw==; 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 1gws0a-0007Bc-1B; Thu, 21 Feb 2019 17:19:40 +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 1gwrzk-0006Ji-Pd for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 17:18:58 +0000 Received: from [31.193.165.228] (port=49952 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 1gwrzL-00029F-19; Thu, 21 Feb 2019 18:18:23 +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; Thu, 21 Feb 2019 18:18:22 +0100 X-CTCH-RefID: str=0001.0A0B020F.5C6EDD5F.003B, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH v2 8/9] serial: fsl_lpuart: set SER_RS485_DELAY_IN_USEC accordingly Date: Thu, 21 Feb 2019 18:17:57 +0100 Message-ID: <20190221171758.10322-8-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221171758.10322-1-martin.kepplinger@ginzinger.com> References: <20190221171758.10322-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 v2 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-20190221_091849_405309_65ABCC80 X-CRM114-Status: GOOD ( 12.95 ) 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: Martin Kepplinger , 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 Thu Feb 21 17:17:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 10824419 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 A1C5014E1 for ; Thu, 21 Feb 2019 17:20:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 801EF31F1E for ; Thu, 21 Feb 2019 17:20:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E4A131EF6; Thu, 21 Feb 2019 17:20:33 +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 0FE2631EF6 for ; Thu, 21 Feb 2019 17:20:28 +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=Y6tAoOHdBWf0SwY1e/N0MWOhKamFWT6gjZfxIP1RKk4=; b=oOI1npfN60EdG84MkcN6x69vs 5BpACNdobgDN2YtC5yj1Wpn2W4WQ/jzgipK4ClDWeOu7kfIicDQT5JqbdMVVgfBkAHvipSe4mXiBX oyCEo+eVWNqi/3ZbJGsYyu5+xS20tUTzUIo481E6OzaKG2i7zv4bxVck7lQ838fX3dPcjjfXQBEvH j+wbevxQwLuvEHTG2ZI5uF0NJ/fDbPW7tXrCO6naw1SWDr7W8UtgrvVu1xyvIMdrn97PjvbCueq40 dpGZ7RmtKDdcwxbKaDyX31EkThXKcVnHCP4ODRcF4275NU/I395BEr7l7daAznkqKWICKYcHh8Gbo l2oVMY4uw==; 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 1gws0u-0007eG-PK; Thu, 21 Feb 2019 17:20:00 +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 1gwrzp-0006Q0-BE for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 17:19:03 +0000 Received: from [31.193.165.228] (port=37887 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 1gwrzL-00029L-2q; Thu, 21 Feb 2019 18:18:23 +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; Thu, 21 Feb 2019 18:18:23 +0100 X-CTCH-RefID: str=0001.0A0B020F.5C6EDD5F.0093, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Martin Kepplinger To: , , , , , , , , , , , , , , Subject: [PATCH v2 9/9] serial: st32-usart: set SER_RS485_DELAY_IN_USEC accordingly Date: Thu, 21 Feb 2019 18:17:58 +0100 Message-ID: <20190221171758.10322-9-martin.kepplinger@ginzinger.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221171758.10322-1-martin.kepplinger@ginzinger.com> References: <20190221171758.10322-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 v2 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-20190221_091854_152813_E257B1C9 X-CRM114-Status: GOOD ( 14.39 ) 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: Martin Kepplinger , 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) {