if you need test code for uart, you can refer to the link as below:
https://source.codeaurora.org/external/imx/imx-test/tree/test/mxc_uart_test?h=imx_4.14.78_1.0.0_ga
if you need serial driver code, pls find:
https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/tty/serial?h=imx_4.14.98_2.0.0_ga
if you need to change or set the uart for imx8mq, you can refer to the dts file: