From patchwork Tue Jan 10 19:24:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 640893 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2880015pvb; Tue, 10 Jan 2023 11:24:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXu59al9fqoIMPQAtPvPhbnO82B2kqdVKrNf6CJQnIHVkdkMKh37hW4xSOesE63mgoitnLOv X-Received: by 2002:a05:6870:2c97:b0:150:aa9c:bee8 with SMTP id oh23-20020a0568702c9700b00150aa9cbee8mr19678478oab.39.1673378665827; Tue, 10 Jan 2023 11:24:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673378665; cv=none; d=google.com; s=arc-20160816; b=TxNlVfiapLLPkj8pBT4QjoiHzJlJpCyK5VkHYfCBXawKo7SePC3WM78RrALYTMlUee S1bsdAZZUK/RrQPQo9SNmDDMGMYJ6eGf57t2M+As8HxMxzIndVNs+7dV1kOlZ5pIu4cJ n+g7CO1KrBjBymVHPuNum9RHXwNE9n5AAghbMhM08CsLA0IkaeH/Ke4DUBJJ8rYDvBmd 4c5uXspmQw0cJhf4eWqdzbDbWxpWvV1vnBIZ04a+DYIboUzvvkyypG7F26BjtjRZuilT FENUYRrNuNChWLTkzvAiOhYs5PCq5iWeCT8Xk/KrF/ZzW2EjnEyKLs2qX1SV4FtALH+l dTnQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DF1pXjMgFU6EHPEIfWeOWxSUft6M4I3zQLTBKxn3n5Q=; b=nssy47fF7HT6053QCzBYBSMCbIYTRazRJQ2KRfVlK+XGdrG4ouioRdF3B2bBwD9LCa qIw1ThGSrTFGGgboafcvi9vX6I3TszYDrwmY3JFLXDyNzncMc5mNrmopue3YzdvvfP8H PUazA3rg+505ZtbHnDVQOFEmPSp0eN2uzKQB4OE0yDbP6zhx98188CIUnt6wPqaOAimp 1zcP2+WanBiW1zZpoWwmb2b1YcHKC3DGFZbo1erxmkH/d2qm/RUNzu/tdhlREV+8Y0Bs OPYZ3RXMvwcVkZXhqhDdVDF7PrjeBgQXeaxRC+2Xmi+2YTDS1x/orzx6NT99lyDlpbTg xcJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RQB3i4sz; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id ba2-20020a056870c58200b0014bf24d0d76si10707415oab.162.2023.01.10.11.24.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 11:24:25 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RQB3i4sz; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 DE47985687; Tue, 10 Jan 2023 20:24:17 +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="RQB3i4sz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D325D8561B; Tue, 10 Jan 2023 20:24:14 +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-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (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 A120E8568C for ; Tue, 10 Jan 2023 20:24:11 +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-x329.google.com with SMTP id ja17so9552228wmb.3 for ; Tue, 10 Jan 2023 11:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DF1pXjMgFU6EHPEIfWeOWxSUft6M4I3zQLTBKxn3n5Q=; b=RQB3i4szzrVGjc8tdaU+eyF6D87VKs3kIfxBUdE0d/8tK0wy+iRJl+X33bnezYMx3X 3jMC+27/Dt12Wz6l6EGVwsmvIe6C+gQb/Ku3gzWOJa0VVhFwP6VFW//b6E0VJ98fnV0W iyuEnbhtby584jCTFDPPqB8gfZii52U6ljq4g9qFiVG7SrqHa+aemyH58j4ZylbmNIXu jIMZIgU3XG04Bes55B3IJhHQLoadchCNARfa748fHrNBnkZrvo9o6rxsKxYnmAJ86Ub+ DcuQF5OzqvE8pzxijfqLzRgNTpgRYb9JwKamoJLphNYgJq3y5nuCQYmjEI3iqZLd5c/V 897g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DF1pXjMgFU6EHPEIfWeOWxSUft6M4I3zQLTBKxn3n5Q=; b=T8N8ZmDXfgJT4pcC/5ZqRgY1AmEOqXFPTYkUstl89eNk5iqHsB73EoWmf3I//5CbHI 3uldaE43ievW+8YeTvURx2D2KGfKcmf72Hp62C+ilxATo8IaDjqez011DuIhP2ny9qi2 YebCUx3BY5OVln2F2sAeKFB5RuwPYZWkJdxMfUOAzZ0H1oWFDoqVHHqTc5sQfefu2+pW 0uUtHoWjdR1Byg+o7xDD0BSDHQ9JtVctFiWdAkO6FQcZvpryV5oUShuz73t52cF0TNEX mMjXB1dKo+TfVLVaegPo/coltCkbQc8e8z8QX/P1zyTC0936oxxjAmBtxjcJ40EQdfag FfRA== X-Gm-Message-State: AFqh2kosyzmaRhb85crghtiLm4e6o+QOP2qy6ZTJ4EXaZ5wK89IWT4n6 XD6O3bwCpcjKmN2kG8EYYbA6DQ== X-Received: by 2002:a05:600c:1e24:b0:3d3:5075:7526 with SMTP id ay36-20020a05600c1e2400b003d350757526mr51444260wmb.31.1673378651190; Tue, 10 Jan 2023 11:24:11 -0800 (PST) Received: from loic-ThinkPad-T470p.. ([2a01:e0a:82c:5f0:a2ad:457f:18a:ffcb]) by smtp.gmail.com with ESMTPSA id l3-20020a05600c4f0300b003a6125562e1sm17155754wmq.46.2023.01.10.11.24.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 11:24:10 -0800 (PST) From: Loic Poulain To: sbabic@denx.de, festevam@gmail.com Cc: uboot-imx@nxp.com, u-boot@lists.denx.de, LW@karo-electronics.de, Loic Poulain , =?utf-8?q?Lothar_Wa=C3=9Fmann?= Subject: [PATCH v3 2/2] serial: mxc: Speed-up character transmission Date: Tue, 10 Jan 2023 20:24:07 +0100 Message-Id: <20230110192407.1874044-2-loic.poulain@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230110192407.1874044-1-loic.poulain@linaro.org> References: <20230110192407.1874044-1-loic.poulain@linaro.org> 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 Tested-by: Lothar Waßmann Reviewed-by: Fabio Estevam Acked-by: Pali Rohár --- v2: fixing transfert abort & char corruption commit v3: Reordering commits for good bisectability 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 3c89781f2c..9899155c00 100644 --- a/drivers/serial/serial_mxc.c +++ b/drivers/serial/serial_mxc.c @@ -238,11 +238,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 */ @@ -333,7 +333,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);