Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp828240ybl; Wed, 11 Dec 2019 08:07:10 -0800 (PST) X-Google-Smtp-Source: APXvYqxHbMejR8vGahTdsooo6bUkldP0iYOkkPKAi0Ks9dHdAM6V/P3CSv1DcTHsw2fbKHNjj1m2 X-Received: by 2002:a9d:7c8f:: with SMTP id q15mr2924730otn.341.1576080429936; Wed, 11 Dec 2019 08:07:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080429; cv=none; d=google.com; s=arc-20160816; b=m98BjMhxH9Je9EC7y/Vjpx2mtxJc4lveKjHFbKylpCO/ncVTtkeHnUqR3H01s688Mk s0seh7MQn4bfZcg1XRi0VGG4S2GXTXvxYBaPIPpA2XXWvHRHpI3K5KC2wQ8nGU24ojNx 7mSKdphIpsbzxDZT7KIA0Nh27rcyLPc2pP2GGVfiRCYzVrI3+oqNBnZ8RbkWu7pu06Fp Qm4TKV3W7D1dIx4lR+vQFbEQ6peoQteQ6ya068sxHSZgmwcPVhkxVVg1qm+eBX3k78z6 9Zq8ZYBkNN0RPBOxxboeBYvTi1+5L4X1HskGP+d29fD4PWJbsBvfeeR0gxMjNd3MJhs6 dqLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=x4oj6hTaLtZdBpAVz/3dRvpxK0l05vBLMRkVk3LrwI8=; b=nprW/1TTQDCm7tfdzQT1dEb4zx8uy7LkbqMQxywLGm7cPULkIZ/HSpztRpMTlca37Q e7PE/kIVIV/k12CJvVNL/0IVaBgxbUBsQvKvpZkwydz/wuJpBSKF2fgQZwdORcG9jViX WxvZ5TsiFo1VUwWySVoU65UDY2OuijEC6rz+fEF1vNvZqs7qjywkrgePr9E2XDi3N+GD KBue5iOwe6UoYeYC4BvYbz81+s3PwWICtWuLZxPCIXVKTb4zobgO1zWbB4ZVnx/+vWBm ZHjaLgFx5rPTtj9MvW8Vf3RNsCA3/3F9/o2iro9J93O4xDMkHbrO3V+Zm76LfHOvlnGA uKjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="RODhA/T3"; 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 s14si1146274otq.37.2019.12.11.08.06.57; Wed, 11 Dec 2019 08:07:09 -0800 (PST) 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=pass header.i=@kernel.org header.s=default header.b="RODhA/T3"; 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 S1732941AbfLKQE0 (ORCPT + 99 others); Wed, 11 Dec 2019 11:04:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:35792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730267AbfLKPNC (ORCPT ); Wed, 11 Dec 2019 10:13:02 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6E4E724684; Wed, 11 Dec 2019 15:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077181; bh=RXr2DM/uQQoQ/6KUgA6s1XB/AQUmAh3cUi4wj6XWrR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RODhA/T3t3d5Fo71QmKXa6i9RrZ6pAvcdWbBShXAPSo64RNdKvfNRF9Xl1s9C74XB yorHGhMC+TRXAh6WFFY6ygWwQAno8bIAB5JyOjOQmayJ7u1dgj99dri1UEXaHPxRpY 9cj0TVZDOTQNNgv1NmtJTNGbn54SOgdcr1fnUYOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabrice Gasnier Subject: [PATCH 5.3 012/105] serial: stm32: fix clearing interrupt error flags Date: Wed, 11 Dec 2019 16:05:01 +0100 Message-Id: <20191211150223.823667644@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fabrice Gasnier commit 1250ed7114a977cdc2a67a0c09d6cdda63970eb9 upstream. The interrupt clear flag register is a "write 1 to clear" register. So, only writing ones allows to clear flags: - Replace buggy stm32_clr_bits() by a simple write to clear error flags - Replace useless read/modify/write stm32_set_bits() routine by a simple write to clear TC (transfer complete) flag. Fixes: 4f01d833fdcd ("serial: stm32: fix rx error handling") Signed-off-by: Fabrice Gasnier Cc: stable Link: https://lore.kernel.org/r/1574323849-1909-1-git-send-email-fabrice.gasnier@st.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/stm32-usart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -239,8 +239,8 @@ static void stm32_receive_chars(struct u * cleared by the sequence [read SR - read DR]. */ if ((sr & USART_SR_ERR_MASK) && ofs->icr != UNDEF_REG) - stm32_clr_bits(port, ofs->icr, USART_ICR_ORECF | - USART_ICR_PECF | USART_ICR_FECF); + writel_relaxed(sr & USART_SR_ERR_MASK, + port->membase + ofs->icr); c = stm32_get_char(port, &sr, &stm32_port->last_res); port->icount.rx++; @@ -434,7 +434,7 @@ static void stm32_transmit_chars(struct if (ofs->icr == UNDEF_REG) stm32_clr_bits(port, ofs->isr, USART_SR_TC); else - stm32_set_bits(port, ofs->icr, USART_ICR_TCCF); + writel_relaxed(USART_ICR_TCCF, port->membase + ofs->icr); if (stm32_port->tx_ch) stm32_transmit_chars_dma(port);