On 10/22/21 9:55 AM, Henk Medenblik wrote:
Hi all,
I am using a custom SPI controller which I created in my Xilinx MPSoC
fpga part. On this custom spi controller bus I have one or more SPI
devices (in my case a custom LTC6951 driver) connected in the
devicetree under my spi controller.
Because the controller is custom, I wrote the SPI controller driver
and also some slave device drivers which seem to work.
These drivers are both created as out of tree loadable modules.
My issue is that at boot of my SocFPGA I can see that my SPI
controller driver is correctly loaded during the boot process but the
spi slave driver which is connected to my controller does not get
automatically loaded.
Therefore, I manually need to do a modprobe ltc6951.ko in my case
before the LTC6951 slave in my case is up and running.
So, it seems like if I do not really understand the spi slaves
enumeration process or there is something else that I am missing here.
I was under the assumption that the slaves automatically get
enumerated (they are put as slaves under my controller inside the
device tree) whenever it's master controller becomes alive.
Hi,
Modules are loaded by userspace, e.g. udev. It does so based on hints
that are embedded in the module, these are called MODALIASs. When udev
sees a device without a driver it will check all the modules to see if
they have a matching modalias for the driver and then load the module.
In your driver you define the modalias usually using
MODULE_DEVICE_TABLE(type, table). E.g. for a SPI driver the type would
be spi and will take a reference to the spi_device_id table for your
driver. In addition if you are using devicetree you do the same for the
of_device_id table with `of` as the type.
- Lars