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 X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10A9FC12002 for ; Wed, 14 Jul 2021 20:39:55 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 48EC3613AF for ; Wed, 14 Jul 2021 20:39:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 48EC3613AF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 786DB81F7B; Wed, 14 Jul 2021 22:39:52 +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="O2nMSAfu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E93FA81FD5; Wed, 14 Jul 2021 22:39:49 +0200 (CEST) Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) (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 A0D35817D3 for ; Wed, 14 Jul 2021 22:39:46 +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=rfried.dev@gmail.com Received: by mail-ot1-x32a.google.com with SMTP id i12-20020a05683033ecb02903346fa0f74dso3857772otu.10 for ; Wed, 14 Jul 2021 13:39:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HTMUwCuqQi7DndfjwTg/keslYMgpnLwcPtaSKRoJnBw=; b=O2nMSAfuY+fBoXWJWTY+XCOeKT08weECahL7yu1INAQircyn9vdZouTKdUJnD4bsNn tyZRWkHRsf/8gBgTSFcwZ3VixUui5u4fnlW1vj5DndSguW6kydjOAbS8gTeb3F8I5eq+ S0eKzo10YQPpEu4i5nvY0l0qJtfrioiq8ylfNAkQ9XahyZOlUCXtvu7SE5UhkAhFDQ3G 16PIDfS7jtmeojXo5zNyWV37Gf+kIbdBNqu6fuv1GLMg6pEF/P9HkrtiLKMvUyW1LSWM hLZYumADFm9TFEgd7SXGr830i+tfCeQQro5DECq8GHMxQ2l6fjxUPOXiKzGjEBS+9dcu G33A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HTMUwCuqQi7DndfjwTg/keslYMgpnLwcPtaSKRoJnBw=; b=YcjkG/rjE47okqRCH2Dy3jJZZg+booSrSYkzX/5arlNuNSJkFc4vHjx6ncQG0QF0GR DiPOAX45H35OYNKcTetIGCCfgYJ+/KzFCEbkLvxrvHAio0ZTeuspxZz3APdDqTKWb38Q dsfvw0qwm/xtoFteHwX/NBj+twvPa1u3W/TBaM88H+kJVJcLrvjSsgVSqFy7GuHPabOm /IwE/ysvfTRlRAVMzbORnlSjZY09ROy4W+m6T2HMIalcdbhOpHUETF342DyNrdj1pQOU qYrg69LX2VfvyOvCzdXGRjyLCJhrUnTTa3mwCAOcPa5A9oHgmLTpqT7sFzPOBva3nXTJ d4sg== X-Gm-Message-State: AOAM531tTQGUmlp7ATAv7gbx3e+BdS5+LvYB7Rw3LRKz1p1jfPj8FXba SWkhBy3TPmk6LU4AB1goFvLWUIbmxyx/p6Txbhs= X-Google-Smtp-Source: ABdhPJxwsUsESZDsRGx7QuCfSws7kj/zZnp0p4lQTeFLKXo9QL6jqF4+bjDfxw91+HgKA1pfpo+8rtY45nsUtf5+9U4= X-Received: by 2002:a9d:74d0:: with SMTP id a16mr49796otl.370.1626295185284; Wed, 14 Jul 2021 13:39:45 -0700 (PDT) MIME-Version: 1.0 References: <20210714085626.5961-1-stephan@gerhold.net> <20210714085626.5961-4-stephan@gerhold.net> In-Reply-To: <20210714085626.5961-4-stephan@gerhold.net> From: Ramon Fried Date: Wed, 14 Jul 2021 23:39:34 +0300 Message-ID: Subject: Re: [PATCH 3/3] serial: serial_msm: Delay initialization to let pins stabilize To: Stephan Gerhold Cc: U-Boot Mailing List , Nicolas Dechesne Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean On Wed, Jul 14, 2021 at 11:56 AM Stephan Gerhold wrote: > > For some reason, the DragonBoard 410c aborts autoboot immediately if > U-Boot is started without LK. It looks like it picks up a single broken > character via serial and therefore believes a key was pressed to abort > autoboot. > > After some debugging, it seems like adding some delay after pinctrl > setup but before UART initialization fixes the issue. It's also worth > mentioning that unlike when booting from LK, the pinctrl setup is > actually necessary when booting U-Boot without LK since UART is broken > if the pinctrl line is removed. > > I suspect that reconfiguring the pins might take some time to stabilize > and if the UART controller is enabled too quickly it will pick up some > random noise. Adding a few milliseconds of delay fixes the issue and > shouldn't have any other negative side effects. > > 3ms seems to be the minimum delay required in my tests, use 5ms instead > just to be sure. > > Signed-off-by: Stephan Gerhold > --- > > drivers/serial/serial_msm.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c > index d8dd5c1104..ac4d0824b9 100644 > --- a/drivers/serial/serial_msm.c > +++ b/drivers/serial/serial_msm.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > #include > > /* Serial registers - this driver works in uartdm mode*/ > @@ -193,6 +194,9 @@ static int msm_uart_clk_init(struct udevice *dev) > > static void uart_dm_init(struct msm_serial_data *priv) > { > + /* Delay initialization for a bit to let pins stabilize if necessary */ > + mdelay(5); > + > writel(priv->clk_bit_rate, priv->base + UARTDM_CSR); > writel(0x0, priv->base + UARTDM_MR1); > writel(MSM_BOOT_UART_DM_8_N_1_MODE, priv->base + UARTDM_MR2); > -- > 2.32.0 > Eh...this is not a nice fix, perhaps just clearing the RX buffer after initialization will work better ?