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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54F7BC46467 for ; Tue, 10 Jan 2023 06:46:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AEEE482A25; Tue, 10 Jan 2023 07:46:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=KARO-electronics.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 12C3282A25; Tue, 10 Jan 2023 07:46:31 +0100 (CET) Received: from smtprelay06.ispgateway.de (smtprelay06.ispgateway.de [80.67.18.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BDC8C82A0A for ; Tue, 10 Jan 2023 07:46:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=KARO-electronics.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=LW@KARO-electronics.de Received: from [89.1.81.74] (helo=karo-electronics.de) by smtprelay06.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pF8P1-0008Ci-2p; Tue, 10 Jan 2023 07:46:31 +0100 Date: Tue, 10 Jan 2023 07:46:27 +0100 From: Lothar =?UTF-8?B?V2HDn21hbm4=?= To: Loic Poulain Cc: sbabic@denx.de, festevam@gmail.com, u-boot@lists.denx.de, uboot-imx@nxp.com Subject: Re: [PATCH] serial: mxc: Speed-up character transmission Message-ID: <20230110074627.7e2b33c0@karo-electronics.de> In-Reply-To: <20230109145925.1479749-1-loic.poulain@linaro.org> References: <20230109145925.1479749-1-loic.poulain@linaro.org> Organization: Ka-Ro electronics GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Df-Sender: bHdAa2Fyby1lbGVjdHJvbmljcy5kb21haW5mYWN0b3J5LWt1bmRlLmRl X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi, On Mon, 9 Jan 2023 15:59:25 +0100 Loic Poulain wrote: > Instead of waiting for empty FIFO condition before writing a > character, wait for non-full FIFO condition. >=20 > This helps in saving several tens of milliseconds during boot > (depending verbosity). >=20 > Signed-off-by: Loic Poulain > --- > drivers/serial/serial_mxc.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c > index 82c0d84628..f8c49865be 100644 > --- a/drivers/serial/serial_mxc.c > +++ b/drivers/serial/serial_mxc.c > @@ -223,11 +223,11 @@ static void mxc_serial_putc(const char c) > if (c =3D=3D '\n') > serial_putc('\r'); > =20 > - writel(c, &mxc_base->txd); > - > /* wait for transmitter to be ready */ > - while (!(readl(&mxc_base->ts) & UTS_TXEMPTY)) > + while (readl(&mxc_base->ts) & UTS_TXFULL) > schedule(); > + > + writel(c, &mxc_base->txd); > } > =20 > /* Test whether a character is in the RX buffer */ > @@ -311,7 +311,7 @@ static int mxc_serial_putc(struct udevice *dev, const= char ch) > struct mxc_serial_plat *plat =3D dev_get_plat(dev); > struct mxc_uart *const uart =3D plat->reg; > =20 > - if (!(readl(&uart->ts) & UTS_TXEMPTY)) > + if (readl(&uart->ts) & UTS_TXFULL) > return -EAGAIN; > =20 > writel(ch, &uart->txd); > A previous attempt to do this in: |commit c7878a0483c59c48a730123bc0f4659fd40921bf |Author: Johannes Schneider |Date: Tue Sep 6 14:15:04 2022 +0200 | | serial: mxc: have putc use the TXFIFO has been reverted in: |commit fc1c1760de38823edbdc2cdd9606dff938a07f6e |Author: Fabio Estevam |Date: Tue Nov 8 08:39:33 2022 -0300 | | Revert "serial: mxc: have putc use the TXFIFO" | =20 | This reverts commit c7878a0483c59c48a730123bc0f4659fd40921bf. | =20 | Since commit c7878a0483c5 ("serial: mxc: have putc use the TXFIFO"), | serial console corruption can be seen when priting inside board_init(). | =20 | Revert it to avoid the regression. | =20 | Reported-by: Tim Harvey | Signed-off-by: Fabio Estevam | Acked-by: Tim Harvey Lothar Wa=C3=9Fmann