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 0313BC38A2D for ; Tue, 25 Oct 2022 22:57:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8606084ECE; Wed, 26 Oct 2022 00:57:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="qtRgAy1G"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A7D7484F18; Wed, 26 Oct 2022 00:57:15 +0200 (CEST) Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) (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 CA49384EB4 for ; Wed, 26 Oct 2022 00:57:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=festevam@gmail.com Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-13be3ef361dso5348584fac.12 for ; Tue, 25 Oct 2022 15:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XOXj4p6/0yA/gmJK1Xr9MrtztTn0a2DYikS7C4QTGCs=; b=qtRgAy1G5r9wzp22B3n+BxDUedOGXCJTSyqY7DDf4jDFOZMNaimf+dRMF7BMJKtiUX 1OZPqwNhoRAuQaYK/m/NmqV3WPfMowt3DFSV0ZC2Ca0Acu8nmVxwJC9ZRNG2FaOB1hNS vKKD5nosFupdB1dVJsRZquXeA2Ohx3mJ36bkwqGc4TVpO6X/yhyh49WWZ1TnvLFclqOt Oshd5MZoP7XMYqU9UdnqAScWepQdxlu56DRs3OLpVNvAzr6zuucR+xpvaxaF3I6E4bN4 gm3rNs3GcQBYTLSpoIgysmwTU+IP5nkpp46tz0MCdTLamPyy7UQGuvXKx7zSK3fU6hNt nXLg== 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=XOXj4p6/0yA/gmJK1Xr9MrtztTn0a2DYikS7C4QTGCs=; b=UFWYvv3xDXlXOMgvAI/x+roDHSlQ/eLOLBi0p2Cyezc6ivaJ+TkPOamj53FRq0n1vP DBhxUNvA+P2Wq0bKFBQGAGyfAGGZsn+zLG05AEY9ObOVDRPQTNBnRk6p+uD/TWdqSgz2 +qwhvLL4a4AePKO/d0dOLAJrf91ANQRVHQB0Lhehhq3ARd8SXHKPGDzxB06bYOszt68m Tq1xGdQfL7IztwWqqQdhTcmSoy/4QFk7E11/CyRYF3hR3kpbuYCpl++fRKmn4PIaO9jf uxFzbhYznJc9MMLdo0feDjrtvB3Ie4y78PlqFOGkKaoiexklkDzXVzj7IZAsXVKezVhS mRTw== X-Gm-Message-State: ACrzQf1/sbmajMIlujB/hPG9OBESdWDUQXSjc0EOrkTbCIjPb6an3bsZ LbYo0Xljkj36yAkIDnfMd6M= X-Google-Smtp-Source: AMsMyM4rCeA1IyYm9FUy9mde4mtQpfaZqiFBd8OMZcfLZoLTCWi94yMKgzHPCjE4lC1AHSFgeQJwyA== X-Received: by 2002:a05:6870:d29f:b0:132:bd27:825d with SMTP id d31-20020a056870d29f00b00132bd27825dmr387981oae.99.1666738631269; Tue, 25 Oct 2022 15:57:11 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:485:4b69:7a96:708:3390:deb2]) by smtp.gmail.com with ESMTPSA id d16-20020a056870961000b0012763819bcasm2240131oaq.50.2022.10.25.15.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 15:57:10 -0700 (PDT) From: Fabio Estevam To: sbabic@denx.de Cc: uboot-imx@nxp.com, johannes.schneider@leica-geosystems.com, u-boot@lists.denx.de, pali@kernel.org, Fabio Estevam , Tim Harvey Subject: [PATCH v2] serial: mxc: Keep the original FIFO empty check Date: Tue, 25 Oct 2022 19:56:57 -0300 Message-Id: <20221025225657.904240-1-festevam@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Fabio Estevam Tim Harvey reported that since commit c7878a0483c5 ("serial: mxc: have putc use the TXFIFO"), console messages put inside board_init() are no longer printed correctly. This change added a check to handle the UART FIFO full condition and removed the UART FIFO empty check, which causes the problem. To avoid console corruption, add back the original UART FIFO empty check so that when the FIFO is empty, mxc_serial_putc() returns -EAGAIN to the core serial-uclass.c. This way the serial core can properly handle the UART empty condition by not doing character transmission when -EAGAIN is returned. Fixes: c7878a0483c5 ("serial: mxc: have putc use the TXFIFO") Reported-by: Tim Harvey Signed-off-by: Fabio Estevam --- Changes since v1: - Add the check for FIFO full and FIFO empty. drivers/serial/serial_mxc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c index 4cf79c1ca24f..d3fbe76065ec 100644 --- a/drivers/serial/serial_mxc.c +++ b/drivers/serial/serial_mxc.c @@ -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_TXFULL) + if ((readl(&uart->ts) & UTS_TXFULL) || !(readl(&uart->ts) & UTS_TXEMPTY)) return -EAGAIN; writel(ch, &uart->txd); -- 2.25.1