Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1068663rdh; Fri, 24 Nov 2023 04:46:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9GTPhnK9/H2tEpmpH+qfSWIJS950FIp9jxukoFGdFzmcZdCaoYSSHh8VAQy2uqLx+WvRX X-Received: by 2002:a05:6808:16ab:b0:3b2:f175:541b with SMTP id bb43-20020a05680816ab00b003b2f175541bmr3035895oib.48.1700829962670; Fri, 24 Nov 2023 04:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700829962; cv=none; d=google.com; s=arc-20160816; b=wggXG9B5qvzRcZPnQbiLumNzjxpusDxAC9fy2qOGgOyRUjv7PcyQX11Ozhexedo1yI VaiFdW5TFMNbt7frwyBRyLSjTQb7rWG5F+sAsOf6c9annETg80RaRApTUOdrOHTQ4PxL F95F9PhZpzOnnjc8S15anX1v9xzegg2qy41M0N4IMyPoD+nyvFDYAfXWWNz1mSNEMUne eR0h5CMPGv2an/lwgDyKpfQjUKaBB7CpuoAtkEIvjheG6dx8yNFgmsAIOARrd5qWkmrl eQZ6zXmEFD2wQlUzHCZuMFksyZIVEmynFZX8zuQ8NwNNJuQBYpt2cqIN+HFlqMYNMPJg WuDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=l7MR3A+XFH0KgJIFGb7Ohj5n67OSOf/n+j/6kZQO23s=; fh=7d19mWCEhEA4XPWphu0tNUTV9ZsDRH336pbO/EcOmtg=; b=eh7/IKaHJZ4D3g0cTd5PKyu5Pti7cirE7vZhgKiu16K5PzXd8aUiTxQxKCMlTFsR2h 8jYN5rtZlvOviz/62fAx8fnMdvAJENfDSbMsmEAXTzjxNMxy/H5lkFUOQpoIRBoagNg2 2V9ms5U7b498/ws6l8o//W1W844tQ14QWXepdxpuVOrjbwSnzhOewuI97Xbrm2W3LjCF zUzouyGU5EEdstTGQ/KmDVwo9Ae6lhgB6dw8u2jO12Fdoos6Qkl+D+Q8iTtNSq2hrGr1 6WWPkUCtF6NKsAiQxeaeIVSOgXwraQpmpIG1zE4049RosMIRJhVWyOMSGnIucBDI96bJ a35A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KLmvsSKX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id m8-20020a0568080f0800b003b83d8c702fsi1299906oiw.21.2023.11.24.04.45.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 04:46:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KLmvsSKX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 7F76180ABFF2; Fri, 24 Nov 2023 04:45:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345123AbjKXMpc (ORCPT + 99 others); Fri, 24 Nov 2023 07:45:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345088AbjKXMpa (ORCPT ); Fri, 24 Nov 2023 07:45:30 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07337BC for ; Fri, 24 Nov 2023 04:45:37 -0800 (PST) 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 24 Nov 2023 04:45:55 -0800 (PST) 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