i.MX8QM change debug console to lpuart3 or lpuart4

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

i.MX8QM change debug console to lpuart3 or lpuart4

Jump to solution
1,267 Views
eric_lee1
Contributor II

I am working on i.MX8QM BSP 5.4.70.

The default BSP uses lpuart0 as u-boot and kernel debug port. In our custom board, we would like to change it to lpuart3 or lpuart4 as the u-boot and kernel debug port. We can't make it work. It outputs nothing. The ways we did are as follows.

At u-boot dts file,

-----

chosen {
bootargs = "console=ttyLP4,115200 earlycon";
stdout-path = &lpuart4;
};

 pinctrl_lpuart4: lpuart4grp {
fsl,pins = <
SC_P_M40_GPIO0_00_DMA_UART4_RX 0x06000020
SC_P_M40_GPIO0_01_DMA_UART4_TX 0x06000020
>;
}; 

&lpuart4 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpuart4>;
status = "okay";
};

----

At u-boot board file,

----

static iomux_cfg_t uart4_pads[] = {
SC_P_M40_GPIO0_00 | MUX_MODE_ALT(2) | MUX_PAD_CTRL(UART_PAD_CTRL), /* M40.GPIO0.IO00, M40.TPM0.CH0, DMA.UART4.RX, LSIO.GPIO0.IO08 */
SC_P_M40_GPIO0_01 | MUX_MODE_ALT(2) | MUX_PAD_CTRL(UART_PAD_CTRL), /* M40.GPIO0.IO01, M40.TPM0.CH1, DMA.UART4.TX, LSIO.GPIO0.IO09 */
};

static void setup_iomux_uart4(void)
{
imx8_iomux_setup_multiple_pads(uart4_pads, ARRAY_SIZE(uart4_pads));
}

/* Set UART4 clock root to 80 MHz */
ret = sc_pm_setup_uart(SC_R_UART_4, rate);
if (ret)
return ret;

setup_iomux_uart4();

----

If I switch back to lpuart0, it can boot into Yocto OS and the lpuart4 works well. The hardware is fine.

Is there anything that I should do in scfw? How?

-Eric

0 Kudos
1 Solution
1,227 Views
igorpadykov
NXP Employee
NXP Employee

serial clock is obtained using get_lpuart_clk function which is defined for
i.MX8 platforms in uboot../imx8/clock.c and it seems that returns the clock for UART0:

err = sc_pm_get_clock_rate((..,SC_R_UART_0, 2, &clkrate);

So, one can try to change clock to SC_R_UART_N

https://source.codeaurora.org/external/imx/uboot-imx/tree/arch/arm/mach-imx/imx8/clock.c?h=imx_v2020...

 

Best regards
igor

View solution in original post

0 Kudos
4 Replies
1,260 Views
igorpadykov
NXP Employee
NXP Employee

Hi Eric

 

one can change lpuart0 to lpuart4 in board_quiesce_devices()

https://source.codeaurora.org/external/imx/uboot-imx/tree/board/freescale/imx8qm_mek/imx8qm_mek.c?h=...

remove  lpuart4 "dma" in dtsi file

https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8qm-ss-dm...

also some patches were sent via mail

 

Best regards
igor

0 Kudos
1,246 Views
eric_lee1
Contributor II

Igor,

Your suggestion does not work at all. I still got nothing outputs from lpuart3 or lpuart4. 

These two ports are pinmuxed from M40 and M41. 

static iomux_cfg_t uart3_pads[] = {
SC_P_M41_GPIO0_00 | MUX_MODE_ALT(2) | MUX_PAD_CTRL(UART_PAD_CTRL), /* M41.GPIO0.IO00, M41.TPM0.CH0, DMA.UART3.RX, LSIO.GPIO0.IO12 */
SC_P_M41_GPIO0_01 | MUX_MODE_ALT(2) | MUX_PAD_CTRL(UART_PAD_CTRL), /* M41.GPIO0.IO01, M41.TPM0.CH1, DMA.UART3.TX, LSIO.GPIO0.IO13 */
};

and

static iomux_cfg_t uart4_pads[] = {
SC_P_M40_GPIO0_00 | MUX_MODE_ALT(2) | MUX_PAD_CTRL(UART_PAD_CTRL), /* M40.GPIO0.IO00, M40.TPM0.CH0, DMA.UART4.RX, LSIO.GPIO0.IO08 */
SC_P_M40_GPIO0_01 | MUX_MODE_ALT(2) | MUX_PAD_CTRL(UART_PAD_CTRL), /* M40.GPIO0.IO01, M40.TPM0.CH1, DMA.UART4.TX, LSIO.GPIO0.IO09 */
};

Should I do anything in scfw?

-Eric

0 Kudos
1,228 Views
igorpadykov
NXP Employee
NXP Employee

serial clock is obtained using get_lpuart_clk function which is defined for
i.MX8 platforms in uboot../imx8/clock.c and it seems that returns the clock for UART0:

err = sc_pm_get_clock_rate((..,SC_R_UART_0, 2, &clkrate);

So, one can try to change clock to SC_R_UART_N

https://source.codeaurora.org/external/imx/uboot-imx/tree/arch/arm/mach-imx/imx8/clock.c?h=imx_v2020...

 

Best regards
igor

0 Kudos
1,219 Views
eric_lee1
Contributor II

igor,

This did the trick. However, you still need to add UART4 definition under drivers/clk/imx/clk-imx8qm.c.

Thanks. 

0 Kudos