From patchwork Wed Jan 31 12:13:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 194733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1863641dyb; Wed, 31 Jan 2024 04:51:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFC1jOnnnVdnMTS0JQhJEzOEEOFZDxAf/QqGhuYj0KYX/9j7EfepT91+ZqxYF/a4mav6M4T X-Received: by 2002:a05:6358:261c:b0:176:a5c2:8f19 with SMTP id l28-20020a056358261c00b00176a5c28f19mr1465284rwc.30.1706705508993; Wed, 31 Jan 2024 04:51:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706705508; cv=pass; d=google.com; s=arc-20160816; b=QMHc4g7uLELPpU9qtrkNY1G3XtaQuMfH5rHakKRoGp7Ek9ael2S+vtQh8008AI+2GP I5tJ1tcTIaLUxjtulKFagbURegoWD+XQG0I1VsDUxdzmewCmpn+L+m5jG7r6gns0n3xq PGqnArnefFBvfb2MIt9vcmboN7SZcwIYtr1S6ESPIeYm8CptMeJ9uC5BvoHqFDBV4f6N dLtqxUvQ/bIhb6mCZhQ8WWA+pyBoH1zDpokrcO20pawCFUTuh5moGA9MkVjPYIBJw8Lo FHdSx0pjRFTxqgGLtLhDhJ8KvRxCZIRo92N6l+avwJp6elLiU77BMXGHSszcre17mANP u26Q== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=kS+BpSparmTZFECI8+NrYga88ifeVCqB16dHcwoPHcE=; fh=2uLUxCNWFACUKspdBhTFBOYPk4y3iS6YvuoMaJIb1C4=; b=aoo4UNoU/PHruXAEnf4qqgiQJhbNMQzO5IFZ5JLHt1G2IhWEO2X8UHmQGTnLt1uNrt oMc0lEnE34MCIsnCWS16WsXiMbi7Vb/NNmffvElHHad5CMLO4cvpvE6LxB2h9R1zQhJp HFqIrEGA4CFeSReG5ALCvKEhC6QBp7cXnI2Hpdpm95rPBHVnV4zz2Tbf9o3Hk/0L6pXS 05656FkhF9LCTUfmmDTm5zTeHsce3NCm6uNqsBUwD8ikbM0Z2+aYbpGkbFYWs7xyp2Xb DTEGF6gx3AL2PcF39wO43xRZc8fLgGDdN0YuHGXFzA/hwQ+TeQ7d6z44SvkvX7SqXk2y lfKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f8FcuXl0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-46405-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46405-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVsrCWmPB6xcUgfDB9SEFyomTqDz9ASMFACUw802N0SE/ddqKu8K6SBTEzHLGe0Cjyo5cWFX6cDDfkhaJNBL7IMQJv94Q== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t20-20020a639554000000b005c6818b5a28si9366754pgn.517.2024.01.31.04.51.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 04:51:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46405-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f8FcuXl0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-46405-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46405-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 D4382B27F02 for ; Wed, 31 Jan 2024 12:14:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A21AD7993A; Wed, 31 Jan 2024 12:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="f8FcuXl0" 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 F1B61768F4; Wed, 31 Jan 2024 12:14:02 +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=1706703243; cv=none; b=FJOewHZEPpMDuzYdFMWdgyDA7ZE7c5XsXHyW74SXnweZAjXyjxT5rY9/QG6XkY6RIms5HfwgyeY+LX28KWdOfdUPLw43Jbj9WVS0VJgei70jHaORcZmAjDcrxg8ZM65C3wRfTk4np/xPFx8Cp6Zhs5pBmlLmSo08L0Krnm6cYAg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706703243; c=relaxed/simple; bh=7PA+jHjuL3dX/U2euxIHOazTkyVPO2EfIlsJ8MWjALE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nJdlhgSditD7HZlJBx0HL8Vn5t3Gd707vTj94T3PND8pqTwuQdciGR93IpOCjv1NdyPE92TGpVNcMlb+LZFK7z0T+iHkGcLtoXiIoZLks5hcV2L+ttqMZDE68vAD8xcEl8N66C62dRxav9yXOoHNy3DPagzWBgLVY0V+5O+2iS0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=f8FcuXl0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F101C433C7; Wed, 31 Jan 2024 12:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706703242; bh=7PA+jHjuL3dX/U2euxIHOazTkyVPO2EfIlsJ8MWjALE=; h=From:To:Cc:Subject:Date:From; b=f8FcuXl0L8EkWHgmObVu6ysB+ynvQZF2V/GFvjPb0JvXekn7dzZVNgmswGbQqUeTG 21N6i1yF+3OLJRbNNYwgFbU/Hv+7odV9FxtbRjISNk0sM9kGYgcyrOXtDnZeBOT+Ir tZ+EfItHUxVrewAPa3hToP8md/PXOkrcjboQZytnCeNZgUqUFqPRDGXG7OD/zeYoly RIC8oJizvqH/hauI8tn7kj2DGm+jTCvidG8Kk7sycaTSMRCjSTe9FZ8yKLfcu6bawh zseKpel9RjUl/jEaYGbpwEVRGJMS2u9gHDvjC78ZiiN56w2/fz8/gX8GOG4CiUtA/8 RhihayIhgx8+w== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Emil Kronborg Subject: [PATCH 1/2] serial: core: introduce uart_port_tx_flags() Date: Wed, 31 Jan 2024 13:13:57 +0100 Message-ID: <20240131121359.7855-1-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789608283244248974 X-GMAIL-MSGID: 1789610436049430528 And an enum with a flag: UART_TX_NOSTOP. To NOT call __port->ops->stop_tx() when the circular buffer is empty. mxs-uart needs this (see the next patch). Signed-off-by: Jiri Slaby (SUSE) Cc: Emil Kronborg --- include/linux/serial_core.h | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 536b2581d3e2..edefb6d73604 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -748,8 +748,17 @@ struct uart_driver { void uart_write_wakeup(struct uart_port *port); -#define __uart_port_tx(uport, ch, tx_ready, put_char, tx_done, for_test, \ - for_post) \ +/** + * enum UART_TX_FLAGS -- flags for uart_port_tx_flags() + * + * @UART_TX_NOSTOP: don't call port->ops->stop_tx() on empty buffer + */ +enum UART_TX_FLAGS { + UART_TX_NOSTOP = BIT(0), +}; + +#define __uart_port_tx(uport, ch, flags, tx_ready, put_char, tx_done, \ + for_test, for_post) \ ({ \ struct uart_port *__port = (uport); \ struct circ_buf *xmit = &__port->state->xmit; \ @@ -777,7 +786,7 @@ void uart_write_wakeup(struct uart_port *port); if (pending < WAKEUP_CHARS) { \ uart_write_wakeup(__port); \ \ - if (pending == 0) \ + if (((flags) & UART_TX_NOSTOP) && pending == 0) \ __port->ops->stop_tx(__port); \ } \ \ @@ -812,7 +821,7 @@ void uart_write_wakeup(struct uart_port *port); */ #define uart_port_tx_limited(port, ch, count, tx_ready, put_char, tx_done) ({ \ unsigned int __count = (count); \ - __uart_port_tx(port, ch, tx_ready, put_char, tx_done, __count, \ + __uart_port_tx(port, ch, 0, tx_ready, put_char, tx_done, __count, \ __count--); \ }) @@ -826,8 +835,21 @@ void uart_write_wakeup(struct uart_port *port); * See uart_port_tx_limited() for more details. */ #define uart_port_tx(port, ch, tx_ready, put_char) \ - __uart_port_tx(port, ch, tx_ready, put_char, ({}), true, ({})) + __uart_port_tx(port, ch, 0, tx_ready, put_char, ({}), true, ({})) + +/** + * uart_port_tx_flags -- transmit helper for uart_port with flags + * @port: uart port + * @ch: variable to store a character to be written to the HW + * @flags: %UART_TX_NOSTOP or similar + * @tx_ready: can HW accept more data function + * @put_char: function to write a character + * + * See uart_port_tx_limited() for more details. + */ +#define uart_port_tx_flags(port, ch, flags, tx_ready, put_char) \ + __uart_port_tx(port, ch, flags, tx_ready, put_char, ({}), true, ({})) /* * Baud rate helpers. */ From patchwork Wed Jan 31 12:13:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 194723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1843845dyb; Wed, 31 Jan 2024 04:15:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2ijYOnO0q0CBYRJa5+i3g/an4P7iiTKF4GvTn3xCF6mRSrpvJU2giqq5ksEf2NlPreNfM X-Received: by 2002:a17:902:d507:b0:1d5:4b18:17c6 with SMTP id b7-20020a170902d50700b001d54b1817c6mr2071068plg.62.1706703359522; Wed, 31 Jan 2024 04:15:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706703359; cv=pass; d=google.com; s=arc-20160816; b=WgOjryETGGH0ol6QTOumr4Z3RqGeHxfBlKDGD52m8k/yEY0w0PwQPPhQjNAjkmzTVz cwsRWd48+8AJbbLynQ+ujj3q3SuRBnamtgU2//ekzVcjixWCncrxvdAtpD5qaZA5+tv8 1czuoMN6etNHd/h5RCpEW2mpFywITFNf0iwJBhBHhSiFG+g98FZxZwgjc6sxHh2P7jd3 O+ExTuMwGp1iOhqLcOs77Aa1DmvfzOGSuDvSGddrPlKRDHYcH+QiMs6iSqMScp0UOp5o 8zK3OWC3U0lwvglzpds26iLctcgeM2REnBi3kMlfGzrhZVv4q7F2nqiEIFD+TNrrv9xa X2sQ== 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=TeBUwzcR7NJ6O3DPTvPj2UYguTOtnfa+R+zzjRIvVMg=; b=YjAX+BbGfLXy8UHIfM2JUrxyrVlvzmZhZTJfH/LZtrMIhRa/IwL3fsp+im7e0mrkE3 kvpk8JQ+HCwUfpU/IcFj7Iyfm5vij+U9UUQNCJtEkrOvDpennkeXv0bQE4HsRJ7cge1h s9XGAu37ytFGMX+Z6bU5HuWM2ezOYTv3DyntEce2chm4+PbsBLg77zpTS8l1HwOABeKv bFoIqmL0Qa+FbG6spQE5T8yTC52WEeC1sboDhmWdh5rde1AfS2/2LPjpKI5DxOJtml11 depDTg8ENjHZ5umBoSUpZ/XA2EXOb2tNudgcAx/1iiCwq5NQy6lWMhr82YAzeq9Erk0v yWog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SahpwqEd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-46406-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46406-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUF7LQwh5hPXbAS4nMdOoJVo3eibs4l7JjVGfSUZQgX1FL2S5q9USFK0UxH6dS47SIigaiK9/dA0WsEBUGoocjfrqNORQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c11-20020a170902d48b00b001d6f49c2a7fsi9607746plg.0.2024.01.31.04.15.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 04:15:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46406-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SahpwqEd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-46406-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46406-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C802F290726 for ; Wed, 31 Jan 2024 12:14:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4686679DAD; Wed, 31 Jan 2024 12:14:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SahpwqEd" 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 9B99778B41; Wed, 31 Jan 2024 12:14:04 +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=1706703244; cv=none; b=ALGaYXQF4BkdFbpA1Y8TcJfgGfht9u/wftvvGgjdhFOOCisBs9m2rXBq7zsztZRL5E/RxBexrYY3Mc1BqE27Od5VYWtbvaqbUBmOP+Fc3ft8fjT8DNvw7X288ve/jGVGgqGOFaNB3VZXgnV9z64k74tCwGZiCwKjNDrgnsBoW6Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706703244; c=relaxed/simple; bh=o3j5KqVdt8Au5j0om5ZdjUVuI6rkV1Y9G2/tHqdbaOU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IRh79B/C9BAa3Zud6LFigHFc+hZziyof0u7srkvBbLl3oaFHWbXZQCU90GZ5K+qtVAXKsHw3pv4yG1zmPtolbhuYEQ4wSAKxe16miCQ6z3VItxVSwBGkORsXfg4xE3QpySQSV7FMOxV52841F0GN+JyvxpkBWR07uowAgozEPJ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SahpwqEd; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEAA1C43399; Wed, 31 Jan 2024 12:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706703244; bh=o3j5KqVdt8Au5j0om5ZdjUVuI6rkV1Y9G2/tHqdbaOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SahpwqEdTvM3SHNx1R87KGgn4n70GQorsMKOi4qMXnpXH9DCHc/gUOFnAA7Hv9JXr TWS/zZZffVBtvWgHiOyRSFpDsE1eu4iQ5rQxwAGraQi/S7qz4F3lt8vDpjaJe7uj5y 5bgJ62Vba1wSW0sHB/lbiucoK0kuAlyYEOnnCDXcVXgoS7/Mx5sawyianz2eDaIpQy p/0ktREpwXAY3npV4KuKqZzvluyluZu3PRoEUNxkl9o7XUV8ruIJBO8+4C4lgnSrZA NNXy+iABZiV3GyCMdz2GbLxO78c97Ukhu+X/jyCZip0ylWByG2ab+KSrSS0DH6EjZK RWl+WGdjz0mDw== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Emil Kronborg Subject: [PATCH 2/2] serial: mxs-auart: fix tx Date: Wed, 31 Jan 2024 13:13:58 +0100 Message-ID: <20240131121359.7855-2-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240131121359.7855-1-jirislaby@kernel.org> References: <20240131121359.7855-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789608182306463693 X-GMAIL-MSGID: 1789608182306463693 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) Reported-by: Emil Kronborg 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)