From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6767EC61DF4 for ; Fri, 24 Nov 2023 12:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Vw/J3u9//vfbZ5tfa9iDNVAhrc5clzE4ZF5nDgv2nX0=; b=NTF7eZB6rSSr5P X5a5esgY6JwIEymTqXUeyBSy6H/T0iffvaJEjq609IYr6z8OAtZrRyIEuWkHlO7JLErBhXtkcDEkH HZvYr+apz5q5M6SnwVe5jF1gmxFfwTvdHwBqxRZWR6QeBmsLy6y02yMklm+xP234+dsa8G9XtqNRK 9KMCukxI7bHMWBP9BOwb+zR3LZe2d5pqzwi3f3xVZSZfxe77nWKZ1PV8RmSg18228Q7iisHnLWJ8Q he8ZQHCrn4hxNKoYZpuv/qz6k+zYGP3q7evuvNs5yy8g+MVIDeREQBSjicDhbzICcVKEvQGG5wyse VeuGu11VGjoWaNyLXqBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r6VZ0-007EKE-12; Fri, 24 Nov 2023 12:45:42 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r6VYw-007EIc-1q for linux-arm-kernel@lists.infradead.org; Fri, 24 Nov 2023 12:45:40 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 4C333B82FF6; Fri, 24 Nov 2023 12:45:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B422C433CA; Fri, 24 Nov 2023 12:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700829936; bh=HRayAKSlzDs5i112aYEw5QttU3Neh5+nZmBU4rEPlww=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KLmvsSKXtRFmm6LnuDFzkymf7c+o1kIroc5WqidVhhHwaCbm2aWp6HJSLTd6Hrjbj DjcE94go5kTPZVMJaATTGshD2VxZTDZWbG7AtAIATJZdGBNh5obzDdTk/ITbLr8BFJ /Amp6nhB56Z+iMwWI0QniN8nRXD4J2wCQzwninnQ= Date: Fri, 24 Nov 2023 12:45:34 +0000 From: Greg KH To: Paul Geurts Cc: jirislaby@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, u.kleine-koenig@pengutronix.de, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2] serial: imx: fix tx statemachine deadlock Message-ID: <2023112416-rind-gnat-cc80@gregkh> References: <2023100450-charger-disregard-9683@gregkh> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231124_044538_873706_AF07DA6D X-CRM114-Status: GOOD ( 29.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Nov 24, 2023 at 01:38:39PM +0100, Paul Geurts wrote: > When using the serial port as RS485 port, the tx statemachine is used to > control the RTS pin to drive the RS485 transceiver TX_EN pin. When the > TTY port is closed in the middle of a transmission (for instance during > userland application crash), imx_uart_shutdown disables the interface > and disables the Transmission Complete interrupt. afer that, > imx_uart_stop_tx bails on an incomplete transmission, to be retriggered > by the TC interrupt. This interrupt is disabled and therefore the tx > statemachine never transitions out of SEND. The statemachine is in > deadlock now, and the TX_EN remains low, making the interface useless. > > imx_uart_stop_tx now checks for incomplete transmission AND whether TC > interrupts are enabled before bailing to be retriggered. This makes sure > the state machine handling is reached, and is properly set to > WAIT_AFTER_SEND. > > Fixes: cb1a60923609 serial: imx: implement rts delaying for rs485 > > Signed-off-by: Paul Geurts > --- > drivers/tty/serial/imx.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index 708b9852a575..ad36c49c7898 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -415,13 +415,13 @@ static void imx_uart_stop_tx(struct uart_port *port) > ucr1 = imx_uart_readl(sport, UCR1); > imx_uart_writel(sport, ucr1 & ~UCR1_TRDYEN, UCR1); > > + ucr4 = imx_uart_readl(sport, UCR4); > usr2 = imx_uart_readl(sport, USR2); > - if (!(usr2 & USR2_TXDC)) { > + if ((!(usr2 & USR2_TXDC)) && (ucr4 & UCR4_TCEN)) { > /* The shifter is still busy, so retry once TC triggers */ > return; > } > > - ucr4 = imx_uart_readl(sport, UCR4); > ucr4 &= ~UCR4_TCEN; > imx_uart_writel(sport, ucr4, UCR4); > > -- > 2.20.1 > > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/process/submitting-patches.rst for what needs to be done here to properly describe this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel