All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan@gerhold.net>
To: u-boot@lists.denx.de
Cc: Nicolas Dechesne <nicolas.dechesne@linaro.org>,
	Ramon Fried <rfried.dev@gmail.com>,
	Stephan Gerhold <stephan@gerhold.net>
Subject: [PATCH 3/3] serial: serial_msm: Delay initialization to let pins stabilize
Date: Wed, 14 Jul 2021 10:56:26 +0200	[thread overview]
Message-ID: <20210714085626.5961-4-stephan@gerhold.net> (raw)
In-Reply-To: <20210714085626.5961-1-stephan@gerhold.net>

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 <stephan@gerhold.net>
---

 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 <asm/global_data.h>
 #include <asm/io.h>
 #include <linux/compiler.h>
+#include <linux/delay.h>
 #include <dm/pinctrl.h>
 
 /* 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


  parent reply	other threads:[~2021-07-14  8:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14  8:56 [PATCH 0/3] board: dragonboard410c: Fix some minor issues Stephan Gerhold
2021-07-14  8:56 ` [PATCH 1/3] board: dragonboard410c: Fix PHYS_SDRAM_1_SIZE Stephan Gerhold
2021-07-14 20:37   ` Ramon Fried
2021-07-24 20:40   ` Tom Rini
2021-07-14  8:56 ` [PATCH 2/3] board: dragonboard410c: Fix fastboot Stephan Gerhold
2021-07-14 20:36   ` Ramon Fried
2021-07-24 20:40   ` Tom Rini
2021-07-14  8:56 ` Stephan Gerhold [this message]
2021-07-14 20:39   ` [PATCH 3/3] serial: serial_msm: Delay initialization to let pins stabilize Ramon Fried
2021-07-15  6:15     ` Stephan Gerhold
2021-07-24 20:40   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210714085626.5961-4-stephan@gerhold.net \
    --to=stephan@gerhold.net \
    --cc=nicolas.dechesne@linaro.org \
    --cc=rfried.dev@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.