PCIe multiple child-devices
I am writing a Linux kernel driver (kernel 4.9) for our custom setup. We do use a ARM64( nvidia Jetson Xavier) based board with a PCIe interface. Connected to the interface we have an extension board with a FPGA on it.
At this moment I succeed at creating a device that registers my FPGA with some basic functions, like reading the version of the FPGA in a certain register in the FPGA.
In the FPGA we do have some additional “devices” like GPIO, memory regions … that I would like to add as its own chardevice. We do have existing drivers for these. Normally, Linux goes over the DTB and calls the correct driver for our FPGA, following the correct drivers for our child devices. Now I would like to archieve the same with this PCIe interface. To do this, I look for a node in my DTB fpga
and add its children.
for_each_available_child_of_node(np, nc) {
subdev = kzalloc(sizeof(*subdev), GFP_KERNEL);
list_add(&subdev->subdev_entry, &priv->subdev_list.subdev_entry);
...
}
list_for_each_entry(subdev, &priv->subdev_list.subdev_entry,
subdev_entry) {
ret = mfd_add_devices(priv->dev, PLATFORM_DEVID_NONE,
subdev->mfd_cell, 1, NULL, irq_base, NULL);
if (ret) {
dev_err(priv->dev, "Failed to add mfd cell\n");
goto err_mfd_add;
}
}
For some reason, the driver is not loaded for its children. print
's in the device drivers probe
function shows nothing, not being called. Added print
's to the loops and it shows its children (all properties and values check out with what I set in the DTB).
Yes, the driver is compiled an available in the kernel. I also tried building the driver as a kmod and load it that way, no change in behaviour. The output of lsmod
shows the module is loaded but not used.
Somebody got an idea why my driver is not being loaded?
I also can see the “nodes” from my DTB that should be created as a chardevice. They can be found in the expected location /sys/class/my_fpga/fpga/device/
, in this case GPIO
. Under the GPIO
folder I can see the driver_override
(which is (null)
), modalias
, power
, sybsystem
and uevent
. So my device (my_fpga) seems to be enumerated, only its children are not created.
A reboot does not solve it, nor a rescan
of the PCIe-bus. The extension-board is powered via an external powersupply and is already configured before booting Linux