Yocto Project Discussions
 help / color / mirror / Atom feed
From: Trevor Woerner <twoerner@gmail.com>
To: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Cc: yocto@lists.yoctoproject.org, Quentin Schulz <foss@0leil.net>
Subject: Re: [meta-rockchip][PATCH] trusted-firmware-a: replace baudrate with the one specified in machine conf
Date: Fri, 10 Dec 2021 09:43:39 -0500	[thread overview]
Message-ID: <20211210144339.GA26689@localhost> (raw)
In-Reply-To: <20211111170002.2023006-1-quentin.schulz@theobroma-systems.com>

On Thu 2021-11-11 @ 06:00:02 PM, Quentin Schulz wrote:
> Not all Rockchip boards have their console running at 1500000 baud in
> U-Boot and the kernel. Such is the case for puma-haikou RK3399-based
> SoM+Carrierboard.
> 
> In order to prepare for the addition of puma-haikou to meta-rockchip,
> let's replace the baudrate in TF-A by the one defined in the machine
> conf file in the RK_CONSOLE_BAUD variable.
> 
> Cc: Quentin Schulz <foss@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>  .../files/serial-console-baudrate.patch       | 36 -------------------
>  .../trusted-firmware-a_%.bbappend             |  7 +++-
>  2 files changed, 6 insertions(+), 37 deletions(-)
>  delete mode 100644 recipes-bsp/trusted-firmware-a/files/serial-console-baudrate.patch
> 
> diff --git a/recipes-bsp/trusted-firmware-a/files/serial-console-baudrate.patch b/recipes-bsp/trusted-firmware-a/files/serial-console-baudrate.patch
> deleted file mode 100644
> index 2d6e9bf..0000000
> --- a/recipes-bsp/trusted-firmware-a/files/serial-console-baudrate.patch
> +++ /dev/null
> @@ -1,36 +0,0 @@
> -From 840d6b6420e1fd8cdf6e4de7fa58a6f8de151622 Mon Sep 17 00:00:00 2001
> -From: Yann Dirson <yann@blade-group.com>
> -Date: Tue, 6 Apr 2021 17:28:45 +0200
> -Subject: [PATCH] Set serial console baudrate back to 1500000.
> -Upstream-Status: Inappropriate[other]
> -
> -TF-A runs between two u-boot stages which both uses 1500000 baud, it
> -just makes no sense to use the same UART at a different rate.
> -
> -This effectively reverts part of 0c05748bdebfad9fa43a80962186438bb8fbce62.
> -Main reason for that change stated in https://developer.trustedfirmware.org/T762
> -is ChromeOS compatibility.
> -
> -Looks like this patch may become unnecessary in the future, when
> -u-boot and TF-A get to communicate this value.
> -
> ----
> - plat/rockchip/rk3399/rk3399_def.h | 2 +-
> - 1 file changed, 1 insertion(+), 1 deletion(-)
> -
> -diff --git a/plat/rockchip/rk3399/rk3399_def.h b/plat/rockchip/rk3399/rk3399_def.h
> -index ba83242eb..8d6ecfbe6 100644
> ---- a/plat/rockchip/rk3399/rk3399_def.h
> -+++ b/plat/rockchip/rk3399/rk3399_def.h
> -@@ -17,7 +17,7 @@
> - /**************************************************************************
> -  * UART related constants
> -  **************************************************************************/
> --#define RK3399_BAUDRATE			115200
> -+#define RK3399_BAUDRATE			1500000
> - #define RK3399_UART_CLOCK		24000000
> - 
> - /******************************************************************************
> --- 
> -2.30.2
> -
> diff --git a/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend b/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend
> index f7777a7..0d06c44 100644
> --- a/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend
> +++ b/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend
> @@ -7,9 +7,14 @@ COMPATIBLE_MACHINE:append:rk3328 = "|rk3328"
>  
>  FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
>  SRC_URI += "\
> -    file://serial-console-baudrate.patch \
>      file://0001-Fix-build-with-gcc-11.patch \
>      file://0001-dram-Fix-build-with-gcc-11.patch \
>      file://0001-plat_macros.S-Use-compatible-.asciz-asm-directive.patch \
>      file://0001-pmu-Do-not-mark-already-defined-functions-as-weak.patch \
>  "
> +
> +fixup_rk3399_baudrate() {
> +	sed -i "s/#define RK3399_BAUDRATE			115200/#define RK3399_BAUDRATE ${RK_CONSOLE_BAUD}/" ${S}/plat/rockchip/rk3399/rk3399_def.h
> +}

This looks fragile to me, any change in the number of spaces/tabs and this
line will stop working. Thankfully the symbol RK3399_BAUDRATE only appears
once in this file! That will allow us to do something like the following
instead:

	sed '/RK3399_BAUDRATE.*/RK3399_BAUDRATE ${RK_CONSOLE_BAUD}/d'

Can you test and submit a v2 please?

> +
> +do_patch[postfuncs] += "fixup_rk3399_baudrate"
> -- 
> 2.30.2
> 


       reply	other threads:[~2021-12-10 14:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211111170002.2023006-1-quentin.schulz@theobroma-systems.com>
2021-12-10 14:43 ` Trevor Woerner [this message]
     [not found]   ` <20211210145019.uoqk2f2zhexdibha@fedora>
2021-12-10 16:15     ` [meta-rockchip][PATCH] trusted-firmware-a: replace baudrate with the one specified in machine conf Trevor Woerner
     [not found]     ` <16BF70EEDDE19961.29912@lists.yoctoproject.org>
2021-12-13 22:37       ` [yocto] " Trevor Woerner

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=20211210144339.GA26689@localhost \
    --to=twoerner@gmail.com \
    --cc=foss@0leil.net \
    --cc=quentin.schulz@theobroma-systems.com \
    --cc=yocto@lists.yoctoproject.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox