Why does my i.MX6UL-based Linux system freezes when accessing IO memory?

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

Why does my i.MX6UL-based Linux system freezes when accessing IO memory?

Jump to solution
1,218 Views
kevinroussel
Contributor II

Hello,

I am currently facing a problem I can't understand.

I need to develop a Linux kernel module on a i.MX6UL-based embedded system. I would use this module to wake up my system from suspend mode after some delay, using the EPIT to raise an interrupt (which would be the wake-up event).

My system runs Debian Linux 8 ("Jessie"), and thus the version 4.1.15 of the Linux kernel.

I began to develop a module to control the i.MX6UL EPIT. Its source code is in the attached file.

When modprobe-ing my module, everything goes okay, until I try to access (read or write) the IO memory reserved and allocated for the EPIT modules: the system then freezes! I have to power off and on my embedded device to be able to reboot Linux!

If I comment out the lines in the disable_epit() function after my comments, the module installs modprobes without problem, and I have the following dmesg output:

[60641.899705] EPIT1 base address : a0f70000
[60641.899797] EPIT2 base address : a0f78000
[60641.899836] CR address = a0f70000
[60641.899869] EPIT module initialised.

I can only conclude that the problem does not come from the request_mem_region() or ioremap() functions, since I check for errors, and I get back valid virtual IO memory addresses...

I absolutely can't understand what's happening. Any help, advice and solution would be greatly appreciated.

Thanks, and best regards,

Labels (2)
0 Kudos
1 Solution
1,104 Views
igorpadykov
NXP Employee
NXP Employee

Hi Kévin

one can check if epit clocks are enabled in CCM_CCGR1 register and try with

nxp linux from linux-imx - i.MX Linux kernel 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
1,104 Views
kevinroussel
Contributor II

Hello Igor,

Indeed, the EPIT clock was disabled in the CCM. (I would have thought that in such a case an explicit bus error or kernel oops would occur.)

Thank you and best regards.

0 Kudos
1,105 Views
igorpadykov
NXP Employee
NXP Employee

Hi Kévin

one can check if epit clocks are enabled in CCM_CCGR1 register and try with

nxp linux from linux-imx - i.MX Linux kernel 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,104 Views
kevinroussel
Contributor II

Precision: when modprobe-ing my module without accessing registers, I can also see that the adequate physical memory range has been reserved:

$ cat /proc/iomem

[...]

020c9000-020c9fff : /soc/aips-bus@02000000/usbphy@020c9000
020ca000-020cafff : /soc/aips-bus@02000000/usbphy@020ca000
020d0000-020d3fff : i.MX6-UL EPIT1 registers
020d4000-020d7fff : i.MX6-UL EPIT2 registers
020e0000-020e3fff : /soc/aips-bus@02000000/iomuxc@020e0000
020ec000-020effff : /soc/aips-bus@02000000/sdma@020ec000

[...]

This is another clue that makes me think that I reserved/allocated the IO memory for EPIT registers correctly...

So, I really don't understand why my system freezes when I try to read or write these registers.

0 Kudos