From patchwork Thu Jan 12 17:19:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 641660 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp3922844pvb; Thu, 12 Jan 2023 09:20:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXvMS85l9usZ3qYq/hg9UmNsKFzEdV99Vp9lIKW65ZEvL+55CEzr/XwXsvFHU4fnx7c0ihHH X-Received: by 2002:a05:6870:e285:b0:15e:cfce:fcb9 with SMTP id v5-20020a056870e28500b0015ecfcefcb9mr641437oad.34.1673544035706; Thu, 12 Jan 2023 09:20:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673544035; cv=none; d=google.com; s=arc-20160816; b=wOBmNL3f3vaTt/PE3SGCQvUMyMEbGXXWjmRTjAeFP2gdLQSoRJjAQCCh1Hnlzau8gQ W4Y5T0tVy4IEYUQMZscfFQSHnGSLGvawlafgW7L+8Jl9hnjP1bFGy277b17vnBKUWkcN BD9YV5VrQYSdctT5XxjoW40XhKboCIafr3syvRpnv5s3O2u1WQLZwp7RE74MMY+7H9Kp CjGLzoAzXL6ghm5hzFxDw0eyUcHntJP3yAniblJ7f5pVRs3Q1wKFY3tMk77g3u8zM+zb 11UBpd4F6DPs4MUhC56fy76IyXHxrtIEn9nHpd6vbSu95+16jjVIjw5rdyNfYeZTYKg7 Byyg== 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=jJZkP2bW7gM15V8Jc7Vwfcb7IM3EYogwbvmj37hGnI0=; b=NfS0Rt/keb8qyKbbCtEdD/K8yLCQVokgm5Fuqc0Q9EW0bvwh5Nkqvt1i1sIPjoGOnN FaKQytP6JKQ50yslcryOWDRbnUI6Kc8P8u75+TYPFrBCsw9ZQYp3szaYoFrTX1T32aQW +81dhYUs6gw1HSCltn1SH1JboMS97LhbcII5wgyF+E2+mOeLmwpbtlBBYRyOoAl5gSpE JLVJPl6y/dFpTjiIANF2+ANJs/bv3whKiphWKaeizl2a/9Twgplz4Dc1kumgmlC03Hhw Wf2YPwyuJLDxLJ9jTFe3O4u4Kv9YCAvtjgGDqIWSw11p1bXu8qu/QAWo05LEnR4mVWvX CZ+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZfJnsx5s; 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 j30-20020a056870169e00b0015ea0c8960csi5034008oae.38.2023.01.12.09.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 09:20:35 -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=ZfJnsx5s; 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 F2C3B852E9; Thu, 12 Jan 2023 18:20:13 +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="ZfJnsx5s"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2BB8285408; Thu, 12 Jan 2023 18:20:04 +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-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 5EEBF852E9 for ; Thu, 12 Jan 2023 18:19:58 +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-x32c.google.com with SMTP id j16-20020a05600c1c1000b003d9ef8c274bso11308672wms.0 for ; Thu, 12 Jan 2023 09:19:58 -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=jJZkP2bW7gM15V8Jc7Vwfcb7IM3EYogwbvmj37hGnI0=; b=ZfJnsx5sB/zwjZevkhrj2cjCjDB0W/SlCJBZVwl1n0D8hKK40g2hvn/XAcW6MKNnu6 nOrCxp3qxYenV04fRZpgbK6SlY1suK+ZK90AXJoucqPfN3EgskPaNwrn7c6Q0zqNfGAg VzfLiK7+BrjWIM7PYab1v7n2C4fePyaRIFMakASusEPdy1DR+klrnxjBYppvqNUmqXJ6 wKK8irkN/U7z6kM10mBWvwcB0+uGAGmnRppsueqg5OcXrQYEj+cYzA+RUhla6y7ZNmH/ N+0FG8T2PYWcXYps3q4ZCGH1GlwxIF3tJqVppANym4LN37oIKrMdepMnY+QviYI4Ha5h airQ== 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=jJZkP2bW7gM15V8Jc7Vwfcb7IM3EYogwbvmj37hGnI0=; b=RN0JFuBsaOfNZQ1vfOwj3bz6RJzyUOndTrFiswNIszyRkZHY9963znuL67knKfKwQm H8XU9GPvdCtXziScsXUPAnurTUWdR9goRl77L9ec86RzETnVT0tv7NhnmKWbNXJYWXNo n5lpfIZqYkk5DMzBNl7HtLhaYvaFhj/DQk/87qxoBRs5j6Wn7+CRwmIrMe4iuEwcUMWi FfpVyEBcxZH8vyezPIvcFWbdC6frrhVGSDjmZSsSmmmQFqxy/JzIMvJOeofwyVrq0gmD dGglYOTXL8PsgXCXyG6SSB6zzFCn/uV4Pk1tY8lQIgxYpu0KBgqfhkdRZe9opzKgDP1U Re2Q== X-Gm-Message-State: AFqh2ko6Ln4C1cXLstQiOkiRBkwADTHjzskW6v7JHBxLVkB59lEgqY7T Kqlsy23VmXnioxbePbRVsEVNag== X-Received: by 2002:a1c:770b:0:b0:3cf:a18d:399c with SMTP id t11-20020a1c770b000000b003cfa18d399cmr58316804wmi.1.1673543997881; Thu, 12 Jan 2023 09:19:57 -0800 (PST) Received: from loic-ThinkPad-T470p.. ([2a01:e0a:82c:5f0:1fa1:5990:937b:e8c8]) by smtp.gmail.com with ESMTPSA id o15-20020a5d62cf000000b002bbedd60a9asm11231267wrv.77.2023.01.12.09.19.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 09:19:57 -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, pali@kernel.org, Loic Poulain , =?utf-8?q?Lothar_W?= =?utf-8?q?a=C3=9Fmann?= Subject: [PATCH v4 2/2] serial: mxc: Speed-up character transmission Date: Thu, 12 Jan 2023 18:19:51 +0100 Message-Id: <20230112171951.2082899-2-loic.poulain@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112171951.2082899-1-loic.poulain@linaro.org> References: <20230112171951.2082899-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 Acked-by: Pali Rohár Reviewed-by: Fabio Estevam Tested-by: Fabio Estevam --- v2: fixing transfert abort & char corruption commit v3: Reordering commits for good bisectability v4: no code change 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 9e5b987994..cac1922354 100644 --- a/drivers/serial/serial_mxc.c +++ b/drivers/serial/serial_mxc.c @@ -240,11 +240,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 */ @@ -335,7 +335,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);