0

I am writing a Linux kernel driver (kernel 4.9) for our custom setup. We do use a ARM64 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?

EDIT:

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

  • Maybe have a look at https://stackoverflow.com/q/12414024/1216776 – stark Mar 08 '22 at 16:39
  • The PCIe bus is enumerated (since I can see my device created by my driver and read its version from userspace using `cat /sys/class/my_fpga/fpga/device/version`). The `FPGA` is already configured and powered via an external supply so rebooting Linux should not toggle the power of it. – Ayrton Leyssens Mar 09 '22 at 06:37
  • Your kernel choice is quite bad. It's too old. I would suggest to start with the latest first. – 0andriy Mar 14 '22 at 12:40
  • Unfortunately that is not an option. Custom kernel for embedded system is not so easily to update ;) Besides, its a LTS one ;) – Ayrton Leyssens Mar 15 '22 at 08:28

0 Answers0