Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3124284rwb; Mon, 15 Aug 2022 18:43:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR5jLG8SRJIuYQbpHZGOh3iLzMhmnwkws/FokyxSHI2JMX0Gz7+ZpZcXGZ0m61fcuJzidyXu X-Received: by 2002:a63:8442:0:b0:429:85db:b351 with SMTP id k63-20020a638442000000b0042985dbb351mr3449859pgd.430.1660614236042; Mon, 15 Aug 2022 18:43:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660614236; cv=none; d=google.com; s=arc-20160816; b=O7j1pcMBzLuvtYUdacmvEFFGL6/7uc9Unibc4kkvRUFz2Q7JdHCJ/SvXcXw0U9F9Br 7R7gcmmIh88xwgSyF3W27rhTE0kKcWnaidssPxINgF/nNeiEUHIk1P1RxhB//nvqUK1M WshXQpt+6l3Vx6g4nwDcw/GULTRQKYJaB6WsXMyvzJXlKld2a+T6lGBAXanpS036mWhl aPU61liReNMdAjgTtjbj1RDrF/ks1sdD6/P2T145EpFOoxcMRrQ1wlgcNzwkn2c5QVHf zySKIuTK0pl4MYXDZfoDkXc5620/GXloMvmOS0lGeYaEP32RDUdOmvPCUeTmnyA0eFxv fnVQ== 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=RKBghBsSZ/kbJQQRoQYVZb52JEnkpZ4zrga8dBZUNjg=; b=ZmUyfddHqu+a0eDazxy5qGbC4hq70QL9g2uMebxGktNVpndllgrJVK3Gzk1ByUbjij bC5ZqrwdUi3EK+TC+ued79ggEFvIBHayS3nnF+oX6Dj9gOHupayqg/J9rdGKLwCLHBz+ J8S89143XUmjzVxZ49RT9ukkSuoBMZe4Md0imld+LaApQCm2zgezuL4LP6UkY6XZo40D nJERa77f639E8ykfuiHaiolRR9DidkMvjUNjxdUZSH5dtCfsKo6jaqzHGTP52VpOR9aw WhyNQn51U8Jfkx05zwNou6MuX8KFWvyj/YNfH0GUPXAZiQGcnsTKYw/+EcMhpfTOvMWW RN7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bNOzs+2U; 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 e11-20020a170902744b00b0016cd74e550fsi11320153plt.351.2022.08.15.18.43.45; Mon, 15 Aug 2022 18:43:56 -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=bNOzs+2U; 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 S243751AbiHPAxd (ORCPT + 99 others); Mon, 15 Aug 2022 20:53:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244742AbiHPAol (ORCPT ); Mon, 15 Aug 2022 20:44:41 -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 706DFAE209; Mon, 15 Aug 2022 13:40:49 -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 134DCB80EAD; Mon, 15 Aug 2022 20:40:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4210FC433C1; Mon, 15 Aug 2022 20:40:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596046; bh=hF+MWjz3NwNhxg062slqc22gSVlrgR4oKLCaB8gyQdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bNOzs+2Ul5mzL2IbCFoOCD2mHBn0UE66SWan4lOXKhGNdbFdi5NtToWBmjBEuKGSm uk817MicYYEeImvb6ay+bEq6tS4V/OsF8hcyEoZonkwPb0z33mjH0qTbDYzD6apZAp 4bgGV1MEmMZFwRqvNO9W1Kop3LtCDCGSbKuCtbPw= 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.19 0956/1157] serial: 8250_bcm7271: Save/restore RTS in suspend/resume Date: Mon, 15 Aug 2022 20:05:12 +0200 Message-Id: <20220815180517.873457451@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 9b878d023dac..8efdc271eb75 100644 --- a/drivers/tty/serial/8250/8250_bcm7271.c +++ b/drivers/tty/serial/8250/8250_bcm7271.c @@ -1139,16 +1139,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; } @@ -1158,6 +1161,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); @@ -1180,7 +1184,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