Access two uart(UART1 and UART2) in Uboot

Hi Team,

I am working on imx6ull board. I want to access two uart (UART1 and UART2) in Uboot. UART1 is used for serial console log and UART2 is used for sending user data while loading Uboot in RAM. UART1 is working fine as seen serial log on console. But, How can I check UART2 is working or not in Uboot and is there any utility? I have made changes for UART2 as given here. Please let me know, if missing here.

I am working on imx6ull board. I want to access two uart (UART1 and UART2) in Uboot. UART1 is used for serial console log and UART2 is used for sending user data while loading Uboot in RAM. UART1 is working fine as seen serial log on console. But, How can I check UART2 is working or not in Uboot and is there any utility? I have made changes for UART2 as given here. Please let me know, if missing here.

   diff --git a/arch/arm/dts/imx6ull-colibri.dts b/arch/arm/dts/imx6ull-colibri.dts
index 28b7ef6..9727301 100644
--- a/arch/arm/dts/imx6ull-colibri.dts
+++ b/arch/arm/dts/imx6ull-colibri.dts
@@ -86,6 +86,14 @@
 	status = "okay";
 };
 
+&uart2 {
+        pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_uart2>;
+        uart-has-rtscts;
+        fsl,dte-mode;
+        status = "okay";
+};
+
 &iomuxc {
 	pinctrl_i2c1: i2c1grp {
 		fsl,pins = <
@@ -129,6 +137,15 @@
 			MX6UL_PAD_UART1_CTS_B__UART1_DTE_RTS	0x79
 		>;
 	};
+
+	pinctrl_uart2: uart2-grp {
+		fsl,pins = <
+			MX6UL_PAD_UART2_TX_DATA__UART2_DTE_RX   0x1b0b1
+			MX6UL_PAD_UART2_RX_DATA__UART2_DTE_TX   0x1b0b1
+			MX6UL_PAD_UART2_CTS_B__UART2_DTE_RTS    0x1b0b1
+			MX6UL_PAD_UART2_RTS_B__UART2_DTE_CTS    0x1b0b1
+		>;
+	};
 };
 
 &iomuxc_snvs {
diff --git a/board/toradex/colibri-imx6ull/colibri_imx6ull.c b/board/toradex/colibri-imx6ull/colibri_imx6ull.c
index 6f6aeeb..943937d 100644
--- a/board/toradex/colibri-imx6ull/colibri_imx6ull.c
+++ b/board/toradex/colibri-imx6ull/colibri_imx6ull.c
@@ -84,6 +84,13 @@ static iomux_v3_cfg_t const uart1_pads[] = {
 	MX6_PAD_UART1_CTS_B__UART1_DTE_RTS	| MUX_PAD_CTRL(UART_PAD_CTRL),
 };
 
+static iomux_v3_cfg_t const uart2_pads[] = {
+        MX6_PAD_UART2_TX_DATA__UART2_DTE_RX     | MUX_PAD_CTRL(UART_PAD_CTRL),
+        MX6_PAD_UART2_RX_DATA__UART2_DTE_TX     | MUX_PAD_CTRL(UART_PAD_CTRL),
+        MX6_PAD_UART2_RTS_B__UART2_DTE_CTS      | MUX_PAD_CTRL(UART_PAD_CTRL),
+        MX6_PAD_UART2_CTS_B__UART2_DTE_RTS      | MUX_PAD_CTRL(UART_PAD_CTRL),
+};
+
 static iomux_v3_cfg_t const usdhc1_pads[] = {
 	MX6_PAD_SD1_CLK__USDHC1_CLK	| MUX_PAD_CTRL(USDHC_PAD_CTRL),
 	MX6_PAD_SD1_CMD__USDHC1_CMD	| MUX_PAD_CTRL(USDHC_PAD_CTRL),
@@ -356,6 +363,10 @@ int board_init(void)
 	/* address of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
+	imx_iomux_v3_setup_multiple_pads(uart2_pads, ARRAY_SIZE(uart2_pads));
+
 #ifdef CONFIG_FEC_MXC
 	setup_fec();
 #endif

Thanks,
KG

hi @Kano1992 and Welcome to the Toradex Community!

Could you provide the version of the Hardware and Software of your module?
Which carrier board are you using?

But, How can I check UART2 is working or not in Uboot and is there any utility?

What exactly is your use-case for the UART2?

Best regards,
Jaski

Hi @jaski.tx

Thanks for quick response.

Hardware: col iMX6ULL 512MB WB IT (Iris Carrier Board)
Version: V1.0A
U-boot version: 2016.112.8.6+g02735f4
Kernel Version: v4.1.15

Use case: I am deploying OPTEE os on imx6ull board. I want to connect GPRS module on UART2 in the board and access UART2 from OPTEE os. normal OS can’t access UART2 by configuring CSU register in OPTEE os. OPTEE os has no UART initialisation code. so, OPTEE os relay on U-boot for initialising UART2.

Thanks,
KG

Hi @Kano1992

Thanks for your Input. We don’t have experience with OPTEE.

You can use the command loadb in U-Boot to test, if the UART2 is working. For all other commands, you either need to build a custom Uboot or use Linux.

Best regards,
Jaski

Hi @jaski.tx,

Thanks for your reply.

I apologise to inform you that problem is solved by adding UART initialization function in serial driver of OPTEE and pinmuxing selection for UART2 done by Uboot, because OPTEE has no support for now.

Now, OPTEE can able to push data on UART2, before loading kernel.

Thanks,

Pratik GAJERA

Perfect that it works. Thanks for the feedback.