0

I built a certain driver as module (m) for Linux, the spi-imx by NXP. Nontheless, Linux probes this driver when booting. I'm struggling to find out what process/other module/driver requests this spi-imx driver. A depmod does not show any dependencies between the spi-imx an other modules (except for the spidev as submodule).

After some research, I found out that Linux automatically (?) calls modprobe when it detects a new device. So does Linux actually call modprobe because the ecSPI'S status in the device tree as "okay"? If so, how can I prevent this? I would like to dynamically load the spi-imx from a user space application via modprobe. The story behind it: a coprocessor uses this SPI line in parallel to the Linux boot process. This interferes of course and interrupts the coprocessor's use of the SPI line. When the coprocessor has finished its transfer via SPI (a boot mechanism as well), it should hand over the SPI line to Linux.

I'm very thankful for any kind of tips, links, hints and comments on this.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Tau Pi
  • 55
  • 5
  • If device is present in the system and described in the firmware tables (ACPI, device tree, etc) Linux will try to enumerate it. Your problem in the wrong pin muxing afaics. You need to request pins, so the SPI host controller driver won’t be probed. – 0andriy Nov 09 '21 at 13:23
  • A somewhat hacky option would be to blacklist the module in an /etc/modprobe.d/*.conf file containing the line `blacklist spi-imx`. That will prevent the module being loaded automatically (by a device matching one of its aliases), but it can still be loaded using the `modprobe` or `insmod` commands. – Ian Abbott Nov 09 '21 at 15:14

1 Answers1

0

Thanks a lot for the answers. As you guys mentioned, I also found out that Linux itself probes the device if present ("okay").

One possible solution is to complete cut off the modprobe call via an entry like "install spi-imx /bin/false" in the *.conf file. But that makes it impossible to load the driver via modprobe, for Linux and for user space.

"blacklist spi-imx" inside a *.conf located at /etc/modprobe.d/ is the way to prevent Linux from probing the driver when booting. After that, a modprobe from user space can successfully load the driver afterwards.

Thanks again & best regards

Tau Pi
  • 55
  • 5