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=-17.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,MENTIONS_GIT_HOSTING,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 8ECE6C2B9F4 for ; Mon, 28 Jun 2021 17:15:49 +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 F3D1C61C43 for ; Mon, 28 Jun 2021 17:15:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3D1C61C43 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 1324482E04; Mon, 28 Jun 2021 19:15:47 +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="omZFIIU7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1787882E05; Mon, 28 Jun 2021 19:15:45 +0200 (CEST) Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) (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 79D4582E00 for ; Mon, 28 Jun 2021 19:15:41 +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-x331.google.com with SMTP id a5-20020a05683012c5b029046700014863so2732335otq.5 for ; Mon, 28 Jun 2021 10:15:41 -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=minLh0cG0W+16FfajH9JuQCXIVg2q+m0pnZGn0EWjzA=; b=omZFIIU76h0iLs84DhybNUVGTclt0fyxD1I4FR0lccXXr/JLZOQ9gGWPHbOca8cpuG RlBVyzUJoDEADAszhSXI/xl5GxyMrjOntt6X50LDCNCtN/SNNFYSuXiE7Q3FuT5d5FSO gHqFNYInsg9lmsR+BRBQFy83p/3pDunfD2PT3Yfpmpa/jd/kjWAFqolnBBDAUwnr4m4M JYqXcmgMXlKUlqL5/8Wflc6Usi+ZEkRWvgfXI4HGMcSNpZ6/WvE5024cBZ7M2TfmwX/D vm6l5KMEMKKNfK+jgb3TpzQDKlMMzSEqPw9xd46K5R8OlmfVe3/X8ykN2d5bWPTiJgwb nlTg== 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=minLh0cG0W+16FfajH9JuQCXIVg2q+m0pnZGn0EWjzA=; b=MKATwusQBrAxb9jXho9jk7fVhi3dBXgUyEY5+/19pOspdoD99wnHGbKZD+wSuoF2Ht epmxHv2bmzogAmchbDH+8GVnnpkkjaYrji4ZQvuho+fSjEAUGoFnPhks79rRianUe3ww s3/5UmbW795HGr0RkRnPdVHVGgi23euTU1qL2Ext+0Rt8Rz9hgL4MFtq6AITBPOHybg3 1RTt2pCUNHiRcA6dNL08JQvsw/kvQJ7Xp4MmKT3dMMT27x2B+79kPBqmHh0e0jaRRJDJ 5OZ2F90OaAEo9aBoUB6ZY4z0md9okfaqrr46ZGJoQPJzhJ606tNO7KR97FMKDtT49Lac 4/PA== X-Gm-Message-State: AOAM532sF0RsixiixdXms9JExzlE9YXr2eAHT0nxI3mwG3n+uhQ1s9+b MxpxAfBWeeIs7J/6V8I+bMzAt6wl8VFaaZQrCQKFM5gCUTY= X-Google-Smtp-Source: ABdhPJy9rGFFwYxSepurZtatwcFgkQeqq3mEdL16Eldms6RxDdlMIhEz4KfPckqFzP4zy8o51FID80Niaie/phcwnk4= X-Received: by 2002:a9d:60d1:: with SMTP id b17mr571423otk.31.1624900540030; Mon, 28 Jun 2021 10:15:40 -0700 (PDT) MIME-Version: 1.0 References: <20210628084009.3098-1-stephan@gerhold.net> In-Reply-To: <20210628084009.3098-1-stephan@gerhold.net> From: Ramon Fried Date: Mon, 28 Jun 2021 20:15:28 +0300 Message-ID: Subject: Re: [PATCH] serial: serial_msm: Ensure BAM/single character mode are disabled To: Stephan Gerhold Cc: U-Boot Mailing List 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 Mon, Jun 28, 2021 at 11:40 AM Stephan Gerhold wrote: > > At the moment, the U-Boot serial_msm driver does not initialize the > UART_DM_DMEN register with the required value. Usually this does not > cause any problems, because there is Qualcomm's LK bootloader running > before U-Boot which initializes the register with the correct value. > > It's important that this register is initialized correctly, because > the U-Boot driver does not make use of the BAM/DMA or single character > mode functionality of the UART controller. A different bootloader > before U-Boot might initialize the register differently. > > For example, on DragonBoard 410c U-Boot can also be installed to the > "aboot" partition (replacing LK entirely). In this case U-Boot is > loaded directly by SBL, which seems to use the single-character mode > for some reason. In single character mode there is always just one > char in the FIFO, instead of the 4 characters expected by > msm_serial_fetch(). It also causes issues with "earlycon" later in > the Linux kernel, which tries to output 4 chars at once, > but only the first char will be written. > > This causes early UART log in Linux to be corrupted like this: > > [ 00ano:ameoi .Q1B[ 00ac _idaM00080oo'ahani-lcle._20). 15NdNii 5 SPMSJ20:U2 > [ 00rkoolmsamel > [ 00Fw ]elamletopsioble > [ 00ore > > instead of > > [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd030] > [ 0.000000] Machine model: Qualcomm Technologies, Inc. APQ 8016 SBC > [ 0.000000] earlycon: msm_serial_dm0 at MMIO 0x00000000078b0000 (options '') > [ 0.000000] printk: bootconsole [msm_serial_dm0] enabled > > Make sure to initialize UART_DM_DMEN correctly to fix this issue > when loading U-Boot directly after SBL (instead of through LK). > > There is no functional difference when loading U-Boot through LK > since LK also initializes UART_DM_DMEN to 0x0. [1] > > [1]: https://git.linaro.org/landing-teams/working/qualcomm/lk.git/tree/platform/msm_shared/uart_dm.c?h=dragonboard410c-LA.BR.1.2.7-03810-8x16.0-linaro3#n203 > > Cc: Ramon Fried > 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 d8c6c2f6b5..d8dd5c1104 100644 > --- a/drivers/serial/serial_msm.c > +++ b/drivers/serial/serial_msm.c > @@ -23,6 +23,7 @@ > /* Serial registers - this driver works in uartdm mode*/ > > #define UARTDM_DMRX 0x34 /* Max RX transfer length */ > +#define UARTDM_DMEN 0x3C /* DMA/data-packing mode */ > #define UARTDM_NCF_TX 0x40 /* Number of chars to TX */ > > #define UARTDM_RXFS 0x50 /* RX channel status register */ > @@ -197,6 +198,9 @@ static void uart_dm_init(struct msm_serial_data *priv) > writel(MSM_BOOT_UART_DM_8_N_1_MODE, priv->base + UARTDM_MR2); > writel(MSM_BOOT_UART_DM_CMD_RESET_RX, priv->base + UARTDM_CR); > writel(MSM_BOOT_UART_DM_CMD_RESET_TX, priv->base + UARTDM_CR); > + > + /* Make sure BAM/single character mode is disabled */ > + writel(0x0, priv->base + UARTDM_DMEN); > } > static int msm_serial_probe(struct udevice *dev) > { > -- > 2.32.0 > Hi. This is strange, I never encountered the behaviour, and I did boot Linux after U-boot without LK in the way.