imx8mm uart4 read control register error

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

imx8mm uart4 read control register error

跳至解决方案
2,655 次查看
jxingyang
Contributor I

my platform base on imx8mm, and found the uar4 controller driver will be crash when read the uar4 register. my uart4 dts setting as follow:

uart4: serial@30a60000 {
       compatible = "fsl,imx8mm-uart", "fsl,imx6q-uart";
       reg = <0x30a60000 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";
};

&uart4 {
       pinctrl-names = "default";
       pinctrl-0 = <&pinctrl_uart4>;
       status = "okay";
};

the uart4 controller driver code file is : linux-imx/drivers/tty/serial/imx.c, the root cause code is :

sport->ucr1 = readl(sport->port.membase + UCR1);
sport->ucr2 = readl(sport->port.membase + UCR2);
sport->ucr3 = readl(sport->port.membase + UCR3);
sport->ucr4 = readl(sport->port.membase + UCR4);
sport->ufcr = readl(sport->port.membase + UFCR);

if I disable the uart4 driver,  and use the devmem cmd to read this register directly(such as "devmem 0x30a60000"), same crash issue will be observed, and the crash log as follow.

[ 57.656313] audit: type=1701 audit(1599913043.500:3): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=1069 comm="devmem" exe="/usr/bin/busybox" sig=7 res=1
Bus error (core dumped)

Tt seems that it was hardware issue, please help to check. the imx.c can be found in attach file. 

0 项奖励
回复
1 解答
2,615 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport
0 项奖励
回复
3 回复数
2,626 次查看
alfredo594
Contributor I

Hello,

Thank you for providing the detailed information.
The crash you're experiencing, indicated by the "Bus error (core dumped)" message, suggests a potential hardware or software issue related to the UART4 controller.
Potential Causes and Troubleshooting Steps:
1. Incorrect Memory Mapping: Verify Register Addresses: Double-check the register addresses used in your driver code (sport->port.membase + UCRx) against the device's datasheet. Consider Overlapping Memory Regions: Ensure there are no overlapping memory regions that might cause conflicts.

2. Clock Configuration: Check Clock Settings: Verify that the UART4 clock settings in the device tree are correct and match the hardware configuration. Test Different Clock Frequencies: Experiment with different clock frequencies to see if it affects the behavior.

3. Interrupt Handling: Interrupt Configuration: Ensure the UART4 interrupt is configured correctly in the device tree and driver code. Interrupt Handler: Check for potential issues in the interrupt handler that might lead to unexpected behavior.

4. Hardware Issues: Test with Different UART: If possible, try using a different UART to isolate the issue. Examine Hardware Documentation: Refer to the IMX8MM datasheet for any specific requirements or limitations related to the UART4 controller.

5. Debugging Techniques: Print Register Values: Add print statements to display the values of UCR registers before the crash to identify any abnormal values. Use a Debugger: Employ a debugger to step through the code and examine the state of variables and registers at the time of the crash. Core Dump Analysis: Analyze the core dump file to identify the root cause of the crash.

Additional Considerations:
DMA Configuration: If you're using DMA for UART transfers, ensure the DMA channels are configured correctly and not interfering with the UART operation.
Power Supply: A stable power supply is crucial for correct operation. Check for any voltage drops or noise issues.


By systematically addressing these potential causes and utilizing debugging techniques, you should be able to identify and resolve the UART4 crash issue.

0 项奖励
回复
2,616 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport
0 项奖励
回复
2,587 次查看
jxingyang
Contributor I

RDC register need set to rw access allowed.

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-1930945%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Eimx8mm%20uart4%E8%AF%BB%E5%8F%96%E6%8E%A7%E5%88%B6%E5%AF%84%E5%AD%98%E5%99%A8%E9%94%99%E8%AF%AF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1930945%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%88%91%E7%9A%84%E5%B9%B3%E5%8F%B0%E5%9F%BA%E4%BA%8Eimx8mm%EF%BC%8C%E5%8F%91%E7%8E%B0uar4%E6%8E%A7%E5%88%B6%E5%99%A8%E9%A9%B1%E5%8A%A8%E7%A8%8B%E5%BA%8F%E5%9C%A8%E8%AF%BB%E5%8F%96uar4%E5%AF%84%E5%AD%98%E5%99%A8%E6%97%B6%E4%BC%9A%E5%B4%A9%E6%BA%83%E3%80%82%E6%88%91%E7%9A%84%20uart4%20dts%20%E8%AE%BE%E7%BD%AE%E5%A6%82%E4%B8%8B%EF%BC%9A%3C%2FP%3E%3CP%3Euart4%3A%20%E4%B8%B2%E8%A1%8C%4030a60000%20%7B%3CBR%20%2F%3E%E5%85%BC%E5%AE%B9%3D%E2%80%9Cfsl%EF%BC%8Cimx8mm-uart%E2%80%9D%EF%BC%8C%E2%80%9Cfsl%EF%BC%8Cimx6q-uart%E2%80%9D%EF%BC%9B%3CBR%20%2F%3E%E6%B3%A8%E5%86%8C%3D%26lt%3B0x30a60000%200x10000%26gt%3B%3B%3CBR%20%2F%3E%E4%B8%AD%E6%96%AD%20%3D%20%3CGIC_SPI%2029%3D%22%22%20irq_type_level_high%3D%22%22%3E%3B%3CBR%20%2F%3E%E6%97%B6%E9%92%9F%3D%26lt%3B%26amp%3Bclk%20IMX8MM_CLK_UART4_ROOT%26gt%3B%EF%BC%8C%3CBR%20%2F%3E%20%26lt%3B%26amp%3Bclk%20IMX8MM_CLK_UART4_ROOT%26gt%3B%EF%BC%9B%3CBR%20%2F%3E%E6%97%B6%E9%92%9F%E5%90%8D%E7%A7%B0%3D%E2%80%9Cipg%E2%80%9D%EF%BC%8C%E2%80%9Cper%E2%80%9D%EF%BC%9B%3CBR%20%2F%3E%20dmas%20%3D%20%26lt%3B%26amp%3Bsdma1%2028%204%200%26gt%3B%2C%20%26lt%3B%26amp%3Bsdma1%2029%204%200%26gt%3B%3B%3CBR%20%2F%3E%20dma%E5%90%8D%E7%A7%B0%3D%E2%80%9Crx%E2%80%9D%EF%BC%8C%E2%80%9Ctx%E2%80%9D%EF%BC%9B%3CBR%20%2F%3E%E7%8A%B6%E6%80%81%3D%E2%80%9C%E5%B7%B2%E7%A6%81%E7%94%A8%E2%80%9D%EF%BC%9B%3CBR%20%2F%3E%20%7D%3B%3C%2FGIC_SPI%3E%3C%2FP%3E%3CP%3E%26amp%3Buart4%20%7B%3CBR%20%2F%3E%20pinctrl%20%E5%90%8D%E7%A7%B0%20%3D%20%E2%80%9C%E9%BB%98%E8%AE%A4%E2%80%9D%EF%BC%9B%3CBR%20%2F%3E%20pinctrl-0%20%3D%20%26lt%3B%26amp%3Bpinctrl_uart4%26gt%3B%3B%3CBR%20%2F%3E%E7%8A%B6%E6%80%81%20%3D%20%E2%80%9C%E5%A5%BD%E7%9A%84%E2%80%9D%3B%3CBR%20%2F%3E%20%7D%3B%3C%2FP%3E%3CP%3Euart4%E6%8E%A7%E5%88%B6%E5%99%A8%E9%A9%B1%E5%8A%A8%E4%BB%A3%E7%A0%81%E6%96%87%E4%BB%B6%E4%B8%BA%EF%BC%9Alinux-imx%2Fdrivers%2Ftty%2Fserial%2Fimx.c%EF%BC%8C%E6%A0%B9%E6%9C%AC%E5%8E%9F%E5%9B%A0%E4%BB%A3%E7%A0%81%E4%B8%BA%EF%BC%9A%3C%2FP%3E%3CP%3E%E8%BF%90%E5%8A%A8-%26gt%3Bucr1%20%3D%20readl(%E8%BF%90%E5%8A%A8-%26gt%3Bport.membase%20%2B%20UCR1)%3B%3CBR%20%2F%3E%E8%BF%90%E5%8A%A8-%26gt%3Bucr2%20%3D%20readl(%E8%BF%90%E5%8A%A8-%26gt%3Bport.membase%20%2B%20UCR2)%3B%3CBR%20%2F%3E%E8%BF%90%E5%8A%A8-%26gt%3Bucr3%20%3D%20readl(%E8%BF%90%E5%8A%A8-%26gt%3Bport.membase%20%2B%20UCR3)%3B%3CBR%20%2F%3E%E8%BF%90%E5%8A%A8-%26gt%3Bucr4%20%3D%20readl(%E8%BF%90%E5%8A%A8-%26gt%3Bport.membase%20%2B%20UCR4)%3B%3CBR%20%2F%3E%E8%BF%90%E5%8A%A8-%26gt%3Bufcr%20%3D%20readl(%E8%BF%90%E5%8A%A8-%26gt%3Bport.membase%20%2B%20UFCR)%3B%3C%2FP%3E%3CP%3E%E5%A6%82%E6%9E%9C%E6%88%91%E7%A6%81%E7%94%A8%20uart4%20%E9%A9%B1%E5%8A%A8%E7%A8%8B%E5%BA%8F%EF%BC%8C%E5%B9%B6%E4%BD%BF%E7%94%A8%20devmem%20cmd%20%E7%9B%B4%E6%8E%A5%E8%AF%BB%E5%8F%96%E8%AF%A5%E5%AF%84%E5%AD%98%E5%99%A8%EF%BC%88%E4%BE%8B%E5%A6%82%E2%80%9Cdevmem%200x30a60000%E2%80%9D%EF%BC%89%EF%BC%8C%E5%B0%86%E4%BC%9A%E5%87%BA%E7%8E%B0%E7%9B%B8%E5%90%8C%E7%9A%84%E5%B4%A9%E6%BA%83%E9%97%AE%E9%A2%98%EF%BC%8C%E5%B4%A9%E6%BA%83%E6%97%A5%E5%BF%97%E5%A6%82%E4%B8%8B%E3%80%82%3C%2FP%3E%3CP%3E%5B57.656313%5D%E5%AE%A1%E8%AE%A1%EF%BC%9A%E7%B1%BB%E5%9E%8B%3D1701%E5%AE%A1%E8%AE%A1%EF%BC%881599913043.500%3A3%EF%BC%89%EF%BC%9Aauid%3D4294967295%20uid%3D0%20gid%3D0%20ses%3D4294967295%20pid%3D1069%20comm%3D%22devmem%22%20exe%3D%22%2Fusr%2Fbin%2Fbusybox%22%20sig%3D7%20res%3D1%3CBR%20%2F%3E%E6%80%BB%E7%BA%BF%E9%94%99%E8%AF%AF%EF%BC%88%E6%A0%B8%E5%BF%83%E8%BD%AC%E5%82%A8%EF%BC%89%3C%2FP%3E%3CP%3E%E7%9C%8B%E8%B5%B7%E6%9D%A5%E6%98%AF%E7%A1%AC%E4%BB%B6%E9%97%AE%E9%A2%98%EF%BC%8C%E8%AF%B7%E5%B8%AE%E5%BF%99%E6%A3%80%E6%9F%A5%E3%80%82imx.c%20%E5%8F%AF%E4%BB%A5%E5%9C%A8%E9%99%84%E4%BB%B6%E4%B8%AD%E6%89%BE%E5%88%B0%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1930945%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3Ei.MX%208%20%E7%B3%BB%E5%88%97%20%7C%20i.MX%208QuadMax%20(8QM)%20%7C%208QuadPlus%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1931667%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9Aimx8mm%20uart4%E8%AF%BB%E5%8F%96%E6%8E%A7%E5%88%B6%E5%AF%84%E5%AD%98%E5%99%A8%E9%94%99%E8%AF%AF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1931667%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ERDC%20%E5%AF%84%E5%AD%98%E5%99%A8%E9%9C%80%E8%A6%81%E8%AE%BE%E7%BD%AE%E4%B8%BA%E5%85%81%E8%AE%B8%20rw%20%E8%AE%BF%E9%97%AE%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E