Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp8204960pxb; Fri, 19 Feb 2021 09:54:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWxFYofLTefL1rptucYQv/uffVaKF1EHlplLRirPHB1+i7j38mp5LK4BujeSGe8lihFx7X X-Received: by 2002:a17:907:728b:: with SMTP id dt11mr9727561ejc.321.1613757292487; Fri, 19 Feb 2021 09:54:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613757292; cv=none; d=google.com; s=arc-20160816; b=yQow1sJzbsDTsMccwQ4Ce8AS+6hzsXGEN3RU6M5mEGVHPBRPQV4OJjmMkN6n5Y1itk 8Nm6OKzmWFnfs5MBjBorPp217UegKImVDgnchGkIrtwYlo4MuMDqceKqr3CxlETYPUWE KGlFG77gqF2jeGUuNS0h/v7qrc6curjqu8cPOJEUiofAFYzYj2jAR2FMjoslbdUmCX5z 2ilwDJEYOkj2vterCs5O19QsBoHJ2LuBpjsi1ITWp9/TXHUmF+cCv8+eCVo5UH0ivN0f 1nOVbm+Kc5CLrLb4b+eaZAIrzXwW8RBQFopRNIBEPPne9w7nh9k+HO8zaxLwo7lOiegr IX3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+HyNAQrU/4esjJvyfTary0eok3bAQb+Acgv+8Q4Ubw4=; b=ohCK5xvKKz8E+7Th2mad7a/a0I8czujt2iFup4KasDb2xtjEHBql6r0tEgX0oWP3Qp Y9gFgdzAKUwblcJraOPjrOwVLqjp1qDd40aN5MnkDkyq0tEcfXERivbH1x5slzmHvVlG Q5Zabzca+rT79NaUymQeycod4euLnNd3+5yuNiywPgLBBpAaEF06Og2mPXaExb37dzo+ VnX2t0mXzJEO1a9S7PbeTDWFA3GTRTeBfV1nMn2uQQR7rvCVqdZyuGnRz2gkkIkj446T sBRf7DaoaQl9l7nXCejVSxQ+b40akL47ocEXrVKI2TOxog8TOjBtRN74OUoIZXeF5d9E hxfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=C4A5Mr17; 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=foss.st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si7205510ejk.640.2021.02.19.09.54.29; Fri, 19 Feb 2021 09:54:52 -0800 (PST) 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=@foss.st.com header.s=selector1 header.b=C4A5Mr17; 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=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230239AbhBSRvU (ORCPT + 99 others); Fri, 19 Feb 2021 12:51:20 -0500 Received: from mx07-00178001.pphosted.com ([185.132.182.106]:37800 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230073AbhBSRsj (ORCPT ); Fri, 19 Feb 2021 12:48:39 -0500 Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11JHkKtV017637; Fri, 19 Feb 2021 18:47:50 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=selector1; bh=+HyNAQrU/4esjJvyfTary0eok3bAQb+Acgv+8Q4Ubw4=; b=C4A5Mr170jU21wyX2MgFVold+CBSNuu7Soszt2Xyrp5nYQ6ZaII0AualNYacLoVXAm/9 jaKOyP6pTA5XVfjIssJtm/8tEH/nm9z3yBr2/gegNn89AzQukrWkHABDbQ/fDc3sSJyj m5ubO1atxlvodcrcA9/LkJ4UKDUHaFn2JISZjduR1iJhe6fNQQtC1fV++CI55vcUztV1 iOqu0zf0Zmj9Xt1WCgAnrIkOmt4sbnsBhTzE9WxyrnjPH2nVnU+JX8YYf6YoqAFWgzTL 0GdcFYvYdtRIcIhEQ2lCyUN6LP4/UwVkIfrw+xgM558QOu/CfyxmKTps9gG5UeC8dzYE fA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 36p7075516-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Feb 2021 18:47:50 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id DD43910002A; Fri, 19 Feb 2021 18:47:49 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id D2B6D25F3FD; Fri, 19 Feb 2021 18:47:49 +0100 (CET) Received: from localhost (10.75.127.47) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 19 Feb 2021 18:47:49 +0100 From: Erwan Le Ray To: Greg Kroah-Hartman , Jiri Slaby , Maxime Coquelin , Alexandre Torgue CC: , , , , Erwan Le Ray , Fabrice Gasnier , Valentin Caron Subject: [PATCH 10/13] serial: stm32: fix FIFO flush in startup and set_termios Date: Fri, 19 Feb 2021 18:47:33 +0100 Message-ID: <20210219174736.1022-11-erwan.leray@foss.st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210219174736.1022-1-erwan.leray@foss.st.com> References: <20210219174736.1022-1-erwan.leray@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG2NODE3.st.com (10.75.127.6) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-02-19_08:2021-02-18,2021-02-19 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index bdd7ca490021..45203648172b 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -657,7 +657,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); @@ -762,8 +762,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.17.1