Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2930584ybc; Thu, 21 Nov 2019 00:14:13 -0800 (PST) X-Google-Smtp-Source: APXvYqzWexincXkeQlpDIEmz8fp6yyim/XvelCG7QQd1RdO3DZXqpUe7eESA4aEyMCxGhTRu2V6B X-Received: by 2002:a17:906:6006:: with SMTP id o6mr11908777ejj.51.1574324053448; Thu, 21 Nov 2019 00:14:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574324053; cv=none; d=google.com; s=arc-20160816; b=jOeSMlgdAhj/8BGd30H3nshnxIwyWc71AkVhKpsZ8wifnKzbbSQow1VZkxuo/+1G2N +STn23iXJENf3E2hAo1B6OfKIOkOnIXJ4R8M0YrTc2/AqOUAU9Z7UJXYTBkUBIDDh2QX itbrumYta5KAWXClQckCQJyguaG6TkKfU/a2V/Rqpdg83S0lrI9EsIG7GYGVQnqCQbae xIAUnGbiaJAZlO7RF5/qE4imOqPLv9tPXxMoV/sUWr0pw1E+f4QmrsNCQ37VJA3D5RB8 VSOy+jBc1x9Wt/w63rdpbI/W2jvCU+2u/KeDq7gZMy0+jpvEWmlpsmVBtQfwwyxvD4Yv 52tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=GWwWrFi5wSZs1dSwlxyGvTTXgdVuoIjTIkdP2E8ouLA=; b=xey0fU1PnQL65wLJDV1Uz9gPYNZeNnJeigpGLZJJjhupjWWffHKyijudJMfjXu6pmQ TU91jVmHVUnKLdBxNbbge5hwAFdVaYTnLuKnDNG1iPIhv/cxY4EcakO25njFfI3ohIuq y198kRp5d3fXBX7DUtaei7YmErGGAydu1Wxmt2TOlViUe+lwbjQ7ghjzxuF0OE142CBk MLqHylbaiXW/LCQhhwNubTfgIvan+jlg9PLbFkKpiJWjolaC1sadIQ1cZOWBvEFX5NG3 xj9s9O+h8CR3WU8SXLvEjXnQ73lDu8coeoNvKBr46XOYHpuSC26QLcZKueIBnjIMEhfW 2JMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=KJV6yzI0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d28si1588678edb.10.2019.11.21.00.13.48; Thu, 21 Nov 2019 00:14:13 -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=@st.com header.s=STMicroelectronics header.b=KJV6yzI0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726623AbfKUIMx (ORCPT + 99 others); Thu, 21 Nov 2019 03:12:53 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:35421 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726362AbfKUIMx (ORCPT ); Thu, 21 Nov 2019 03:12:53 -0500 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAL82b02008129; Thu, 21 Nov 2019 09:11:18 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=STMicroelectronics; bh=GWwWrFi5wSZs1dSwlxyGvTTXgdVuoIjTIkdP2E8ouLA=; b=KJV6yzI0CwZ7sL2Q3YyrvfL+B+ApSj9nDdroDdxbJIjrP1hzjbTrpmut5RGbIAQqD8cK hvt1vO3+ZRAZF6ND3q0fZujZOfkUdUGh07thnlRQxCy5+hivn9/nUlnF1rUJFjuqXhtv v1DkC9/40R2XrKD5R/UZe6Nw7naR/zviL6bzQYSnyI2HOFpd0oito5hOUV0I6UdHKbXq gUFOGYr5N5/8UbwkZ2gnljMnFibSZ1Bgr7wMpV2JSXD5Fn62GjyHZ6nlOunCjLHHFmk7 zENKBurM2kq+363p1t3O2fGN03ka35egyJ0fdEfUi2gwqQCxewfelRa+mgJOzcauUufG Nw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2wa9usj02n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Nov 2019 09:11:18 +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 4185B100034; Thu, 21 Nov 2019 09:11:18 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag5node3.st.com [10.75.127.15]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2FB992AE93B; Thu, 21 Nov 2019 09:11:18 +0100 (CET) Received: from localhost (10.75.127.47) by SFHDAG5NODE3.st.com (10.75.127.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 21 Nov 2019 09:11:17 +0100 From: Fabrice Gasnier To: CC: , , , , , , , Subject: [PATCH] serial: stm32: fix clearing interrupt error flags Date: Thu, 21 Nov 2019 09:10:49 +0100 Message-ID: <1574323849-1909-1-git-send-email-fabrice.gasnier@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG4NODE2.st.com (10.75.127.11) To SFHDAG5NODE3.st.com (10.75.127.15) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-20_08:2019-11-20,2019-11-20 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 df90747..2f72514 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -240,8 +240,8 @@ static void stm32_receive_chars(struct uart_port *port, bool threaded) * 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++; @@ -435,7 +435,7 @@ static void stm32_transmit_chars(struct uart_port *port) 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); -- 2.7.4