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.

AM623: Changing console from UART0 to UART2

Part Number: AM623

Dear TI teams,

I changed the default terminal debugging serial port uart0 to uart2 and started the system. I found that both uart0 and uart2 had log output. Can you help analyze the reason?

Thanks!

After startup, both serial ports have login prompts output:

uart2

uart0

Do I need to mask ttySx that is not used in/etc/securetty?

 

  • Hi,

    Please provide the patches showing how you changed the console port from uart0 to uart2.

  • Hi Bin,

    The patch is as follows:

    uboot

    diff --git a/arch/arm/dts/k3-am62x-r5-sk-common.dtsi b/arch/arm/dts/k3-am62x-r5-sk-common.dtsi
    index b4a5e3cfa1..d5976095e9 100644
    --- a/arch/arm/dts/k3-am62x-r5-sk-common.dtsi
    +++ b/arch/arm/dts/k3-am62x-r5-sk-common.dtsi
    @@ -13,7 +13,7 @@
     	};
     
     	chosen {
    -		stdout-path = "serial2:115200n8";
    +		stdout-path = "serial4:115200n8";
     		tick-timer = &timer1;
     	};
     
    diff --git a/arch/arm/dts/k3-am62x-sk-common-u-boot.dtsi b/arch/arm/dts/k3-am62x-sk-common-u-boot.dtsi
    index b57d9563d8..acc064337a 100644
    --- a/arch/arm/dts/k3-am62x-sk-common-u-boot.dtsi
    +++ b/arch/arm/dts/k3-am62x-sk-common-u-boot.dtsi
    @@ -6,7 +6,7 @@
     
     / {
     	chosen {
    -		stdout-path = "serial2:115200n8";
    +		stdout-path = "serial4:115200n8";
     		tick-timer = &timer1;
     	};
     
    diff --git a/arch/arm/dts/k3-am62x-sk-common.dtsi b/arch/arm/dts/k3-am62x-sk-common.dtsi
    index 72ebb1400f..58a3bc713e 100644
    --- a/arch/arm/dts/k3-am62x-sk-common.dtsi
    +++ b/arch/arm/dts/k3-am62x-sk-common.dtsi
    @@ -14,7 +14,7 @@
     
     / {
     	aliases {
    -		serial2 = &main_uart0;
    +		serial4 = &main_uart2;
     		mmc0 = &sdhci0;
     		mmc1 = &sdhci1;
     		mmc2 = &sdhci2;
    @@ -25,8 +25,8 @@
     	};
     
     	chosen {
    -		stdout-path = "serial2:115200n8";
    -		bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000";
    +		stdout-path = "serial4:115200n8";
    +		bootargs = "console=ttyS4,115200n8 earlycon=ns16550a,mmio32,0x02820000";
     	};
     
     	memory@80000000 {
    @@ -154,10 +154,17 @@
     };
     
     &main_pmx0 {
    -	main_uart0_pins_default: main-uart0-pins-default {
    +	// main_uart0_pins_default: main-uart0-pins-default {
    +	// 	pinctrl-single,pins = <
    +	// 		AM62X_IOPAD(0x1c8, PIN_INPUT, 0) /* (D14) UART0_RXD */
    +	// 		AM62X_IOPAD(0x1cc, PIN_OUTPUT, 0) /* (E14) UART0_TXD */
    +	// 	>;
    +	// };
    +
    +		main_uart2_pins_default: main-uart2-pins-default {
     		pinctrl-single,pins = <
    -			AM62X_IOPAD(0x1c8, PIN_INPUT, 0) /* (D14) UART0_RXD */
    -			AM62X_IOPAD(0x1cc, PIN_OUTPUT, 0) /* (E14) UART0_TXD */
    +			AM62X_IOPAD(0x01d0, PIN_INPUT, 3) /* (B14) UART0_CTSn.UART2_RXD */
    +			AM62X_IOPAD(0x01d4, PIN_OUTPUT, 3) /* (C13) UART0_RTSn.UART2_TXD */
     		>;
     	};
     
    @@ -301,8 +308,7 @@
     };
     
     &main_uart0 {
    -	pinctrl-names = "default";
    -	pinctrl-0 = <&main_uart0_pins_default>;
    +	status = "disabled";
     };
     
     &main_uart1 {
    @@ -311,7 +317,9 @@
     };
     
     &main_uart2 {
    -	status = "disabled";
    +	pinctrl-names = "default";
    +	pinctrl-0 = <&main_uart2_pins_default>;
    +	status = "okay";
     };
     
     &main_uart3 {
    
    diff --git a/arch/arm/mach-k3/am62x/clk-data.c b/arch/arm/mach-k3/am62x/clk-data.c
    index 47ea973197..9f8d7d7e6f 100644
    --- a/arch/arm/mach-k3/am62x/clk-data.c
    +++ b/arch/arm/mach-k3/am62x/clk-data.c
    @@ -115,11 +115,16 @@ static const char * const wkup_clksel_out0_parents[] = {
     	"hsdiv4_16fft_mcu_0_hsdivout0_clk",
     };
     
    -static const char * const main_usart0_fclk_sel_out0_parents[] = {
    -	"usart_programmable_clock_divider_out0",
    +static const char * const main_usart2_fclk_sel_out0_parents[] = {
    +	"usart_programmable_clock_divider_out2",
     	"hsdiv4_16fft_main_1_hsdivout1_clk",
     };
     
    +// static const char * const main_usart0_fclk_sel_out0_parents[] = {
    +// 	"usart_programmable_clock_divider_out0",
    +// 	"hsdiv4_16fft_main_1_hsdivout1_clk",
    +// };
    +
     static const struct clk_data clk_list[] = {
     	CLK_FIXED_RATE("osc_26_mhz", 26000000, 0),
     	CLK_FIXED_RATE("osc_25_mhz", 25000000, 0),
    @@ -199,10 +204,12 @@ static const struct clk_data clk_list[] = {
     	CLK_MUX("main_gpmc_fclk_sel_out0", main_gpmc_fclk_sel_out0_parents, 2, 0x108180, 0, 1, 0),
     	CLK_MUX("main_gtcclk_sel_out0", main_gtcclk_sel_out0_parents, 8, 0x43008030, 0, 3, 0),
     	CLK_MUX("main_ospi_ref_clk_sel_out0", main_ospi_ref_clk_sel_out0_parents, 2, 0x108500, 0, 1, 0),
    -	CLK_DIV_DEFFREQ("usart_programmable_clock_divider_out0", "hsdiv4_16fft_main_1_hsdivout0_clk", 0x108240, 0, 2, 0, 0, 48000000),
    +	CLK_DIV_DEFFREQ("usart_programmable_clock_divider_out2", "hsdiv4_16fft_main_1_hsdivout0_clk", 0x108248, 0, 2, 0, 0, 48000000),
    +	//CLK_DIV_DEFFREQ("usart_programmable_clock_divider_out0", "hsdiv4_16fft_main_1_hsdivout0_clk", 0x108240, 0, 2, 0, 0, 48000000),
     	CLK_MUX("wkup_clkout_sel_out0", wkup_clkout_sel_out0_parents, 8, 0x43008020, 0, 3, 0),
     	CLK_MUX("wkup_clksel_out0", wkup_clksel_out0_parents, 2, 0x43008010, 0, 1, 0),
    -	CLK_MUX("main_usart0_fclk_sel_out0", main_usart0_fclk_sel_out0_parents, 2, 0x108280, 0, 1, 0),
    +	CLK_MUX("main_usart2_fclk_sel_out0", main_usart2_fclk_sel_out0_parents, 2, 0x108288, 0, 1, 0), 
    +	//CLK_MUX("main_usart0_fclk_sel_out0", main_usart0_fclk_sel_out0_parents, 2, 0x108280, 0, 1, 0), 
     	CLK_DIV("hsdiv4_16fft_mcu_0_hsdivout1_clk", "pllfracf2_ssmod_16fft_mcu_0_foutvcop_clk", 0x4040084, 0, 7, 0, 0),
     	CLK_FIXED_RATE("mshsi2c_wkup_0_porscl", 0, 0),
     	CLK_DIV("sam62_pll_ctrl_wrap_main_0_chip_div24_clk_clk", "sam62_pll_ctrl_wrap_main_0_sysclkout_clk", 0x41011c, 0, 5, 0, 0),
    @@ -297,10 +304,14 @@ static const struct dev_clk soc_dev_clk_data[] = {
     	DEV_CLK(136, 0, "hsdiv0_16fft_main_8_hsdivout0_clk"),
     	DEV_CLK(140, 0, "sam62_pll_ctrl_wrap_mcu_0_chip_div1_clk_clk"),
     	DEV_CLK(140, 1, "sam62_pll_ctrl_wrap_mcu_0_chip_div1_clk_clk"),
    -	DEV_CLK(146, 0, "main_usart0_fclk_sel_out0"),
    -	DEV_CLK(146, 1, "usart_programmable_clock_divider_out0"),
    -	DEV_CLK(146, 2, "hsdiv4_16fft_main_1_hsdivout1_clk"),
    -	DEV_CLK(146, 5, "sam62_pll_ctrl_wrap_main_0_chip_div1_clk_clk"),
    +	// DEV_CLK(146, 0, "main_usart0_fclk_sel_out0"),
    +	// DEV_CLK(146, 1, "usart_programmable_clock_divider_out0"),
    +	// DEV_CLK(146, 2, "hsdiv4_16fft_main_1_hsdivout1_clk"),
    +	// DEV_CLK(146, 5, "sam62_pll_ctrl_wrap_main_0_chip_div1_clk_clk"),
    +	DEV_CLK(153, 0, "main_usart2_fclk_sel_out0"),
    +	DEV_CLK(153, 1, "usart_programmable_clock_divider_out2"),
    +	DEV_CLK(153, 2, "hsdiv4_16fft_main_1_hsdivout1_clk"),
    +	DEV_CLK(153, 5, "sam62_pll_ctrl_wrap_main_0_chip_div1_clk_clk"),
     	DEV_CLK(157, 20, "clkout0_ctrl_out0"),
     	DEV_CLK(157, 21, "hsdiv4_16fft_main_2_hsdivout1_clk"),
     	DEV_CLK(157, 22, "hsdiv4_16fft_main_2_hsdivout1_clk"),
    diff --git a/arch/arm/mach-k3/am62x/dev-data.c b/arch/arm/mach-k3/am62x/dev-data.c
    index f413313533..a1954d5ca2 100644
    --- a/arch/arm/mach-k3/am62x/dev-data.c
    +++ b/arch/arm/mach-k3/am62x/dev-data.c
    @@ -62,7 +62,8 @@ static struct ti_dev soc_dev_list[] = {
     	PSC_DEV(162, &soc_lpsc_list[10]),
     	PSC_DEV(75, &soc_lpsc_list[11]),
     	PSC_DEV(102, &soc_lpsc_list[12]),
    -	PSC_DEV(146, &soc_lpsc_list[12]),
    +	PSC_DEV(153, &soc_lpsc_list[12]),
    +	// PSC_DEV(146, &soc_lpsc_list[12]),
     	PSC_DEV(13, &soc_lpsc_list[13]),
     	PSC_DEV(166, &soc_lpsc_list[14]),
     	PSC_DEV(135, &soc_lpsc_list[15]),
    
    diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h
    index a598607ead..4f4c8bba1d 100644
    --- a/include/environment/ti/boot.h
    +++ b/include/environment/ti/boot.h
    @@ -12,7 +12,8 @@
     #include <linux/stringify.h>
     
     #ifndef CONSOLEDEV
    -#define CONSOLEDEV "ttyS2"
    +// #define CONSOLEDEV "ttyS2"
    +#define CONSOLEDEV "ttyS4"
     #endif
     
     #ifndef PARTS_DEFAULT
    
    diff --git a/include/configs/am62x_evm.h b/include/configs/am62x_evm.h
    index 97bd7c1fd7..70004fbb79 100644
    --- a/include/configs/am62x_evm.h
    +++ b/include/configs/am62x_evm.h
    @@ -129,9 +129,9 @@
                            "setenv name_fdt k3-am62x-lp-sk.dtb; fi;"       \
                    "setenv fdtfile ${name_fdt}\0"                          \
            "name_kern=Image\0"                                             \
    -       "console=ttyS2,115200n8\0"                                      \
    +       "console=ttyS4,115200n8\0"                                      \
            "args_all=setenv optargs ${optargs} "                           \
    -               "earlycon=ns16550a,mmio32,0x02800000 ${mtdparts}\0"     \
    +               "earlycon=ns16550a,mmio32,0x02820000 ${mtdparts}\0"     \
            "run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}\0"
     
     /* U-Boot MMC-specific configuration */
    
    

    kernel

    diff --git a/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi b/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi
    index 3e7204440f..59ff3377ad 100644
    --- a/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi
    +++ b/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi
    @@ -8,25 +8,32 @@
     / {
     	aliases {
     		serial2 = &main_uart0;
    +		serial3 = &main_uart1;
    +		serial4 = &main_uart2;
     		mmc0 = &sdhci0;
    -		mmc1 = &sdhci1;
    -		mmc2 = &sdhci2;
    -		spi0 = &ospi0;
    -		usb0 = &usb0;
    -		usb1 = &usb1;
    +		// mmc1 = &sdhci1;
    +		// mmc2 = &sdhci2;
    +		//usb0 = &usb0;
    +		// usb1 = &usb1;
     		ethernet0 = &cpsw_port1;
     		ethernet1 = &cpsw_port2;
     	};
     
     	chosen {
    -		stdout-path = "serial2:115200n8";
    -		bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000";
    +		stdout-path = "serial4:115200n8";
    +		bootargs = "console=ttyS4,115200n8 earlycon=ns16550a,mmio32,0x02820000";
     	};
     
     &main_pmx0 {
    @@ -235,6 +241,20 @@ AM62X_IOPAD(0x1cc, PIN_OUTPUT, 0) /* (E14) UART0_TXD */
     		>;
     	};
     
    +	main_uart1_pins_default: main-uart1-pins-default {
    +		pinctrl-single,pins = <
    +			AM62X_IOPAD(0x01ac, PIN_INPUT, 2) /* (D15) MCASP0_AFSR.UART1_RXD */
    +			AM62X_IOPAD(0x01b0, PIN_OUTPUT, 2) /* (D16) MCASP0_ACLKR.UART1_TXD */
    +		>;
    +	};
    +
    +	main_uart2_pins_default: main-uart2-pins-default {
    +		pinctrl-single,pins = <
    +			AM62X_IOPAD(0x01d0, PIN_INPUT, 3) /* (B14) UART0_CTSn.UART2_RXD */
    +			AM62X_IOPAD(0x01d4, PIN_OUTPUT, 3) /* (C13) UART0_RTSn.UART2_TXD */
    +		>;
    +	};
    +
     	main_i2c0_pins_default: main-i2c0-pins-default {
     		pinctrl-single,pins = <
     			AM62X_IOPAD(0x1e0, PIN_INPUT_PULLUP, 0) /* (B16) I2C0_SCL */
    @@ -301,9 +321,10 @@ AM62X_IOPAD(0x128, PIN_INPUT, 7) /* (B23) MMC2_SDWP.GPIO0_72 */
     		>;
     	};
     
     
    @@ -314,115 +335,91 @@ AM62X_IOPAD(0x15c, PIN_INPUT, 0) /* (AB22) MDIO0_MDIO */
     		>;
     	};
     };
     
     &wkup_uart0 {
    @@ -437,15 +434,20 @@ &mcu_uart0 {
     &main_uart0 {
     	pinctrl-names = "default";
     	pinctrl-0 = <&main_uart0_pins_default>;
    +	//status = "reserved";
     };
     
     &main_uart1 {
     	/* Main UART1 is used by TIFS firmware */
    -	status = "reserved";
    +	pinctrl-names = "default";
    +	pinctrl-0 = <&main_uart1_pins_default>;
    +	//status = "reserved";
     };
     
     &main_uart2 {
    -	status = "disabled";
    +	pinctrl-names = "default";
    +	pinctrl-0 = <&main_uart2_pins_default>;
    +	//status = "disabled";
     };
     
     &main_uart3 {
     };
     
    

  • Hi,

    Please run the following commands on UART2 console, then reboot your board to see if the login prompt still show in on UART0.

    # systemctl stop serial-getty@ttyS2.service
    # systemctl disable serial-getty@ttyS2.service

  • Hi,

    After executing the above two instructions and restarting, there was no startup log displayed in UART0.

  • Hi,

    I am glad the issue is resolved. Thanks for the update.