Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp545675imm; Fri, 1 Jun 2018 05:42:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKgxPlgcNqSNbMmlKdIh8ONpOQX/G4DrpejcLCknRl/zKiAvodFolg8DyCrpKRq/WpN0ZmL X-Received: by 2002:a17:902:7446:: with SMTP id e6-v6mr10949051plt.382.1527856924858; Fri, 01 Jun 2018 05:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527856924; cv=none; d=google.com; s=arc-20160816; b=l0MYczUU0n+9ubPA5XDvAYlubnFKLnsuyF2fWOFRbbp7N2MIXcvVE0iQuL1eU+XioJ ozthiV0xoQIvHWCDJH1LvBVC4Z3FSkcveQIDbFDDP5Q7KQDcVaFO6v6uIS1KB/hQsfPN rBlQgEUG7ShxlK5MmjWXc6r58gXQHSGf1L+7sFZXox/Ruf8nEevm4KOq7ElKCg0/uNyW SaCXceADpDV3EY7loaYuUX565sRy7kDtZeYL9MpHen/2EKMMgWueClEzAgyFUwWtWSPJ 8yQL1a6TL+vPtGtU3w/XeZmvudiDBqlZvSfKh00khP35xLSVLYiyaaGwSD3IP8CZsyum aNJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=BwEcF0lu9cD9/Y57Kh6m6nsYP9+/x8dju0ZOiQY4vzE=; b=KowJhaNClCbrJnf3d/qrKM3v/IJiwWpFvm+vXAiqOPCf5mA1rjlb3vZ1bS4ff4UwkI LnPz28fND9/pcHgBkSoTZ96FatuA3iK/jJdkvAsm0xVxQ2pxRLeni62PtXGidRkBVNVj CgECV5unSYqvHtEYQCFGdEFBJ/wZEadjLfeDKEbE6JPUWmaHCvMr0IzJ23AKnY7rmCjo Fz/CSNIo9ka36G45fJkwU3OMOQZMhliDxDdB70mX530taI0qAbJmAcQhTS6TMALYYiUg KXOz/2bLThHDIexgYP+UixZSjlva12yZFMLl5vjiyfd8zrkcBwlkOuFKT8CEsMgF8CuF EGdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=IfjbdQA3; 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 e129-v6si40274857pfa.217.2018.06.01.05.41.50; Fri, 01 Jun 2018 05:42:04 -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=IfjbdQA3; 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 S1752370AbeFAMkw (ORCPT + 99 others); Fri, 1 Jun 2018 08:40:52 -0400 Received: from mail.micronovasrl.com ([212.103.203.10]:39130 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752262AbeFAMkp (ORCPT ); Fri, 1 Jun 2018 08:40:45 -0400 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 70506B0093D for ; Fri, 1 Jun 2018 14:40:44 +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=1527856843; x=1528720844; bh=vJ PvnUQKB4SBzmd7PyOSvMS6HYHvLgFvkJ/5CnWs3iw=; b=IfjbdQA3DBWTUuU21c jJtm5EP3TIgCZFZ+D8B7xLx5SbazSfynhyUNkhBNmTRpJ9EKCyj2gXOIXnIlGN3e KPrBC0Aoc4EYMKOXWYRff8pHqpPIlpJbwQnzR59LcuVTzvBvzZn1+ibz0w0SkE+0 u8eThxLAKTLQ65Jhud2SzO3ME= 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 XgIhTJ4tSgRK for ; Fri, 1 Jun 2018 14:40:43 +0200 (CEST) Received: from localhost.localdomain (unknown [87.18.119.93]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 40137B00972; Fri, 1 Jun 2018 14:40:34 +0200 (CEST) From: Giulio Benetti To: Greg Kroah-Hartman Cc: Jiri Slaby , Andy Shevchenko , Kees Cook , Matthias Brugger , Allen Pais , Sean Young , Ed Blake , Stefan Potyra , Philipp Zabel , Joshua Scott , Vignesh R , Rolf Evers-Fischer , Aaron Sierra , Rafael Gago , Joel Stanley , Sean Wang , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Giulio Benetti Subject: [PATCH 5/8] serial: 8250_dw: treat rpm suspend with -EBUSY if RS485 ON and RTS_AFTER_SEND Date: Fri, 1 Jun 2018 14:40:18 +0200 Message-Id: <20180601124021.102970-6-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180601124021.102970-1-giulio.benetti@micronovasrl.com> References: <20180601124021.102970-1-giulio.benetti@micronovasrl.com> 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.0