imx8mm uart4 read control register error

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

imx8mm uart4 read control register error

Jump to solution
2,658 Views
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 Kudos
Reply
1 Solution
2,618 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport
0 Kudos
Reply
3 Replies
2,629 Views
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 Kudos
Reply
2,619 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport
0 Kudos
Reply
2,590 Views
jxingyang
Contributor I

RDC register need set to rw access allowed.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1930945%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Eimx8mm%20uart4%20read%20control%20register%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1930945%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Emy%20platform%20base%20on%20imx8mm%2C%20and%20found%20the%20uar4%20controller%20driver%20will%20be%20crash%20when%20read%20the%20uar4%20register.%20my%20uart4%20dts%20setting%20as%20follow%3A%3C%2FP%3E%3CP%3Euart4%3A%20serial%4030a60000%20%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bcompatible%20%3D%20%22fsl%2Cimx8mm-uart%22%2C%20%22fsl%2Cimx6q-uart%22%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Breg%20%3D%20%26lt%3B0x30a60000%200x10000%26gt%3B%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Binterrupts%20%3D%20%3CGIC_SPI%2029%3D%22%22%20irq_type_level_high%3D%22%22%3E%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bclocks%20%3D%20%26lt%3B%26amp%3Bclk%20IMX8MM_CLK_UART4_ROOT%26gt%3B%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26lt%3B%26amp%3Bclk%20IMX8MM_CLK_UART4_ROOT%26gt%3B%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bclock-names%20%3D%20%22ipg%22%2C%20%22per%22%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bdmas%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%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bdma-names%20%3D%20%22rx%22%2C%20%22tx%22%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bstatus%20%3D%20%22disabled%22%3B%3CBR%20%2F%3E%7D%3B%3C%2FGIC_SPI%3E%3C%2FP%3E%3CP%3E%26amp%3Buart4%20%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bpinctrl-names%20%3D%20%22default%22%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bpinctrl-0%20%3D%20%26lt%3B%26amp%3Bpinctrl_uart4%26gt%3B%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bstatus%20%3D%20%22okay%22%3B%3CBR%20%2F%3E%7D%3B%3C%2FP%3E%3CP%3Ethe%20uart4%20controller%20driver%20code%20file%20is%20%3A%20linux-imx%2Fdrivers%2Ftty%2Fserial%2Fimx.c%2C%20the%20root%20cause%20code%20is%20%3A%3C%2FP%3E%3CP%3Esport-%26gt%3Bucr1%20%3D%20readl(sport-%26gt%3Bport.membase%20%2B%20UCR1)%3B%3CBR%20%2F%3Esport-%26gt%3Bucr2%20%3D%20readl(sport-%26gt%3Bport.membase%20%2B%20UCR2)%3B%3CBR%20%2F%3Esport-%26gt%3Bucr3%20%3D%20readl(sport-%26gt%3Bport.membase%20%2B%20UCR3)%3B%3CBR%20%2F%3Esport-%26gt%3Bucr4%20%3D%20readl(sport-%26gt%3Bport.membase%20%2B%20UCR4)%3B%3CBR%20%2F%3Esport-%26gt%3Bufcr%20%3D%20readl(sport-%26gt%3Bport.membase%20%2B%20UFCR)%3B%3C%2FP%3E%3CP%3Eif%20I%20disable%20the%20uart4%20driver%2C%26nbsp%3B%20and%20use%20the%20devmem%20cmd%20to%20read%20this%20register%20directly(such%20as%20%22devmem%200x30a60000%22)%2C%20same%20crash%20issue%20will%20be%20observed%2C%20and%20the%20crash%20log%20as%20follow.%3C%2FP%3E%3CP%3E%5B%2057.656313%5D%20audit%3A%20type%3D1701%20audit(1599913043.500%3A3)%3A%20auid%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%3EBus%20error%20(core%20dumped)%3C%2FP%3E%3CP%3ETt%20seems%20that%20it%20was%20hardware%20issue%2C%20please%20help%20to%20check.%20the%20imx.c%20can%20be%20found%20in%20attach%20file.%26nbsp%3B%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%20Family%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%3ERe%3A%20imx8mm%20uart4%20read%20control%20register%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1931667%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ERDC%20register%20need%20set%20to%20rw%20access%20allowed.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1931176%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20imx8mm%20uart4%20read%20control%20register%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1931176%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%0A%3CP%3EThis%20can%20help%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fi-MX-Processors%2FIMX8-mini-UART4%2Ftd-p%2F935322%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fi-MX-Processors%2FIMX8-mini-UART4%2Ftd-p%2F935322%3C%2FA%3E%3C%2FP%3E%0A%3CP%3ERegards%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1931114%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20imx8mm%20uart4%20read%20control%20register%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1931114%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EThank%20you%20for%20providing%20the%20detailed%20information.%3CBR%20%2F%3EThe%20crash%20you're%20experiencing%2C%20indicated%20by%20the%20%22Bus%20error%20(core%20dumped)%22%20message%2C%20suggests%20a%20potential%20hardware%20or%20software%20issue%20related%20to%20the%20UART4%20controller.%3CBR%20%2F%3EPotential%20Causes%20and%20Troubleshooting%20Steps%3A%3CBR%20%2F%3E1.%26nbsp%3BIncorrect%20Memory%20Mapping%3A%26nbsp%3BVerify%20Register%20Addresses%3A%20Double-check%20the%20register%20addresses%20used%20in%20your%20driver%20code%20(sport-%26gt%3Bport.membase%20%2B%20UCRx)%20against%20the%20device's%20datasheet.%20Consider%20Overlapping%20Memory%20Regions%3A%20Ensure%20there%20are%20no%20overlapping%20memory%20regions%20that%20might%20cause%20conflicts.%3CBR%20%2F%3E%3CBR%20%2F%3E2.%26nbsp%3BClock%20Configuration%3A%26nbsp%3BCheck%20Clock%20Settings%3A%20Verify%20that%20the%20UART4%20clock%20settings%20in%20the%20device%20tree%20are%20correct%20and%20match%20the%20hardware%20configuration.%20Test%20Different%20Clock%20Frequencies%3A%20Experiment%20with%20different%20clock%20frequencies%20to%20see%20if%20it%20affects%20the%20behavior.%3CBR%20%2F%3E%3CBR%20%2F%3E3.%26nbsp%3BInterrupt%20Handling%3A%26nbsp%3BInterrupt%20Configuration%3A%20Ensure%20the%20UART4%20interrupt%20is%20configured%20correctly%20in%20the%20device%20tree%20and%20driver%20code.%20Interrupt%20Handler%3A%20Check%20for%20potential%20issues%20in%20the%20interrupt%20handler%20that%20might%20lead%20to%20unexpected%20behavior.%3CBR%20%2F%3E%3CBR%20%2F%3E4.%26nbsp%3BHardware%20Issues%3A%26nbsp%3BTest%20with%20Different%20UART%3A%20If%20possible%2C%20try%20using%20a%20different%20UART%20to%20isolate%20the%20issue.%20Examine%20Hardware%20Documentation%3A%20Refer%20to%20the%20IMX8MM%20datasheet%20for%20any%20specific%20requirements%20or%20limitations%20related%20to%20the%20UART4%20controller.%3CBR%20%2F%3E%3CBR%20%2F%3E5.%26nbsp%3BDebugging%20Techniques%3A%26nbsp%3BPrint%20Register%20Values%3A%20Add%20print%20statements%20to%20display%20the%20values%20of%20UCR%20registers%20before%20the%20crash%20to%20identify%20any%20abnormal%20values.%20Use%20a%20Debugger%3A%20Employ%20a%20debugger%20to%20step%20through%20the%20code%20and%20examine%20the%20state%20of%20variables%20and%20registers%20at%20the%20time%20of%20the%20crash.%20Core%20Dump%20Analysis%3A%20Analyze%20the%20core%20dump%20file%20to%20identify%20the%20root%20cause%20of%20the%20crash.%3CBR%20%2F%3E%3CBR%20%2F%3EAdditional%20Considerations%3A%3CBR%20%2F%3EDMA%20Configuration%3A%20If%20you're%20using%20DMA%20for%20UART%20transfers%2C%20ensure%20the%20DMA%20channels%20are%20configured%20correctly%20and%20not%20interfering%20with%20the%20UART%20operation.%3CBR%20%2F%3EPower%20Supply%3A%20A%20stable%20power%20supply%20is%20crucial%20for%20correct%20operation.%20Check%20for%20any%20voltage%20drops%20or%20noise%20issues.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EBy%20systematically%20addressing%20these%20potential%20causes%20and%20utilizing%20debugging%20techniques%2C%20you%20should%20be%20able%20to%20identify%20and%20resolve%20the%20UART4%20crash%20issue.%3C%2FP%3E%3C%2FLINGO-BODY%3E