Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2878673rwb; Mon, 15 Aug 2022 13:09:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR4WZLPCAW9akjroBrAcQd8eNEt80TBg/44dbX8iKngRudnto7zlibSkPKpSPtEtXiTiZ+0Y X-Received: by 2002:a63:fb56:0:b0:429:983f:b91e with SMTP id w22-20020a63fb56000000b00429983fb91emr1652281pgj.399.1660594185254; Mon, 15 Aug 2022 13:09:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594185; cv=none; d=google.com; s=arc-20160816; b=MmKNnVuvPjLtvI/TpxRXYAVhLgbGWJhPmKgZOlyXOAMadzk47WhnLI6173U4Q5SObr h0L0Yt2Y0MG0tyRLoYwrCUT1nmHI27RStk1MLhgjrDzSJgsp3HUVpTHcxKPcR+ScTsV/ C6fyESkWq5G4bDbOJXlfTYiWlK03/brGbDE5FL/Bmup90Ueanfbg35TYKWRgqxbua6zY 9+Mg+B4Fu2NVGOLMimjH288iqesm/KYxCFqbmth78iZ6fR3Qt8Dnz76FuIXlPkSiEWzX yyrwco6Bw26YqZZea/0sEC3LHIHuB7Jnt4iGRzETmF2ZX0jP0UpcZMEaaFImTs3zTX1m JWjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tjByeUT2BGxKbXO9Ej1+lMFIOvhBKxSh/52mGenMjQs=; b=LjhAAdj+7ZptQskvUTU+jFWsI59uo4Plu8Mf9/+hVLMOPJrFjhd4xa1eJBAPSAs7pL hP2Q8bTcqLBFSNJrQmFD4/WsOfoFLm215Q3VxBad65/14d272NPFSMNq0ENHCgrMat/j 8SW3AABJCsnYUbv5BUCvYN/ToFVPkw0S2Q/AzQ6kL/BRXeztcCgMR9NRkyoX7qndlHAX hDYT78cFG3HI3zTwMcHO9qpXn/TtwsuHPNuO55DGujOvh5KWBj0g+ZzKo5w6W1FstMdK AfgBTxK+MtoSBuHl6Mye+R8kNwyjRfbnFeklLN/S2wSgiuBiHkM2jRPWDYQg3xXrd2mo jt5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lofTsz3K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e1-20020a170902e0c100b0016f86a21198si9225629pla.610.2022.08.15.13.09.33; Mon, 15 Aug 2022 13:09:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lofTsz3K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344430AbiHOTgk (ORCPT + 99 others); Mon, 15 Aug 2022 15:36:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344077AbiHOTbF (ORCPT ); Mon, 15 Aug 2022 15:31:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8DA260509; Mon, 15 Aug 2022 11:44:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD608B81084; Mon, 15 Aug 2022 18:44:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A2E9C433C1; Mon, 15 Aug 2022 18:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589063; bh=w0zsOwPQN8FgIJ2NQvJHzp2BmCnZTYagGKj8W77EbmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lofTsz3K5aoBaEr9EfUiDs8r0vluYmg8hbNnig4lqSjX7yNMNOx+adJlXBMGntw1U 62/auH5F5c3/zZUnr9TxnqM3s3Qpv+O6Gk2YMN4q6QpW02kDlCwMeMDxvoXqG1+RdJ ohwi7aoVyLB28H6bWaQmpdkqmDXsw3xu1FCgkj8Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Doug Berger , Florian Fainelli , Sasha Levin Subject: [PATCH 5.15 602/779] serial: 8250_bcm7271: Save/restore RTS in suspend/resume Date: Mon, 15 Aug 2022 20:04:06 +0200 Message-Id: <20220815180403.094392907@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Doug Berger [ Upstream commit 3182efd036c1b955403d131258234896cbd9fbeb ] Commit 9cabe26e65a8 ("serial: 8250_bcm7271: UART errors after resuming from S2") prevented an early enabling of RTS during resume, but it did not actively restore the RTS state after resume. Fixes: 9cabe26e65a8 ("serial: 8250_bcm7271: UART errors after resuming from S2") Signed-off-by: Doug Berger Signed-off-by: Florian Fainelli Link: https://lore.kernel.org/r/20220714031316.404918-1-f.fainelli@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_bcm7271.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c index 0877cf24f7de..711cf30e835a 100644 --- a/drivers/tty/serial/8250/8250_bcm7271.c +++ b/drivers/tty/serial/8250/8250_bcm7271.c @@ -1141,16 +1141,19 @@ static int __maybe_unused brcmuart_suspend(struct device *dev) struct brcmuart_priv *priv = dev_get_drvdata(dev); struct uart_8250_port *up = serial8250_get_port(priv->line); struct uart_port *port = &up->port; - - serial8250_suspend_port(priv->line); - clk_disable_unprepare(priv->baud_mux_clk); + unsigned long flags; /* * This will prevent resume from enabling RTS before the - * baud rate has been resored. + * baud rate has been restored. */ + spin_lock_irqsave(&port->lock, flags); priv->saved_mctrl = port->mctrl; - port->mctrl = 0; + port->mctrl &= ~TIOCM_RTS; + spin_unlock_irqrestore(&port->lock, flags); + + serial8250_suspend_port(priv->line); + clk_disable_unprepare(priv->baud_mux_clk); return 0; } @@ -1160,6 +1163,7 @@ static int __maybe_unused brcmuart_resume(struct device *dev) struct brcmuart_priv *priv = dev_get_drvdata(dev); struct uart_8250_port *up = serial8250_get_port(priv->line); struct uart_port *port = &up->port; + unsigned long flags; int ret; ret = clk_prepare_enable(priv->baud_mux_clk); @@ -1182,7 +1186,15 @@ static int __maybe_unused brcmuart_resume(struct device *dev) start_rx_dma(serial8250_get_port(priv->line)); } serial8250_resume_port(priv->line); - port->mctrl = priv->saved_mctrl; + + if (priv->saved_mctrl & TIOCM_RTS) { + /* Restore RTS */ + spin_lock_irqsave(&port->lock, flags); + port->mctrl |= TIOCM_RTS; + port->ops->set_mctrl(port, port->mctrl); + spin_unlock_irqrestore(&port->lock, flags); + } + return 0; } -- 2.35.1