From patchwork Tue Jul 26 09:12:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 594033 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7247AC433EF for ; Tue, 26 Jul 2022 09:12:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229527AbiGZJMl (ORCPT ); Tue, 26 Jul 2022 05:12:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230093AbiGZJMl (ORCPT ); Tue, 26 Jul 2022 05:12:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F8522CDD2; Tue, 26 Jul 2022 02:12:40 -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 dfw.source.kernel.org (Postfix) with ESMTPS id CD07A6157C; Tue, 26 Jul 2022 09:12:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14844C341C0; Tue, 26 Jul 2022 09:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658826759; bh=I7oFMsDd+NqwunPLpzOEtgV7hXHXjObjS4RaSddRgOc=; h=From:To:Cc:Subject:Date:From; b=ZOP9tWOq4LDCmmIBNWcloFwr55JWunqasmdmS3tq9iNoEAa4aMv1daGm0sJL/OMWw uzjF2A+irxJEAkjDX7tv2YMLcWkngcDzN7uGKlCr08PvHYMlKZYOSQgbdzJQXihIJH MuJ77X0UHUhFxpVf/5VZhDyjOK6w2QhON4V84kCIXCjNRaIh3z1hXsmbDtJhtkbhRW AoPvO5l4B5qAxKYN/nuLb3w5/SwmQ8HpMKjE1IzjpvcTREah0Y+D7zNwZ2gKlcpx3n ZiH7C725c39tGt5QeSoEfrk6JLwV4UM9VNQuOVjgT9Brhii8uKEp9yK3KQaadcmmyu eUjRRCcJiY3TA== Received: by pali.im (Postfix) id 2AE4482D; Tue, 26 Jul 2022 11:12:36 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Greg Kroah-Hartman , Jiri Slaby Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] serial: mvebu-uart: uart2 error bits clearing Date: Tue, 26 Jul 2022 11:12:21 +0200 Message-Id: <20220726091221.12358-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Narendra Hadke For mvebu uart2, error bits are not cleared on buffer read. This causes interrupt loop and system hang. Signed-off-by: Narendra Hadke Reviewed-by: Yi Guo Reviewed-by: Nadav Haklai Signed-off-by: Pali Rohár Cc: stable@vger.kernel.org --- drivers/tty/serial/mvebu-uart.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c index 0429c2a54290..ff61a8d00014 100644 --- a/drivers/tty/serial/mvebu-uart.c +++ b/drivers/tty/serial/mvebu-uart.c @@ -265,6 +265,7 @@ static void mvebu_uart_rx_chars(struct uart_port *port, unsigned int status) struct tty_port *tport = &port->state->port; unsigned char ch = 0; char flag = 0; + int ret; do { if (status & STAT_RX_RDY(port)) { @@ -277,6 +278,16 @@ static void mvebu_uart_rx_chars(struct uart_port *port, unsigned int status) port->icount.parity++; } + /* + * For UART2, error bits are not cleared on buffer read. + * This causes interrupt loop and system hang. + */ + if (IS_EXTENDED(port) && (status & STAT_BRK_ERR)) { + ret = readl(port->membase + UART_STAT); + ret |= STAT_BRK_ERR; + writel(ret, port->membase + UART_STAT); + } + if (status & STAT_BRK_DET) { port->icount.brk++; status &= ~(STAT_FRM_ERR | STAT_PAR_ERR);