Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp234289lqs; Mon, 4 Mar 2024 23:35:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVt/GnNQ8Wl2cU57twsF5R4CsdXw89XHHqE0uqw84crQochfQO16n7NdrnWlNNCEjAXD+ElKgcfKq79iyM+jMWxzHeJmhl64WYDZ6GX8w== X-Google-Smtp-Source: AGHT+IGShV7yRpwi0LWOK3hZkvaXd0Z+iIhjsmVJC+G61j+NTD1ix91foJjtDWcbvrAhT9Wfn6nf X-Received: by 2002:a17:906:13d5:b0:a45:95f5:f314 with SMTP id g21-20020a17090613d500b00a4595f5f314mr1089093ejc.42.1709624140690; Mon, 04 Mar 2024 23:35:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709624140; cv=pass; d=google.com; s=arc-20160816; b=RVEeij1+2IOwo33410vRRY1FI47t/4Iq2Q2CVpSrCMoIdtsVVaKV6qZhVgsC7d7beu u0HNlxFZ6giJrAhQ3KD1/Wt2dCQLdbqp0UYNqsHsRsiP48oFXXwpJIHZJc8H+ZS1SD1C d2KpMHoQ0qrO75nUJplYKH9t1c98Fmiu8oNDDwGOA/1CQiCDoP50L7fwh0S4ggo+zgOW C5BkPJHBqrUVTWkUOJH0GD+hju6mF6Iw8KS4TezW2g3zuNEGrIc1jYteuEN8Z6f8aD3r JLQEK4sAMRd+eFlwaEov1C/Yb4t7KtI9nMArJTdoXR+htqabyIzvByCFXtGirfjx4fRL LjPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=S3nv8Its/qHThgXCF37Flm10SH2+lqRTT9fG6BEzgP8=; fh=eyQwS5wEBoxfsyzr3bQJtvrskuq7V374Q4lQfPPZv08=; b=xjfA7/7zNoYVPAV/UpMTlK+5lIzA23H99lo9l0WL9mTCO+zdCdAJM+/1z5oosIHIPe UUULb2qKvPoihH1aAI876qw3W5wdWa4frN0WsrfCH6/KDbEVAYdiUNi1FeMQLg8IiO1A LN8uYLPQ9PQvHLXeQFvpSqZpwTgls0foX2CFAWem9hG8gzTBESzPym2Jjz5P7a0ZPjis j+Hy98Y2Esi3GVLBVwUSaSXoLm7VapPADsJ4pInIktT6Apwy4zp/1BS+fIwxDVG/Oir+ hGdppe3LZA/aLMkxTqIFVZbRoK7ilIPjpehIsoPwEHjPR/517NyvKwOTtGatfpbdTxp5 hkjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="BFDziI/S"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-91817-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91817-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o17-20020a1709061b1100b00a45788b6fa3si1138377ejg.9.2024.03.04.23.35.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 23:35:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91817-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="BFDziI/S"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-91817-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91817-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 434211F238DF for ; Tue, 5 Mar 2024 07:35:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87D357E772; Tue, 5 Mar 2024 07:35:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BFDziI/S" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FAED7E564; Tue, 5 Mar 2024 07:35:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709624132; cv=none; b=Pp+KtOmFqrm4SJ6M5TouhWJMViABsjhoOJVEWjj+2u57OXyIcGS745PaokMdvSZB0Gln07Q/TjOffE4BJyWrbZvU7hHCpx9Tq/8BWqqNJ4A41ePeUg0zq12cn1FMlwDe1V7uoXw5QD0jdcGwTg4hiZlYHnl5dppgkasvbx8JF18= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709624132; c=relaxed/simple; bh=9mE8JGFRmIiaAXwJrEkI8C/6vowaKjT3QgtdT5nxS10=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=htC0wlel3fKDI8uuLuSJZUUsCpEfclc1HuO3X/0nI6K4++uzDTqv7sBOzszKXz1KpNc9KzgwEc16Lo88N+7iAKNRkvqyS9Sv7s3Rx0XFcn9rv/CNQVuP/Ex2BePLFj0XuZUbT2fexthC8kcVs0Fn28rKK/MgkjFV9/ir8ZypKqc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BFDziI/S; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89CDAC433F1; Tue, 5 Mar 2024 07:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709624132; bh=9mE8JGFRmIiaAXwJrEkI8C/6vowaKjT3QgtdT5nxS10=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BFDziI/SFGMNLoO162znoeRmfJIet1EyZZ0jpgaU7j8q27USEhFhaiAvUsrqIpfNA hzzdPWE2+S4AZbj9gb67MpaHvd3/n2VyaPlIGR9F+67muyX5ehwkneDNFUE3g1wUgL Hlm6gxPjqlDH6mzIsg1FGrtjk2Am8a9ofXDn9kdM= Date: Tue, 5 Mar 2024 07:35:28 +0000 From: Greg KH To: Sherry Sun Cc: jirislaby@kernel.org, u.kleine-koenig@pengutronix.de, ilpo.jarvinen@linux.intel.com, shenwei.wang@nxp.com, alexander.sverdlin@siemens.com, robert.hodaszi@digi.com, robh@kernel.org, tglx@linutronix.de, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, frank.li@nxp.com Subject: Re: [PATCH V2] tty: serial: fsl_lpuart: avoid idle preamble pending if CTS is enabled Message-ID: <2024030517-paging-voter-6054@gregkh> References: <20240305015706.1050769-1-sherry.sun@nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240305015706.1050769-1-sherry.sun@nxp.com> On Tue, Mar 05, 2024 at 09:57:06AM +0800, Sherry Sun wrote: > If the remote uart device is not connected or not enabled after booting > up, the CTS line is high by default. At this time, if we enable the flow > control when opening the device(for example, using “stty -F /dev/ttyLP4 > crtscts” command), there will be a pending idle preamble(first writing 0 > and then writing 1 to UARTCTRL_TE will queue an idle preamble) that > cannot be sent out, resulting in the uart port fail to close(waiting for > TX empty), so the user space stty will have to wait for a long time or > forever. > > This is an LPUART IP bug(idle preamble has higher priority than CTS), > here add a workaround patch to enable TX CTS after enabling UARTCTRL_TE, > so that the idle preamble does not get stuck due to CTS is deasserted. > > Fixes: 380c966c093e ("tty: serial: fsl_lpuart: add 32-bit register interface support") > Signed-off-by: Sherry Sun > --- > Changes in V2: > 1. Move the "restore control register" comment message to the appropriate place. > 2. Add Fixes tag. > --- > drivers/tty/serial/fsl_lpuart.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c > index 5ddf110aedbe..bbcbc91482af 100644 > --- a/drivers/tty/serial/fsl_lpuart.c > +++ b/drivers/tty/serial/fsl_lpuart.c > @@ -2345,9 +2345,12 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, > > lpuart32_write(&sport->port, bd, UARTBAUD); > lpuart32_serial_setbrg(sport, baud); > - lpuart32_write(&sport->port, modem, UARTMODIR); > - lpuart32_write(&sport->port, ctrl, UARTCTRL); > + /* disable CTS before enabling UARTCTRL_TE to avoid pending idle preamble */ > + lpuart32_write(&sport->port, modem & ~UARTMODIR_TXCTSE, UARTMODIR); > /* restore control register */ > + lpuart32_write(&sport->port, ctrl, UARTCTRL); > + /* re-enable the CTS if needed */ > + lpuart32_write(&sport->port, modem, UARTMODIR); > > if ((ctrl & (UARTCTRL_PE | UARTCTRL_M)) == UARTCTRL_PE) > sport->is_cs7 = true; > -- > 2.37.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: - You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve 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