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);