Enable UART4 on the verdin

Hi,

My goal is to enable the UART4 interface on the Verdin. Both the online UART article and the manual list that this uart is used a the debug port of the Cortex-M4, unless you properly modify the device tree.
My question is about properly modifying the device tree.

The device tree in the toradex git folder for the verdin has the following UART4 entry:

		serial@30a60000 {
			compatible = "fsl,imx8mm-uart\0fsl,imx6q-uart";
			reg = <0x30a60000 0x10000>;
			interrupts = <0x00 0x1d 0x04>;
			clocks = <0x02 0xbf 0x02 0xbf>;
			clock-names = "ipg\0per";
			dmas = <0x2a 0x1c 0x04 0x00 0x2a 0x1d 0x04 0x00>;
			dma-names = "rx\0tx";
			status = "disabled";
			pinctrl-names = "default";
			pinctrl-0 = <0x3e>;
		};

This is very similar to the other uart entries, besides the status being disabled. Updating the status to “okay” results in kernal panic during the boot sequency. I am wondering where it is specified that this is the debug interface for the Cortex-M4 and what modifications I should make to properly modify the device tree.

Greetings @StevenMedusa.

UART4 is allocated to the M4 core by default. If you try to enable this on the device tree, you’ll get a kernel oops just like you experienced. This is documented on imx8mm-verdin-v1.1.dtsi:

/* Verdin UART_4 */
/*
 * resource allocated to M4 by default, must not be accessed from A-35 or you
 * get an OOPS
 */
&uart4 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart4>;
};

This is the default behavior for the i.MX 8M Mini SoC. To change this, you should edit the resource allocation. For these new SoCs, this is done on the Arm Trusted Firmware. This is probably the corresponding line that is responsible for assigning UART4 for the M4 core: http://git.toradex.com/cgit/imx-atf.git/tree/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c?h=toradex_imx_5.4.24_2.1.0#n61

If you really need to use UART4 for the A53 core, you should recompile ATF and ship that with your image. If you’re building a custom image using Yocto, you can bbappend the imx-atf recipe and patch the file above.

We also have some documentation on building this manually: https://developer.toradex.com/knowledge-base/build-u-boot-and-linux-kernel-from-source-code#Boot_Container_Apalis_iMX8Apalis_iMX8XColibri_iMX8XVerdin_iMX8M_Mini

Some time has passed but at this point I want to confirm this answer because I have verified that it works and it might help somebody else.

As suggested by @gustavo.tx the line:

RDC_PDAPn(RDC_PDAP_UART4, D1R | D1W),

should be replaced by:

RDC_PDAPn(RDC_PDAP_UART4, D0R | D0W),

Just create a boot container as is explained in the documentation mentioned by @gustavo.tx as well. If you use the default device tree provided by Toradex you can just put the status of the newly freed serialport to “okay”. Which then looks something like this:

serial@30a60000 {
				compatible = "fsl,imx8mm-uart\0fsl,imx6q-uart";
				reg = <0x30a60000 0x10000>;
				interrupts = <0x00 0x1d 0x04>;
				clocks = <0x02 0xbf 0x02 0xbf>;
				clock-names = "ipg\0per";
				dmas = <0x2a 0x1c 0x04 0x00 0x2a 0x1d 0x04 0x00>;
				dma-names = "rx\0tx";
				status = "okay";
				pinctrl-names = "default";
				pinctrl-0 = <0x3e>;
			};

Glad your problem solved. Thank you very much for the update!

Hey there,

I have been working on this same issue on an IMX8MM 2GB IT and keep running into a kernel panic after enabling UART4. The Yocto environment I am using is a bit unique due to company firewalls, so I did my best to translate these steps to our situation.

We have an offline version of the imx-atf.git repository as a tar.gz file, and the Yocto system points to this location for all of its build resources. I noticed that two git patches are applied by the imx-atf recipe, so I attempted to generate another and add it to the list.

Should I be able to make this process work? Am I missing any key steps? Thank you.

Hi @sarrasmi!

Could you please create a new question?

Since the original question was solved using those methods, most probably your issue is different.

You can reference this question on your new one.

Best regards,