IMX Linux problem with SPI module.

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

IMX Linux problem with SPI module.

919 次查看
nicolasmuratore
Contributor III

Hi, hope you are doing well, I'm using a custom board with imxrt1062 and Linux kernel version 4.5.0, the Linux distribution is working well, the board is very similar to the MIMXRT1060-EVK.

All the embedded interfaces on Linux distribution are working well, serial, i2c, Eth, USB,  all of them are embedded, except the SPI that is a external module that should be inserted after kernel boot.

At circuit level:

  • I added one SPI (LPSPI4) interface to manage a NOR SPI flash, the pins are not shared with any other thing.

At software level:

  • I added support on linux kernel for external modules.
  • The interface LPSPI4 and m25p80m device like is declared on "device tree".
  • The pinctrl is set on iomux.   .

I can build the module using:

make CFLAGS=-PIC /home/../linux (Linux kernel files)  M=(source files).

The module structure (m25p80.ko) seems to be ok, using "file" and "modinfo" commands on Linux I can see the following:

m25p80.ko: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), Build[]..........., not stripped.

vermagic: 4.5.0 mod_unload ARMv7 thumb2

The information is ok, but when I try to insert the module using "insmod" command, I get the following error:

#insmod m25p80.ko

m25p80: unknown relocation: 161

insmod: can't insert 'm25p80.ko': invalid module format.

I found that the 161 number is in the library "elf.h", there is a line:

#define R_SH_PLT32 161

So, seems to be that could be an error on module's format, but "file" returns that the module is of type ELF 32.

I don't understand what is going on, is my first time compiling and using Linux kernel modules, I'm shure that I'm missing something.

I've read many things about kernel modules, but I can't find the solution for this.

Maybe you can help me.

Many thanks!

0 项奖励
回复
2 回复数

802 次查看
nicolasmuratore
Contributor III

Thanks Bio_TICFSL, I compiled the module inside the kernel, after using "insmod" I get the following message:

"Error: Driver "m25p80" is already registered, aborting...."

So, seems to be that the kernel has a driver previously loaded, I suppose that is because I set the flash-nor support on the configuration menú. 

But, even when the driver seems to be registered, activating some debugger I found the following error on dmesg:

fsl_lpspi 403a0000.lpspi: no init pinctrl state
fsl_lpspi 403a0000.lpspi: no idle pinctrl state
Entering fsl_lpspi_probe
fsl_lpspi: probe of 403a0000.lpspi failed with error -2

So, the driver lpspi is registered, but not probed, I don't know what the "error -2" means, I can't find it.

Many thanks

 

 

0 项奖励
回复

866 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

You module is bad, you have to write this module on your kernel and build it, then reboot and try insmod and see the dmesg to see if is there.

Regards

0 项奖励
回复