This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[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 207448c4..7a27938a 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 423cf546..3ac1e9e3 100644
    --- a/arch/arm/dts/k3-j7200-common-proc-board.dts
    +++ b/arch/arm/dts/k3-j7200-common-proc-board.dts
    @@ -14,8 +14,8 @@
     
     / {
     	chosen {
    -		stdout-path = "serial2:115200n8";
    -		bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000";
    +		stdout-path = "serial1:115200n8";
    +		bootargs = "console=ttyS1,115200n8 earlycon=ns16550a,mmio32,0x40a00000";
     	};
     
     	aliases {
    diff --git a/include/configs/j721e_evm.h b/include/configs/j721e_evm.h
    index 1a84a68b..c4f4be5f 100644
    --- a/include/configs/j721e_evm.h
    +++ b/include/configs/j721e_evm.h
    @@ -93,8 +93,8 @@
     		"setenv name_fdt ${default_device_tree};"		\
     		"setenv fdtfile ${name_fdt}\0"				\
     	"name_kern=Image\0"						\
    -	"console=ttyS2,115200n8\0"					\
    -	"args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 "	\
    +	"console=ttyS1,115200n8\0"					\
    +	"args_all=setenv optargs earlycon=ns16550a,mmio32,0x40a00000 "	\
     		"${mtdparts}\0"						\
     	"run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}\0"
     
    diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h
    index 9300ec49..d71262d6 100644
    --- a/include/environment/ti/boot.h
    +++ b/include/environment/ti/boot.h
    @@ -10,7 +10,7 @@
     #define __TI_BOOT_H
     
     #ifndef CONSOLEDEV
    -#define CONSOLEDEV "ttyS2"
    +#define CONSOLEDEV "ttyS1"
     #endif
     
     #define VBMETA_PART_SIZE		(64 * 1024)

    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.

    Kernel changes for switching console from MAIN_UART0 to MCU_UART

    diff --git a/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts b/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts
    index 3ac2dab2a..f67fd65af 100644
    --- a/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts
    +++ b/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts
    @@ -15,8 +15,8 @@
     
     / {
     	chosen {
    -		stdout-path = "serial2:115200n8";
    -		bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000";
    +		stdout-path = "serial1:115200n8";
    +		bootargs = "console=ttyS1,115200n8 earlycon=ns16550a,mmio32,0x40a00000";
     	};
     
     	vdd_mmc1: fixedregulator-sd {
    @@ -144,6 +144,11 @@
     	power-domains = <&k3_pds 146 TI_SCI_PD_SHARED>;
     };
     
    +&mcu_uart0 {
    +	power-domains = <&k3_pds 149 TI_SCI_PD_SHARED>;
    +	status = "okay";
    +};
    +
     &main_uart2 {
     	/* MAIN UART 2 is used by R5F firmware */
     	status = "disabled";


    Best Regards,
    Keerthy