Change UART for imx93 in uboot and kernel

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change UART for imx93 in uboot and kernel

902 Views
ajhoneybell
Contributor II

I need to change the we use for stdout from UART1 to UART5, for both bootloader/spl/uboot and kernel. I've modified my .dts file so that the node for lpuart5 is "okay" and lpuart1 is "disabled". However, when I probe UART5 tx, I get a periodic signal around 11kHz. Checking the dts I can see that an LCD device is configured to it, but i have disabled it. From what I've read that should mean the pingroups aren't enabled, although deleting that group would seem ideal.

I've found several similar posts on here:

https://community.nxp.com/t5/Layerscape/How-to-I-change-the-u-boot-serial-port-on-the-LS1028ARDB-dem...

https://community.nxp.com/t5/i-MX-Processors/Building-u-boot-for-a-custom-imx93-based-board/m-p/1865...

https://community.nxp.com/t5/i-MX-Processors/iMX8ULP-change-u-boot-serial-console-from-UART5-to-UART...

 

But these all seem to do it in subtly different ways. So what exactly needs to be done? Are there any example layers that do this, as changing the UART would seem a reasonable thing to do, but the number of hoops you have to jump through in yocto seems ridiculous.

0 Kudos
Reply
6 Replies

870 Views
JosephAtNXP
NXP TechSupport
NXP TechSupport

Hi,

Thank you for your interest in NXP Semiconductor products,

You came across multiple boot modes, i.MX93 boot is like 8M family boot, UART assignment is at ATF please change the UART base for 0x42590000.

You must update the PADS if it's not done yet.

Regards

0 Kudos
Reply

832 Views
ajhoneybell
Contributor II

Thanks for the response. I can make the change to imx93_evk.c, but the platform_def.h does not exist in my Yocto tree. I did download IMX_boot to another directory outside of Yocto. But how will Yocto be able to build all the necessary files without it?

 

I have attempted to use Buildroot and the ATF code is in there too, and in fact I can build some images (rootfs and flash.bin), but I'm having a hard time programming them with uuu.

0 Kudos
Reply

812 Views
JosephAtNXP
NXP TechSupport
NXP TechSupport

Hi,

imx93_evk.c is a U-boot file, ATF is loaded before and handles resources with more privileges. If ATF is not found, you can clone the repository then build the binary with:

export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
make PLAT=imx93 all

Clone imx-mkimage and copy the necessary files from your yocto build plus the bl31.bin from your custom build, that would create the imx-boot to use a different UART.

Regards

0 Kudos
Reply

751 Views
ajhoneybell
Contributor II
These are the steps I'm following:
[Yocto]
For recipes-kernel/linux
1. Created custom dts file with:
    chosen {
    bootargs = "console=ttyLP7,115200 earlycon";
    stdout-path = &lpuart8;
    };
...
&lpuart8 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart8>;
status = "okay";
};
...
&iomuxc {
pinctrl_uart8: uart8grp {
fsl,pins = <
MX93_PAD_GPIO_IO13__LPUART8_RX 0x31e
MX93_PAD_GPIO_IO12__LPUART8_TX 0x31e
>;
};
};
2. Patched arch/arm64/boot/dts/freescale/Makefile
+dtb-$(CONFIG_ARCH_MXC) += imx93-11x11-evk-custom.dtb
3. Inserted CONFIG_CONS_INDEX=8 into defconfig
4. Create linux-imx_%.bbappend and added:
do_patch:append(), do_configure:prepend(), do_install:append(), do_deploy:append() to make sure patches are applied and copied to deployment folder (works)
KERNEL_DEVICETREE:append = " \
    freescale/imx93-11x11-evk-custom.dtb \
"

IMAGE_BOOT_FILES:append = " \
    freescale/imx93-11x11-evk-custom.dtb \
"
 
For recipes-bsp/u-boot
5. Patched /arch/arm/dts/Makefile
+       imx93-11x11-evk-custom.dtb
6. Patched board/freescale/imx93_evk/imx93_evk.c
 static iomux_v3_cfg_t const uart_pads[] = {
- MX93_PAD_UART1_RXD__LPUART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
- MX93_PAD_UART1_TXD__LPUART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
+ MX93_PAD_GPIO_IO13__LPUART8_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
+ MX93_PAD_GPIO_IO12__LPUART8_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
 };
7. Patched include/configs/imx93_evk.h
- "console=ttyLP0,115200 earlycon\0" \
+ "console=ttyLP7,115200 earlycon\0" \
8. Patched /board/freescale/imx93_evk/spl.c
void board_init_f(ulong dummy)
  memset(__bss_start, 0, __bss_end - __bss_start);

+    // Clock Root Control Register (CLOCK_ROOT32_CONTROL_SET - 0x1000)
+    // Clock Root Control Register (CLOCK_ROOT32_AUTHEN_SET - 0x1030)
+    __raw_writel(0xFFFF0300, 0x44451030);   // Enable access to UART8
+    __raw_writel(0x01000000, 0x44451000);   // Turn on clock for UART8
 
9. Then, built yocto:
 
[IMX-ATF]
I made modifications out of yocto for imx-atf
10. In /IMX_ATF/imx-atf/plat/imx/imx93/include/platform_def.h I changed 
- #define IMX_LPUART_BASE U(0x44380000) 
+ #define IMX_LPUART_BASE U(0x426a0000) // For UART8​

 

11. Built IMX-ATF
export CROSS_COMPILE=aarch64-linux-gnu-
make PLAT=imx93 clean
make PLAT=imx93 all
 
12. Copied IMX_ATF/imx-atf/build/imx93/release/bl31.bin to /imx-mkimage/iMX93
13. Copied u-boot.bin and u-boot-spl.bin to /imx-mkimage/iMX93
14. Copied $DEPLOY_DIR/imx-boot-tools/mx93a1-ahab-container.img to /imx-mkimage/iMX93
15. Copied lpddr4_dmem*.bin and lpddr4_imem*.bin /imx-mkimage/iMX93
16. Copied imx93-11x11-evk-custom.dtb to /imx-mkimage/iMX93
17. Made imx-mkimage
make KERNEL_DTB=imx93-11x11-evk-custom.dtb SOC=iMX93 flash_singleboot
Note: I see "header tag missmatched 0" in the output below:
include autobuild.mak
34451+1 records in
34452+0 records out
137808 bytes (138 kB, 135 KiB) copied, 0.092699 s, 1.5 MB/s
./../mkimage_imx8 -commit > head.hash
if [ -f tee.bin ]; then \
        if [  ]; then \
                ./../mkimage_imx8 -soc IMX9 -sw_version  -c \
                           -ap bl31.bin a55 0x204E0000 \
                           -ap u-boot-hash.bin a55 0x80200000 \
                           -ap tee.bin a55 0x96000000 \
                           -out u-boot-atf-container.img; \
        else \
                ./../mkimage_imx8 -soc IMX9 -c \
                           -ap bl31.bin a55 0x204E0000 \
                           -ap u-boot-hash.bin a55 0x80200000 \
                           -ap tee.bin a55 0x96000000 -out u-boot-atf-container.img; \
        fi; \
else \
        ./../mkimage_imx8 -soc IMX9 -c \
                   -ap bl31.bin a55 0x204E0000 \
                   -ap u-boot-hash.bin a55 0x80200000 \
                   -out u-boot-atf-container.img; \
fi
SOC: IMX9 
New Container:  0
AP:     bl31.bin        core: a55 addr: 0x204e0000
AP:     u-boot-hash.bin core: a55 addr: 0x80200000
Output: u-boot-atf-container.img
CONTAINER FUSE VERSION: 0x00
CONTAINER SW VERSION:   0x0000
Platform:       i.MX9
ivt_offset:     1024
container image offset (aligned):2000
csf_off         0x2400
flags: 0x10
Hash of the images = 
1+0 records in
1+0 records out
49152 bytes (49 kB, 48 KiB) copied, 0.000234421 s, 210 MB/s
94+1 records in
94+1 records out
48257 bytes (48 kB, 47 KiB) copied, 0.000655148 s, 73.7 MB/s
AP file_offset = 0x2000 size = 0xc000
Hash of the images = 
1+0 records in
1+0 records out
1152000 bytes (1.2 MB, 1.1 MiB) copied, 0.00112789 s, 1.0 GB/s
2249+1 records in
2249+1 records out
1151705 bytes (1.2 MB, 1.1 MiB) copied, 0.00545241 s, 211 MB/s
AP file_offset = 0xe000 size = 0x119400
CST: CONTAINER 0 offset: 0x0
CST: CONTAINER 0: Signature Block: offset is at 0x110
        Offsets =       0x0     0x110
DONE.
Note: Please copy image to offset: IVT_OFFSET + IMAGE_OFFSET
./../mkimage_imx8 -soc IMX9 -append mx93a1-ahab-container.img -c -ap u-boot-spl-ddr.bin a55 0x2049A000 -out flash.bin
SOC: IMX9 
New Container:  0
AP:     u-boot-spl-ddr.bin      core: a55 addr: 0x2049a000
Output: flash.bin
CONTAINER FUSE VERSION: 0x00
CONTAINER SW VERSION:   0x0000
Platform:       i.MX9
ivt_offset:     1024
header tag missmatched 0
container image offset (aligned):1a000
csf_off         0x1a400
flags: 0x10
Hash of the images = 
1+0 records in
1+0 records out
221184 bytes (221 kB, 216 KiB) copied, 0.000262497 s, 843 MB/s
431+1 records in
431+1 records out
221136 bytes (221 kB, 216 KiB) copied, 0.00115518 s, 191 MB/s
AP file_offset = 0x1a000 size = 0x36000
CST: CONTAINER 0 offset: 0x400
CST: CONTAINER 0: Signature Block: offset is at 0x490
        Offsets =       0x400   0x490
DONE.
Note: Please copy image to offset: IVT_OFFSET + IMAGE_OFFSET
append u-boot-atf-container.img at 320 KB, psize=1024
1181+0 records in
1181+0 records out
1209344 bytes (1.2 MB, 1.2 MiB) copied, 0.0042381 s, 285 MB/s
 
 
18. When I then attempt to apply to my board with UUU (uuu -v -b emmc flash.bin) it doesn't seem to complete. 
However, I added a custom print in the SPL.C file and it DOES print out, so I guess that part is working.
 
However...the debug output STILL comes from UART1, and when it goes to load the kernel, no more print messages are seen. So either it hasn't worked at all, going to the wrong UART or something else is wrong.
 
0 Kudos
Reply

671 Views
JosephAtNXP
NXP TechSupport
NXP TechSupport

Hi @ajhoneybell,

I could replicate on i.MX93EVK, please see the following patches, I did the following steps:

1. Clone U-boot, checkout to lf2024, then apply the patch attached,

$ source /opt/fsl-imx-xwayland/6.12-styhead/environment-setup-armv8a-poky-linux
$ make distclean
$ make imx93_11x11_evk_defconfig
$ make

2. Clone ATF, checkout to lf_v2.10, then apply the patch attached,

$ source /opt/fsl-imx-xwayland/6.12-styhead/environment-setup-armv8a-poky-linux
$ unset LDFLAGS
$ make distclean
$ make plat=imx93

3. Clone mkimage, copy the u-boot.bin and spl/u-boot-spl.bin to imx-mkimage/iMX93, also copy build/fvp/release/bl31.bin from ATF, finally lpddr4* and mx93a1-ahab-container.img from a yocto build,

$ make clean
$ make SOC=iMX93 flash_singleboot

You can flash this with

$ sudo uuu -b emmc flash.bin
JosephAtNXP_0-1744150130596.png

Regards

0 Kudos
Reply

619 Views
ajhoneybell
Contributor II

Your patches have mistakes, 

- MX93_PAD_UART1_RXD__LPUART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
- MX93_PAD_UART1_TXD__LPUART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
+ MX93_PAD_GPIO_IO13__LPUART8_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
+ MX93_PAD_GPIO_IO13__LPUART8_RX | MUX_PAD_CTRL(UART_PAD_CTRL),

should be

- MX93_PAD_UART1_RXD__LPUART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
- MX93_PAD_UART1_TXD__LPUART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
+ MX93_PAD_GPIO_IO13__LPUART8_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
+ MX93_PAD_GPIO_IO12__LPUART8_TX | MUX_PAD_CTRL(UART_PAD_CTRL),

 

Also, because the &lpuart1 is renamed &lpuart8 in the dtsi, it causes the compile to fail...