From patchwork Mon Jan 9 14:59:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 640657 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2186355pvb; Mon, 9 Jan 2023 06:59:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXs9nJqZq9FzAjV865sfPXhobpqLYzMtQfmy+ZXdNY9xHDE0wvkNeBUFpX/egtzRs2Ky65wM X-Received: by 2002:a05:6870:9e06:b0:150:adde:4a20 with SMTP id ps6-20020a0568709e0600b00150adde4a20mr13480827oab.12.1673276379972; Mon, 09 Jan 2023 06:59:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673276379; cv=none; d=google.com; s=arc-20160816; b=w5j9ePdo9FWO5I+w93Su3Q4xatmH+TmcZpHRElAMlGBZo74+GziSZT/oFH19IEpsgn YRxsidmFYPzuJsqkYihG0rooIqwfX/g16v2+b3Ievt2a82RrRhb3qbqpn8K2nBrF1Wv2 0W89rOukrJVpMAIMYR2h8aJyLZhuY9NsW/iAddKMPiLIJmbOWNcfJz/uEeoy23VPRFKU rA8iYUXj+jLAOO7K/N8c1SP60jVIn1qWLjNesyLUlZfpzBi7lB0942jAbBxmc2tK/GOr cY4sRYdHRIYksmYFIp577FyfYcbA23GraPjOMoZw7MCHwWbhfWdB+AyWtPaIq+OSovbU axCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=XowslaxjTQYktpbHMQQfv2yD/wU6bHkoAM4OISzIo40=; b=x/PHefkTzu8g66nMr9QfpjNR5jHlkoJaciTFWd09memvp1u0He4vxHQyAmXDlOqQlH 3Xmy78DpJQiYRl/M5d0py7SwDUHURff53arJXTHGClrd9AfnETllSwWH/zIYit3S+zXL EIJfnQCh9RMivo99HfOFKqy+z0YXtg6qU/Qk5cAnbheBd5dkzQwjnu0fyjMT/gQIV5iT L9A/ndLOKPIkeSzpun5n2B8XXrDEfDP1VPfGg3sdZ0Vd/cP6sRLWCamRlPFl9/KRMCPK 2a5jog22a4CD+PAeLo+xwDNtCnnudDxDBwWKMwlvpQGNb0tjob47reLFz3Rg2Y1zRLEj /rVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r8cSR2TZ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id k9-20020a056870818900b0014c6a731373si9499068oae.285.2023.01.09.06.59.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 06:59:39 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r8cSR2TZ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A96278547B; Mon, 9 Jan 2023 15:59:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="r8cSR2TZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D14BA854EA; Mon, 9 Jan 2023 15:59:32 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5D9EE85445 for ; Mon, 9 Jan 2023 15:59:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=loic.poulain@linaro.org Received: by mail-wm1-x330.google.com with SMTP id g10so6482992wmo.1 for ; Mon, 09 Jan 2023 06:59:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XowslaxjTQYktpbHMQQfv2yD/wU6bHkoAM4OISzIo40=; b=r8cSR2TZicQzuZGQmkBaGa6hq1Uho1lO3yReXwR7QsVCMQHfKjYJaLJkdepxj2p7CZ GmOQw65yOksEvMh8VGkb1atAfSaiyX87LKuhqxf6D/ApvwTxNbbe1bJ02bz08bl1Ltwl bt3nWfK5sck+qb3J7FswVQAZLG1c5kLpQ5v885G//JxMCtcPsvnTJr8/TGRyjSmSoBtf 14rRlcf8IjEeDScjj0M/pNIWzhxqy+XWgDqTsXpnJlhc3h3JtbU7HjXi4SZk0T2jHJlR m8yahIh5+PHtDBuETNmWs0Y9cb7h0NfkPwtkIQ4mGpsAzAYL2v1oDvLwiQSAD+apQ8+d j5Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XowslaxjTQYktpbHMQQfv2yD/wU6bHkoAM4OISzIo40=; b=HMo7xfUYfRcg3DtDh9tWA2d9XkuKQ7fi2ZQaLCUHZMOgg29fUAGZIdEHvyDSCVRGq4 LTuta+Y4ofGs5JkCuqS8/rOjlOcto+69ZhPAbPAjAUuyRJCBMsmsA8ejeKBH9OPltUXM DEUl709/STsE8znXZ5UUcR4RU/Co9qx3lnLAZ7CwdZXfOolNNY8KKiGATESSpM7JPqJl J9aIqMwQ3BzopWL6DTVO2BDCKlufGKGvyoyzwCVxGFmEHYnzLZbWXWnwVXmwQu+pY2lG u4WyPeSeXvV39fEIF5uxJXOLbn9/EBAsuMV5F0YQCmvWBpZEQmzKlGq8MPOGCHa2hBhf XBTw== X-Gm-Message-State: AFqh2kqCykRAD0HVaGExM+l49d6Dp6GL+Bt/O8OZxtB4EviAzFunyDvi Jnwb+MchdkvLupT1JZcVxdY8Kw== X-Received: by 2002:a05:600c:3b0c:b0:3d9:e922:b417 with SMTP id m12-20020a05600c3b0c00b003d9e922b417mr4772341wms.41.1673276368819; Mon, 09 Jan 2023 06:59:28 -0800 (PST) Received: from loic-ThinkPad-T470p.. ([2a01:e0a:82c:5f0:1408:c8ae:7a2c:16b1]) by smtp.gmail.com with ESMTPSA id z25-20020a1c4c19000000b003d1e1f421bfsm15962518wmf.10.2023.01.09.06.59.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 06:59:28 -0800 (PST) From: Loic Poulain To: sbabic@denx.de, festevam@gmail.com Cc: u-boot@lists.denx.de, uboot-imx@nxp.com, Loic Poulain Subject: [PATCH] serial: mxc: Speed-up character transmission Date: Mon, 9 Jan 2023 15:59:25 +0100 Message-Id: <20230109145925.1479749-1-loic.poulain@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 Instead of waiting for empty FIFO condition before writing a character, wait for non-full FIFO condition. This helps in saving several tens of milliseconds during boot (depending verbosity). Signed-off-by: Loic Poulain --- drivers/serial/serial_mxc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 == '\n') serial_putc('\r'); - 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); } /* 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 = dev_get_plat(dev); struct mxc_uart *const uart = plat->reg; - if (!(readl(&uart->ts) & UTS_TXEMPTY)) + if (readl(&uart->ts) & UTS_TXFULL) return -EAGAIN; writel(ch, &uart->txd);