[FAQ] TDA4VM: J721e:/J7200: How to switch console to a different UART instance

Part Number: TDA4VM

I want to switch console to a different UART instance. I do not have MAIN_UART0 wired out can i move all
the prints to MCU_UART0? If yes how do I do that?

  • Yes. That is possible.

    As per the boot flow we have 3 stages.

    1. R5 SPL
    2. A72 SPL
    3. A72 u-boot.

    So we need to change at all levels. On top of that ATF(Arm Trusted Firmware) also needs to change the console port as needed.

    Following are the dts changes on J7200 & similar changes for J721e will work fine:

    diff --git a/arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi
    index f55c71f0c4..5d641f3074 100644
    --- a/arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi
    +++ b/arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi
    @@ -5,7 +5,7 @@
     
     / {
            chosen {
    -               stdout-path = "serial2:115200n8";
    +               stdout-path = "serial1:115200n8";
                    tick-timer = &timer1;
            };
     
    diff --git a/arch/arm/dts/k3-j7200-common-proc-board.dts b/arch/arm/dts/k3-j7200-common-proc-board.dts
    index 4a4600cd87..23fbfb95dc 100644
    --- a/arch/arm/dts/k3-j7200-common-proc-board.dts
    +++ b/arch/arm/dts/k3-j7200-common-proc-board.dts
    @@ -11,7 +11,7 @@
     
     / {
            chosen {
    -               stdout-path = "serial2:115200n8";
    +               stdout-path = "serial1:115200n8";
                    bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000";
            };
    

    The above dts changes take care of the SPL/u-boot side.

    Now we also need to change in ATF (Arm Trusted Firmware).

    Attached patch needs to be applied on top of ATF directory in the SDK: 

    0001-plat-ti-k3-include-platform_def.h-Change-console-UAR.patch.txt
    From 54990cac252c3f2eadfd5027198501817f2e5af0 Mon Sep 17 00:00:00 2001
    From: Keerthy <j-keerthy@ti.com>
    Date: Tue, 23 Mar 2021 21:56:29 +0530
    Subject: [PATCH] plat: ti: k3: include: platform_def.h: Change console UART
     from MAIN_UART0 to MCU_UART0
    
    Change console UART from MAIN_UART0 to MCU_UART0.
    
    Signed-off-by: Keerthy <j-keerthy@ti.com>
    ---
     plat/ti/k3/include/platform_def.h | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/plat/ti/k3/include/platform_def.h b/plat/ti/k3/include/platform_def.h
    index 690c68e5c..db083ca2f 100644
    --- a/plat/ti/k3/include/platform_def.h
    +++ b/plat/ti/k3/include/platform_def.h
    @@ -91,14 +91,14 @@
     
     /* Platform default console definitions */
     #ifndef K3_USART_BASE
    -#define K3_USART_BASE 0x02800000
    +#define K3_USART_BASE 0x40a00000
     #endif
     
     /* USART has a default size for address space */
     #define K3_USART_SIZE 0x1000
     
     #ifndef K3_USART_CLK_SPEED
    -#define K3_USART_CLK_SPEED 48000000
    +#define K3_USART_CLK_SPEED 96000000
     #endif
     
     /* Crash console defaults */
    -- 
    2.17.1
    
    

    Follow the below instructions to apply and compile:

    cd $SDK_PATH/board-support/trusted-firmware-a-2.3
    git am 0001-plat-ti-k3-include-platform_def.h-Change-console-UAR.patch.txt
    make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=generic SPD=opteed
    cp ./build/k3/generic/release/bl31.bin ../prebuilt-images/
    cd ../..
    make u-boot
    cp board-support/u-boot_build/A72/tispl.bin board-support/u-boot_build/A72/u-boot.img /media/$USER/BOOT

    In case you want to avoid compilation of ATF: Just unzip & use the attached binary:


    bl31.zip

    copy it directly to $SDK_PATH/prebuilt-images

    then 'make u-boot' to make the new bl31.bin part of tispl.bin.

    Best Regards,
    Keerthy