Question about UART implementation

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Question about UART implementation

2,269件の閲覧回数
ysato_ad
Contributor II

Hi

I plan to develop an target board based on the i.MX 8m Mini EVK.
I want to set the UART on the target board as follows:
 UART1 (UART1_RX / UART1_TX / UART1_CTS_B / UART1_RTS_B)
 UART2 (UART2_RX / UART2_TX)
 UART3 (ECSPI1_MISO / ECSPI1_SSO / ECSPI1_SCLK / ECSPI1_MOSI)
 UART4 (UART4_RX / UART4_TX)
I'm not sure how to modify the Linux files.
Do I need to change drivers or DTS files?
Can you please tell me the location of driver and DTS file if you need to change?
Also, I would like to confirm whether each device has the following allocation.
Where should I confirm?
 UART1=/dev/ttyS0
 UART2=/dev/ttyS1
 UART3=/dev/ttyS2
 UART4=/dev/ttyS3

Thanks.

0 件の賞賛
返信
4 返答(返信)

1,953件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi yuichi

for uart1 example one can look at fsl-imx8mm-evk.dts

fsl-imx8mm-evk.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

DTS customization tutorial

https://boundarydevices.com/mx6-device-tree-customization/ 

for customization may be useful Porting Guide included in

Linux 5.4.3_1.0.0 Documentation

Best regards
igor

1,953件の閲覧回数
kunalkotecha1
Senior Contributor II

Hi ysato.ad@minebeamitsumi.com,

Please find my below in-line response.

Do I need to change drivers or DTS files?

Every pad can be multiplexed in various modes. For configuring any pad or any pinmux, you need to change the pinmux in device tree. To see the supported muxing modes please refer to "Table 8-1 Muxing Options" from the attached Reference Manual of i.MX8M Mini.

Can you please tell me the location of the driver and DTS file if you need to change?

You need to change the pinmux in the device tree.

Location of Device tree files: "build_imx8mmevk/tmp/work-shared/imx8mmevk/kernel-source/arch/arm64/boot/dts/freescale/" (for evk Rev B, this file "fsl-imx8mm-evk.dts" will be used.)

Location of Driver file of UART: "build_imx8mmevk/tmp/work-shared/imx8mmevk/kernel-source/drivers/tty/serial/imx.c" (you can verify using the "compatible" property in device tree node of UART, the same would be in the driver and that is driver files are matched).

Also, I would like to confirm whether each device has the following allocation.
Where should I confirm?
 UART1=/dev/ttyS0
 UART2=/dev/ttyS1
 UART3=/dev/ttyS2
 UART4=/dev/ttyS3

If you look at the driver it would have Device Name as ttymxc defined at the top. You will get the device name by ttmxc0, ttymxc1, etc.

Feel free to ask in case of any queries.

Regards,

Kunal

1,953件の閲覧回数
ysato_ad
Contributor II
Hi  Kunal Kotecha,
Thank you for your reply.
We apologize for the late reply.
■ Additional question (1)
The evaluation board I purchased has the description "8MMINILPD4-CPU".
I think "i.MX 8M Mini Evaluation Kit LPDDR4" = RevC.
==> RevB https://www.nxp.com/downloads/en/printed-circuit-boards/8MMINID4-EVK-DESIGNFILES.zip
==> RevC https://www.nxp.com/webapp/Download?colCode=8MMINILPD4-EVK-DESIGNFILES
In the build environment, "MACHINE = imx8mmevk" is set,
but is this MACHINE setting good for "RevC" and "RevB"?
In RevC, QSPI is connected and the board is obviously different,
but I don't know the DTS switching between RevB and RevC boards.

■ Additional question (2)
The Makefile has the following description.
Does the meaning below mean that you are using all of the following dtb (= dts)?
build/tmp/work-shared/imx8mmevk/kernel-source/arch/arm64/boot/dts/freescale/Makefile:
---SNIP---
dtb-$(CONFIG_ARCH_FSL_IMX8MM) += fsl-imx8mm-evk.dtb \
     fsl-imx8mm-evk-drm.dtb \
     fsl-imx8mm-evk-ak4497.dtb \
     fsl-imx8mm-evk-m4.dtb \
     fsl-imx8mm-evk-ak5558.dtb \
     fsl-imx8mm-evk-audio-tdm.dtb \
     fsl-imx8mm-ddr3l-val.dtb \
     fsl-imx8mm-ddr4-evk.dtb \
     fsl-imx8mm-ddr4-val.dtb \
     fsl-imx8mm-evk-rm67191.dtb \
     fsl-imx8mm-evk-root.dtb \
     fsl-imx8mm-evk-inmate.dtb \
     fsl-imx8mm-evk-revb.dtb \
     fsl-imx8mm-evk-revb-rm67191.dtb \
     fsl-imx8mm-ddr4-evk-rm67191.dtb \
     fsl-imx8mm-ddr4-qca9377-evk.dtb
---SNIP---

■ Additional question (3)
If you search for uart4, it is defined in the following three files.
It is not defined in fsl-imx8mm-evk.dts. Is uart4 undefined?
Or is it defined in the following 3 files?
I'm confused that status is "okay" or "disabled".
====== fsl-imx8mm.dtsi:
uart4: serial@30a60000 {
 compatible = "fsl,imx8mq-uart",
       "fsl,imx6q-uart", "fsl,imx21-uart";
 reg = <0x0 0x30a60000 0x0 0x10000>;
 interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
 clocks = <&clk IMX8MM_CLK_UART4_ROOT>,
  <&clk IMX8MM_CLK_UART4_ROOT>;
 clock-names = "ipg", "per";
 dmas = <&sdma1 28 4 0>, <&sdma1 29 4 0>;
 dma-names = "rx", "tx";
 status = "disabled";
};
====== fsl-imx8mm-evk-inmate.dts:
&uart4 {
 clocks = <&osc_24m>,
  <&osc_24m>;
 clock-names = "ipg", "per";
 /delete-property/ dmas;
 /delete-property/ dmas-names;
 status = "okay";
};
====== fsl-imx8mm-evk-m4.dts
&uart4 {
 status = "disabled";
};

■ Additional question (4)
There were the following notes in fsl-imx8mm-evk-m4.dts.
===============================
 * ATTENTION: M4 may use IPs like below
 * ECSPI0/ECSPI2, GPIO1/GPIO5, GPT1, I2C3, I2S3, WDOG1, UART4, PWM3, SDMA1
===============================
Where can I find the Cortex M4 program for the i.MX8M Mini EVK?
To disable the M4 program and use UART4, ECSPI2, I2C3 from Linux,
Should I just add the tag to fsl-imx8mm-evk.dts?
0 件の賞賛
返信

1,953件の閲覧回数
kunalkotecha1
Senior Contributor II

Hi ysato.ad@minebeamitsumi.com,

Please find below the in-line response:

In the build environment, "MACHINE = imx8mmevk" is set,
but is this MACHINE setting good for "RevC" and "RevB"?

In RevC, QSPI is connected and the board is obviously different,
but I don't know the DTS switching between RevB and RevC boards.

Yes, the machine setting is the same. You can see the "sources/meta-fsl-bsp-release/imx/meta-bsp/conf/machine/imx8mmevk.conf" file for DTS files for LPDDR4 and DDR4 EVK.

The Makefile has the following description.
Does the meaning below mean that you are using all of the following dtb (= dts)?

Please refer to the "Table-10 Kernel and Device Tree Configurations" from Release Note of the BSP you are using.(I have Attached Release note of BSP L4.14.98-2.0.0 for your reference).

If you search for uart4, it is defined in the following three files.
It is not defined in fsl-imx8mm-evk.dts. Is uart4 undefined?
Or is it defined in the following 3 files?
I'm confused that status is "okay" or "disabled".

Please refer to https://elinux.org/images/f/f9/Petazzoni-device-tree-dummies_0.pdf  for the understanding of the device tree.In general, dtsi is include file where soc specific peripherals are written, and which we want to use are enabled and written in dts files.

To disable the M4 program and use UART4, ECSPI2, I2C3 from Linux,
Should I just add the tag to fsl-imx8mm-evk.dts?

Yes. If you are not using M4 than fsl-imx8mm-evk.dts can be used. 

Hope this would help.

Regards,

Kunal

0 件の賞賛
返信