Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4593184pxj; Wed, 12 May 2021 08:52:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBZMjzVPxfU0Lm7f5NFtkO9mnHLGtIF/B4PRNFAVWUYxLBT1qcBQSPgyAL9kvXxZWeou0K X-Received: by 2002:a17:907:3da4:: with SMTP id he36mr37668119ejc.308.1620834759289; Wed, 12 May 2021 08:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834759; cv=none; d=google.com; s=arc-20160816; b=tzOB8asqDmXKcqH5WyKnbrP+QjQ2Wb3DNDQvcs4aojV4NjhnjqjVQCLTBHkuVnJsz+ 9i5S8wDXDPXFKWvJ1tRkMmmOh4vlWj5pOcqqb3gUrPJzeVfxh/x/8qogh8JhYwVDnURo lItMG+gAqOBJ8+WkMSipC3jvxf+gBtkaKamH7zbScZ3qsxg08g7gIX/9hMuIBeOa2jsT jmPBT1eGNlcpP7mdalhjiNm1w7e8174iZlD3lK4HexRbGgk0hvKoYjYo5ks4+B+2tZrR 3/ayFwTKZuW8n4F2WEADBFqB6ixCPE1JcyApeQdCC8LveOzvQkS+MJ+uXmukvCiSqUQu EOHA== 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=uKWwEQpqBRcvM3WidrPNBmu0WF2dboSgF/gB+Z66d80=; b=JrhV1dnHr/Ab4skZp/X9fzBz4rvIPdzRbA4gtEE4hsBA+MIyNuWqP4gPaN5y55W9od P07DWgq8BBMrOlYmRLprE7yzSLKTMqco46kC1U1/fUQLa/LzKRcVPUpQUvjZsGXfoZeU nXAsuQNTsP0a/93nJOvBFXpU41D7JuOy/Lkhj4rknwnnWJwPw3BbuyDvgECZKgCYTpKH A5PUTkXGVStPtLmqt0PQr27HUMLV1IR8ILk2vaYPAOPZzmGPM9RCXbso5dCOqTwYmCNu azLwx2Xsl8TMMSiRji6S05lOBZtSsum77qQYvgM3pDLtls0a6nnj96DZH0G+XMQrftV+ YmNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IgUbRA0B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si273371ejf.717.2021.05.12.08.52.15; Wed, 12 May 2021 08:52:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IgUbRA0B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S236462AbhELPpd (ORCPT + 99 others); Wed, 12 May 2021 11:45:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:60626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234673AbhELPUV (ORCPT ); Wed, 12 May 2021 11:20:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D17E36157F; Wed, 12 May 2021 15:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832099; bh=z9QGBy61X1phM4yeWZEWvHLvKj6abIseK7g1QICcySQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IgUbRA0B6NPXGlPHE8q4sim7JkqpeqnHWsfbRY7+REiNEQbIbHwgtxOL8E46VKY51 qtXdCf50uE4KKaUUXv1+Q/q8v4JF7XNgLxRj1p1Y50OmTLB0hgbquAujWVfzqN8J9Y jppM4+nUqqPLJdisDUNucZKIrqjTtQGRVjVPRrCA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erwan Le Ray , Sasha Levin Subject: [PATCH 5.10 140/530] serial: stm32: fix FIFO flush in startup and set_termios Date: Wed, 12 May 2021 16:44:10 +0200 Message-Id: <20210512144824.422264659@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Erwan Le Ray [ Upstream commit 315e2d8a125ad77a1bc28f621162713f3e7aef48 ] Fifo flush set USART_RQR register by calling stm32_usart_set_bits routine (Read/Modify/Write). USART_RQR register is a write only register. So, read before write isn't correct / relevant to flush the FIFOs. Replace stm32_usart_set_bits call by writel_relaxed. Fixes: 84872dc448fe ("serial: stm32: add RX and TX FIFO flush") Signed-off-by: Erwan Le Ray Link: https://lore.kernel.org/r/20210304162308.8984-11-erwan.leray@foss.st.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/stm32-usart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index a6295897c537..6788fb3af6cb 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -656,7 +656,7 @@ static int stm32_usart_startup(struct uart_port *port) /* RX FIFO Flush */ if (ofs->rqr != UNDEF_REG) - stm32_usart_set_bits(port, ofs->rqr, USART_RQR_RXFRQ); + writel_relaxed(USART_RQR_RXFRQ, port->membase + ofs->rqr); /* RX enabling */ val = stm32_port->cr1_irq | USART_CR1_RE | BIT(cfg->uart_enable_bit); @@ -760,8 +760,8 @@ static void stm32_usart_set_termios(struct uart_port *port, /* flush RX & TX FIFO */ if (ofs->rqr != UNDEF_REG) - stm32_usart_set_bits(port, ofs->rqr, - USART_RQR_TXFRQ | USART_RQR_RXFRQ); + writel_relaxed(USART_RQR_TXFRQ | USART_RQR_RXFRQ, + port->membase + ofs->rqr); cr1 = USART_CR1_TE | USART_CR1_RE; if (stm32_port->fifoen) -- 2.30.2