The purpose of this document is to provide a guide on how to enable UART 4 on i.MX8M Mini on Cortex A53. By default on i.MX-ATF is set on Cortex M4 Domain, i.MX-ATF helps ensure that i.MX processors boot securely. Reference: imx-atf.
Arm Toolchain: sudo apt-get install gcc-aarch64-linux-gnu
$ cd ~
$ git clone https://github.com/nxp-imx/uboot-imx -b lf_v2023.04
$ cd uboot-imx/
$ git checkout lf-6.6.23-2.0.0
$ make -j $(nproc --all) ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- imx8mm_evk_defconfig
$ export ARCH=arm64
$ cd ~
$ git clone https://github.com/nxp-imx/imx-mkimage.git
$ cd imx-mkimage/
$ git checkout lf-6.6.23-2.0.0
$ cd ~
$ git clone https://github.com/nxp-imx/imx-atf.git
$ cd imx-atf/
$ git checkout lf-6.6.23-2.0.0
The master domain for the UART4 is assigned to the Cortex M4, so, make the following changes to assign it to the A53 processor instead:
diff --git a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
index 179b6226f..b0427afff 100644
--- a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
+++ b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
@@ -114,10 +114,11 @@ static const struct imx_csu_cfg csu_cfg[] = {
#else
static const struct imx_rdc_cfg rdc[] = {
/* Master domain assignment */
- RDC_MDAn(RDC_MDA_M4, DID1),
+ RDC_MDAn(RDC_MDA_A53, DID0),
/* peripherals domain permission */
- RDC_PDAPn(RDC_PDAP_UART4, D1R | D1W),
+ RDC_PDAPn(RDC_PDAP_UART4, D0R | D0W),
RDC_PDAPn(RDC_PDAP_UART2, D0R | D0W),
RDC_PDAPn(RDC_PDAP_UART1, D0R | D0W),
After applying the changes, set your toolchain and then, compile with the following command:
$ make PLAT=imx8mm bl31
In case you have the following error:
Use this command to unset the flags and compile again:
$ unset LDFLAGS
Then, copy the corresponding files to imx-mkimage/iMX8M. For more information, please check section 4.5.13 on i.MX Linux User's Guide.
*NOTE: Some of this files are located on a link which you can access with the following command, for more information check the Release Notes, in this case for version 6.6.23-2.0.0 on Embedded Linux for i.MX Applications Processors.
$ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.24-fbe0a4c.bin
$ chmod +x firmware-imx-8.24-fbe0a4c.bin
$ ./firmware-imx-8.24-fbe0a4c.bin
Finally, copy flash.bin located on: imx-mkimage/iMX8M to a folder to flash your board as follows:
You can download the uuu.exe from mfgtools and the .wic file from the prebuild images from: Embeded Linux for i.MX Applications Processors
uuu.exe -b emmc_all flash.bin imx-image-full-imx8mmevk.wic
First, copy and rename the imx8mm-evk.dts to identify there is a change for enabling UART4:
$ cd linux-imx
$ cp arch/arm64/boot/dts/freescale/imx8mm-evk.dts arch/arm64/boot/dts/freescale/imx8mm-evk-uart4.dts
$ vi arch/arm64/boot/dts/freescale/imx8mm-evk-uart4.dts
And make the following changes:
&ecspi2 {
status = "disabled";
};
&uart4 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart4>;
assigned-clocks = <&clk IMX8MM_CLK_UART4>;
assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_80M>;
fsl,uart-has-rtscts;
status = "okay";
};
&iomuxc {
pinctrl_uart4: uart4grp {
fsl,pins = <
MX8MM_IOMUXC_ECSPI2_SCLK_UART4_DCE_RX 0x140
MX8MM_IOMUXC_ECSPI2_MOSI_UART4_DCE_TX 0x140
MX8MM_IOMUXC_ECSPI2_SS0_UART4_DCE_RTS_B 0x140
MX8MM_IOMUXC_ECSPI2_MISO_UART4_DCE_CTS_B 0x140
>;
};
}
After applying the changes, set your toolchain and then, compile with the following commands:
$ make imx_v8_defconfig
$ make freescale/imx8mm-evk-uart4.dtb
Finally, copy the DTB to your board, reboot it and change the DTB in the u-boot environment, boot your board and take a look to see if the UART4 is correctly enabled.