Search code examples
clinuxmmapspiimx6

linux hangs when reading SPI registers on Imx6


I have a project of embbeded linux runing on the NXP's Imx6 SoC and I am trying to use its SPI. As there is no driver that supports both master and slave mode, I first tried to handle it myself from the user space. I used mmap to access SPI's registers but when I try to read/write them with mmap, the system hangs and I have to reboot. Then I did the same in a custom spi-imx driver but I have to wait for the driver to arrive in the function spi_imx_transfer to be allowed to access the registers.

I am quite new to linux device management, so wonder why with the same method I can access the registers of other devices but not SPI's ones. Why does linux hang when I try to read these registers ? Is it possible to read or write them from user space or earlier in my device driver ?

Is there a method to allow (or unlock ?) access to registers ?

Any advice would be welcome.


Solution

  • It was not a linux problem : the ECSPI clock was disabled. So, I just have to set the correct register to 1 (with mmap) before accessing SPI's registers.