Message ID | 20240201105557.28043-2-jirislaby@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-47992-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp72984dyb; Thu, 1 Feb 2024 03:11:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTXusmp/bG9m5Za0uG7YBOryxqqL7YoGTx15eYHl/C1pglBo0nIrxXo20ae2Fc4hOwgujJ X-Received: by 2002:a17:90a:e50e:b0:290:6895:aff6 with SMTP id t14-20020a17090ae50e00b002906895aff6mr3821697pjy.48.1706785880241; Thu, 01 Feb 2024 03:11:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706785880; cv=pass; d=google.com; s=arc-20160816; b=X8D1B92bjGlbCmirwN0uOtmCZgcwp0EmBemgF9SCIRWE8OjpwQTQMn7xFAVUOcsIdQ XZX705XEPlX4KFW+pfqiwY5W3VdWOqN7R9GnD8utsnTj/2m5RrlCk9VYME2Mz0sX1qXE nmUfLWuYNjS5WdogLdQk0cuJ2aXW3iepoYKUsMKA9Z4/58c0Jpu1MF6A/NhWtUz+pyhY SugYz1VzYpQCqpkzDtV+qAhTG/bB5hsSeO2MeoKSFpHDnVda+OSlc0G0cPOsiIc6jv60 X1G+tfsF/PcmwWl1DgLGTEfO5KnOF1RWDdQV2ukHvRBtDrBZ3zfyqtsu2xvK0xLV3lh1 W3hA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=1RKaxNCFWEvZIzSwmgrR3pWvf/z7eu3LhgzQRfT4iyw=; fh=Oe66JGPGe+i475v9dsbq4+ueqX3vOm8SqnLUAF+BRLg=; b=TUH3CKRvdpMCJ0EopIWPge/qfA5rXzriXRyt6ZwM5elDoZYLMx2yDA1T+8vRlKCNJf vPJxWbNvR/tYWfBmkzwgBVadna63OdGeQHcWsoZWPTM0CV5NKJfhl3rOwJqMuAtrl2X8 /KAIiTdJLHx4yYyf/HiBtpxvvzbtGGxoUHGjHGZiJOIaN2mYIuB53w/ZR3UdkwUWUR/6 d59d950W9OeZq1hElisvk+nFypQVjuIORWTBcn7Z/gfN1nLb3VJ6aw82ZiJjMblol0T1 xCty9nP5sLzmlyqo5FL8lI6+c9fu2ohc24mK1jE9Ee+qbGJX19OWr/glGXcuf+lTwhuE Heqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QUaKph8x; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47992-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47992-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVflwdl0IwPHXSbbf6azHPHmXgnqjQu5bulyZdyew0iVB6Iy0C/1ug8n32gBYiK7RM1oo8AlJeRH8so20PO2qD0YMG0Aw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q9-20020a17090a9f4900b0029615edd44bsi1184575pjv.99.2024.02.01.03.11.19 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 03:11:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47992-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QUaKph8x; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47992-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47992-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BB659B2249F for <ouuuleilei@gmail.com>; Thu, 1 Feb 2024 10:56:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B0C815D5A1; Thu, 1 Feb 2024 10:56:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QUaKph8x" 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 8CCFC15CD43; Thu, 1 Feb 2024 10:56:03 +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=1706784963; cv=none; b=BvyUuW2DkfPPzitmBCuFKmnQPrThAVoHBtsiN65Nek53ZmSTO5Gys3X8KAWYqYNXJZGuDnU8BnXicjicx/JwLjWjb+iqKFGcOui+sWgnXfEvFKi0fcgWL7YpxuuQcPranDTRCv4tA/mKw6ec65cDu2m8Ija8IK7lAQBzZVNRYns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706784963; c=relaxed/simple; bh=o3j5KqVdt8Au5j0om5ZdjUVuI6rkV1Y9G2/tHqdbaOU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dAHCmmGJt79+NfelF7Yz4nd83ohqrjVmhry5XmKVsBKgH1QmH8aRArD3qqQQUxb4NVCm0Nmk3P4tRzDw5UVI15jJqhw90u9VpSuiUAj0hFnJdbrVaXaUuvrVTxox/M8e6fVk59vEmWCO2pM4uqIzSnNn6sZJDTfheNERYcU15kk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QUaKph8x; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5C3BC433C7; Thu, 1 Feb 2024 10:56:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706784963; bh=o3j5KqVdt8Au5j0om5ZdjUVuI6rkV1Y9G2/tHqdbaOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QUaKph8xPqGQ3Q0JdaB99nurQQt85rvSlaTcysObhdRWMIaXD28BaQ4epSB/Ew7LV LZDaEHppz9Ead7F5/mp6Ej7Hoax0ufsG+QDrF9Gu9GXiLXJiOCApISxcsSo0WEl/AQ OU5FVpDkPDHKLjBSVT6J4Ee8SXQurdriEBhR3YzbssZxs8EgOP0fyMNa7lYnOPJAnR RKxFkYavoMKxrId9fR5kdWgnjDR9AFEAMLE7O+OYzNhGExRXSy08LFDQKbVfiUQ+yf 3qYM1xNEM+VMxEYcubJNH8ZSNWi8tNcO4v5QRh/31xdHTdzDXyd1OtiCypTPBxS7B/ YxrmA8FOKz+AA== From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" <jirislaby@kernel.org>, Emil Kronborg <emil.kronborg@protonmail.com> Subject: [PATCH v2 2/2] serial: mxs-auart: fix tx Date: Thu, 1 Feb 2024 11:55:57 +0100 Message-ID: <20240201105557.28043-2-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201105557.28043-1-jirislaby@kernel.org> References: <20240201105557.28043-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789694711113291551 X-GMAIL-MSGID: 1789694711113291551 |
Series |
[v2,1/2] serial: core: introduce uart_port_tx_flags()
|
|
Commit Message
Jiri Slaby
Feb. 1, 2024, 10:55 a.m. UTC
Emil reports:
After updating Linux on an i.MX28 board, serial communication over
AUART broke. When I TX from the board and measure on the TX pin, it
seems like the HW fifo is not emptied before the transmission is
stopped.
MXS performs weird things with stop_tx(). The driver makes it
conditional on uart_tx_stopped().
So the driver needs special handling. Pass the brand new UART_TX_NOSTOP
to uart_port_tx_flags() and handle the stop on its own.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Reported-by: Emil Kronborg <emil.kronborg@protonmail.com>
Fixes: 2d141e683e9a ("tty: serial: use uart_port_tx() helper")
Closes: https://lore.kernel.org/all/miwgbnvy3hjpnricubg76ytpn7xoceehwahupy25bubbduu23s@om2lptpa26xw/
---
drivers/tty/serial/mxs-auart.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Comments
On 01. 02. 24, 11:55, Jiri Slaby (SUSE) wrote: > Emil reports: > After updating Linux on an i.MX28 board, serial communication over > AUART broke. When I TX from the board and measure on the TX pin, it > seems like the HW fifo is not emptied before the transmission is > stopped. > > MXS performs weird things with stop_tx(). The driver makes it > conditional on uart_tx_stopped(). > > So the driver needs special handling. Pass the brand new UART_TX_NOSTOP > to uart_port_tx_flags() and handle the stop on its own. > > Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> > Reported-by: Emil Kronborg <emil.kronborg@protonmail.com> > Fixes: 2d141e683e9a ("tty: serial: use uart_port_tx() helper") > Closes: https://lore.kernel.org/all/miwgbnvy3hjpnricubg76ytpn7xoceehwahupy25bubbduu23s@om2lptpa26xw/ Am I unable to send a proper patch anymore? I forgot to add mxs+arm maintainers: Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Pengutronix Kernel Team <kernel@pengutronix.de> Cc: Fabio Estevam <festevam@gmail.com> Cc: NXP Linux Team <linux-imx@nxp.com> Cc: linux-arm-kernel@lists.infradead.org I can resend with those fixed, if you prefer... > --- > drivers/tty/serial/mxs-auart.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c > index 3ec725555bcc..4749331fe618 100644 > --- a/drivers/tty/serial/mxs-auart.c > +++ b/drivers/tty/serial/mxs-auart.c > @@ -605,13 +605,16 @@ static void mxs_auart_tx_chars(struct mxs_auart_port *s) > return; > } > > - pending = uart_port_tx(&s->port, ch, > + pending = uart_port_tx_flags(&s->port, ch, UART_TX_NOSTOP, > !(mxs_read(s, REG_STAT) & AUART_STAT_TXFF), > mxs_write(ch, s, REG_DATA)); > if (pending) > mxs_set(AUART_INTR_TXIEN, s, REG_INTR); > else > mxs_clr(AUART_INTR_TXIEN, s, REG_INTR); > + > + if (uart_tx_stopped(&s->port)) > + mxs_auart_stop_tx(&s->port); > } > > static void mxs_auart_rx_char(struct mxs_auart_port *s)
On Thu, Feb 01, 2024 at 01:05:42PM +0100, Jiri Slaby wrote: > On 01. 02. 24, 11:55, Jiri Slaby (SUSE) wrote: > > Emil reports: > > After updating Linux on an i.MX28 board, serial communication over > > AUART broke. When I TX from the board and measure on the TX pin, it > > seems like the HW fifo is not emptied before the transmission is > > stopped. > > > > MXS performs weird things with stop_tx(). The driver makes it > > conditional on uart_tx_stopped(). > > > > So the driver needs special handling. Pass the brand new UART_TX_NOSTOP > > to uart_port_tx_flags() and handle the stop on its own. > > > > Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> > > Reported-by: Emil Kronborg <emil.kronborg@protonmail.com> > > Fixes: 2d141e683e9a ("tty: serial: use uart_port_tx() helper") > > Closes: https://lore.kernel.org/all/miwgbnvy3hjpnricubg76ytpn7xoceehwahupy25bubbduu23s@om2lptpa26xw/ > > Am I unable to send a proper patch anymore? > > I forgot to add mxs+arm maintainers: > Cc: Shawn Guo <shawnguo@kernel.org> > Cc: Sascha Hauer <s.hauer@pengutronix.de> > Cc: Pengutronix Kernel Team <kernel@pengutronix.de> > Cc: Fabio Estevam <festevam@gmail.com> > Cc: NXP Linux Team <linux-imx@nxp.com> > Cc: linux-arm-kernel@lists.infradead.org > > I can resend with those fixed, if you prefer... Nah, this is fine, I'll take this as-is, thanks! greg k-h
On Thu, Feb 01, 2024 at 11:55 +0100, Jiri Slaby (SUSE) wrote: > Emil reports: > After updating Linux on an i.MX28 board, serial communication over > AUART broke. When I TX from the board and measure on the TX pin, it > seems like the HW fifo is not emptied before the transmission is > stopped. > > MXS performs weird things with stop_tx(). The driver makes it > conditional on uart_tx_stopped(). > > So the driver needs special handling. Pass the brand new UART_TX_NOSTOP > to uart_port_tx_flags() and handle the stop on its own. > > Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> > Reported-by: Emil Kronborg <emil.kronborg@protonmail.com> > Fixes: 2d141e683e9a ("tty: serial: use uart_port_tx() helper") > Closes: https://lore.kernel.org/all/miwgbnvy3hjpnricubg76ytpn7xoceehwahupy25bubbduu23s@om2lptpa26xw/ > --- > drivers/tty/serial/mxs-auart.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c > index 3ec725555bcc..4749331fe618 100644 > --- a/drivers/tty/serial/mxs-auart.c > +++ b/drivers/tty/serial/mxs-auart.c > @@ -605,13 +605,16 @@ static void mxs_auart_tx_chars(struct mxs_auart_port *s) > return; > } > > - pending = uart_port_tx(&s->port, ch, > + pending = uart_port_tx_flags(&s->port, ch, UART_TX_NOSTOP, > !(mxs_read(s, REG_STAT) & AUART_STAT_TXFF), > mxs_write(ch, s, REG_DATA)); > if (pending) > mxs_set(AUART_INTR_TXIEN, s, REG_INTR); > else > mxs_clr(AUART_INTR_TXIEN, s, REG_INTR); > + > + if (uart_tx_stopped(&s->port)) > + mxs_auart_stop_tx(&s->port); > } > > static void mxs_auart_rx_char(struct mxs_auart_port *s) > -- > 2.43.0 > Tested on i.MX28. Tested-by: Emil Kronborg <emil.kronborg@protonmail.com>
Am 01.02.24 um 13:05 schrieb Jiri Slaby: > On 01. 02. 24, 11:55, Jiri Slaby (SUSE) wrote: >> Emil reports: >> After updating Linux on an i.MX28 board, serial communication over >> AUART broke. When I TX from the board and measure on the TX pin, it >> seems like the HW fifo is not emptied before the transmission is >> stopped. >> >> MXS performs weird things with stop_tx(). The driver makes it >> conditional on uart_tx_stopped(). >> >> So the driver needs special handling. Pass the brand new UART_TX_NOSTOP >> to uart_port_tx_flags() and handle the stop on its own. >> >> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> >> Reported-by: Emil Kronborg <emil.kronborg@protonmail.com> >> Fixes: 2d141e683e9a ("tty: serial: use uart_port_tx() helper") >> Closes: >> https://lore.kernel.org/all/miwgbnvy3hjpnricubg76ytpn7xoceehwahupy25bubbduu23s@om2lptpa26xw/ > Tested-by: Stefan Wahren <wahrenst@gmx.net> Thanks
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 3ec725555bcc..4749331fe618 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -605,13 +605,16 @@ static void mxs_auart_tx_chars(struct mxs_auart_port *s) return; } - pending = uart_port_tx(&s->port, ch, + pending = uart_port_tx_flags(&s->port, ch, UART_TX_NOSTOP, !(mxs_read(s, REG_STAT) & AUART_STAT_TXFF), mxs_write(ch, s, REG_DATA)); if (pending) mxs_set(AUART_INTR_TXIEN, s, REG_INTR); else mxs_clr(AUART_INTR_TXIEN, s, REG_INTR); + + if (uart_tx_stopped(&s->port)) + mxs_auart_stop_tx(&s->port); } static void mxs_auart_rx_char(struct mxs_auart_port *s)