Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp596833imm; Wed, 6 Jun 2018 02:53:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ6clBDCrMIN30+ElDz3SN/+AZEKNZt0v64MhzElbEr84oYVrMrzWpkplqx9KtqeckQ5WuI X-Received: by 2002:a62:4556:: with SMTP id s83-v6mr1770662pfa.73.1528278812069; Wed, 06 Jun 2018 02:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528278812; cv=none; d=google.com; s=arc-20160816; b=cyC3RGWqSNtWNT3f6NGtBs3pr2gvrWRMHfNW/Bw6bI+TaIi1bj7ILXSg6OBt258bFn 5DFF2XIgnMJY/KCsgFOXi+dcXiLqGB4uQDI1HPHTgNWPaGUF8ILxaADogmUQOxoCySDD +gWCvlqpyMYpinZbk6p0M4GfpbMrvBducXFKr/LPqITHO0cdAO2xr5G8OChnoa5bHS3c v2sWRpApf1ktARs0g4ycFpnRmHkcz9yK8i4xtdk3d3UIxIpmRUho1TrINQVEj89RBAFM v1c9kRQ4it8HezZ9MXF58DrQwtkH5cgYOHp4WzMVEmA62eJfpIxy8O7g7czJSdyiLzMl Xghw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:in-reply-to:message-id:date :subject:cc:from:dkim-signature:arc-authentication-results; bh=FxgLaygrQiC/Yy4GBujoubG5BKaI+VTXC4atgGbaQ2c=; b=iGtvwcP3Dyx90WPdIg/YUQ9BjvETxNZBIktqkZ91lLu17D8jgN2S6pLQjIWe0EjsB/ /eme1pYlOJLPv2BsgFj/mgLt+4lu62mmD5nTgnfbJcPvgRmW+cyYyDwOvQgq41uG4RDD D1U10EGC/8w5b4pRubAtFQvsOoWuy+wICCWkubTX5Lv9fXB7KegrySFX2Azwcy634a4E Nng3MDZWXCScREbdvSEIO0yajjPFp3PfMYPtog/rawDmy1xvRC+KwcRn+ZxqFCPZyZZu EUEWAM/5UtYAs8Uk6Ss6/8avk5QRg+cFTr6qVkgpLFq6Mep+uYE572lzR9l2vpzhSTAA ncCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=UyvtqKOe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w29-v6si14544555pgm.403.2018.06.06.02.53.15; Wed, 06 Jun 2018 02:53:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=UyvtqKOe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932460AbeFFJwg (ORCPT + 99 others); Wed, 6 Jun 2018 05:52:36 -0400 Received: from mail.micronovasrl.com ([212.103.203.10]:56118 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932641AbeFFJwR (ORCPT ); Wed, 6 Jun 2018 05:52:17 -0400 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 193F9B00896 for ; Wed, 6 Jun 2018 11:52:16 +0200 (CEST) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=references:in-reply-to:x-mailer:message-id:date:date:subject :subject:to:from:from; s=dkim; t=1528278735; x=1529142736; bh=mg CmlubMwVnGbmCq9oKZ8/qDTaS4MmsV0j75omz9eCc=; b=UyvtqKOe3+HRH/2SrC HEGLWAK097VPQ+nUkBGOmnBT0U0EzknQVix5vTxR22TwB6Qr4PGMwwfyO9okBlio cFdd7gz2CkzdVtetveVXYI2NFRVbnplCHKsvzbO8pSCdE/7J0ojxAyLKDDs8ffJR C6NSnhrx91+ygxxTxXflGsBck= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] autolearn=unavailable autolearn_force=no Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Yi9XoHfasNCp for ; Wed, 6 Jun 2018 11:52:15 +0200 (CEST) Received: from localhost.localdomain (unknown [87.18.119.93]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 698C9B00718; Wed, 6 Jun 2018 11:52:13 +0200 (CEST) From: Giulio Benetti Cc: matwey.kornilov@gmail.com, Giulio Benetti , Andy Shevchenko , Greg Kroah-Hartman , Jiri Slaby , Stefan Potyra , Joshua Scott , Ed Blake , linux-serial@vger.kernel.org (open list:SERIAL DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 4/4] serial: 8250_dw: treat rpm suspend with -EBUSY if RS485 ON and RTS_AFTER_SEND Date: Wed, 6 Jun 2018 11:51:53 +0200 Message-Id: <20180606095156.72628-3-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180606095156.72628-1-giulio.benetti@micronovasrl.com> References: <20180606095156.72628-1-giulio.benetti@micronovasrl.com> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If rs485 is on and RTS_AFTER_SEND it means that in idle state rts pin must be asserted, othwerwise rs485 transceiver will enter tx state. dw8250 when clocks are stopped keeps rts line de-asserted(high), resulting in keeping rs485 transceiver in tx state when port is idle. Check if rs485 is on with RTS_AFTER_SEND set, if so return -EBUSY in rpm_suspend, Signed-off-by: Giulio Benetti --- drivers/tty/serial/8250/8250_dw.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 888280ff5451..6b0ee6dc8ad0 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -668,6 +668,11 @@ static int dw8250_resume(struct device *dev) static int dw8250_runtime_suspend(struct device *dev) { struct dw8250_data *data = dev_get_drvdata(dev); + struct uart_8250_port *up = serial8250_get_port(data->line); + struct uart_port *p = &up->port; + + if (p->rs485.flags & (SER_RS485_ENABLED | SER_RS485_RTS_AFTER_SEND)) + return -EBUSY; if (!IS_ERR(data->clk)) clk_disable_unprepare(data->clk); -- 2.17.1