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 74FFFC38142 for ; Tue, 31 Jan 2023 09:57:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 768F485A63; Tue, 31 Jan 2023 10:53:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1675158787; bh=CUTOmyOY8tQz5rn3NiHe6N4W9AuWZTwDm6Xp89C8EO4=; h=From:To:Subject:In-reply-to:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From; b=T1JUEXwWwHKUPyGe75sE/zg1Vhn4RnEddh29pks6/roGM00pSW76KPhlxaAo/pX8f gs61PmE0ypYv1W4A5FVe+XLQOIoJus3vndCoHgggAVTDr0JdnDsAk/P9WudBMGlyAN 9AHBeSzhcHmKy59wWJZq9jGZiL7R8nqd8DBhrN0Gjo5U+16v5avzCAoMUdlstukpMn D6tvhSAl+H4dAvscQxjODiSI4WuooLswlkGhzhkwUZfD78/oZIwGO/4/Wf+nBbgKr6 jVNRQZwRnZ8tNLIZqV1yDtPGCs4AE5ZJa13F3xHvb0x+HSdOZwrRF/s+RE87IGZEBJ fj/S+Pm6yBIZg== Received: by phobos.denx.de (Postfix, from userid 109) id 85BD6858B3; Tue, 31 Jan 2023 10:51:23 +0100 (CET) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) (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 484B685367 for ; Tue, 31 Jan 2023 10:51:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sbabic@denx.de Received: from frontend03.mail.m-online.net (unknown [192.168.6.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4P5gL10MzPz1r1gC; Tue, 31 Jan 2023 10:51:21 +0100 (CET) Received: from localhost (dynscan3.mnet-online.de [192.168.6.84]) by mail.m-online.net (Postfix) with ESMTP id 4P5gL105nsz1qqlR; Tue, 31 Jan 2023 10:51:20 +0100 (CET) X-Amavis-Alert: BAD HEADER SECTION, Missing required header field: "Date" Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan3.mail.m-online.net [192.168.6.84]) (amavisd-new, port 10024) with ESMTP id aZo3gZAOdigw; Tue, 31 Jan 2023 10:51:20 +0100 (CET) Received: from papero (host-88-217-136-221.customer.m-online.net [88.217.136.221]) by mail.mnet-online.de (Postfix) with ESMTP; Tue, 31 Jan 2023 10:51:20 +0100 (CET) From: sbabic@denx.de X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 1725290 X-Patchwork-Delegate: sbabic@denx.de To: Loic Poulain ,u-boot@lists.denx.de Subject: [PATCH v4 1/2] serial: mxc: Wait for TX completion before reset In-reply-to: <20230112171951.2082899-1-loic.poulain@linaro.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Message-Id: <20230131095123.85BD6858B3@phobos.denx.de> Date: Tue, 31 Jan 2023 10:51:21 +0100 (CET) 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 > The u-boot console may show some corrupted characters when > printing in board_init() due to reset or baudrate change > of the UART (probe) before the TX FIFO has been completely > drained. > To fix this issue, and in case UART is still running, we now > try to flush the FIFO before proceeding to UART reinitialization. > For this we're waiting for Transmitter Complete bit, indicating > that the FIFO and the shift register are empty. > flushing has a 4ms timeout guard, which is normally more than > enough to consume the FIFO @ low baudrate (9600bps). > Signed-off-by: Loic Poulain > Tested-by: Lothar Waßmann > Acked-by: Pali Rohár > Reviewed-by: Fabio Estevam Applied to u-boot-imx, master, thanks ! Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de =====================================================================