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: