0

I am building a kernel module for PCIe device on Linux v5.15.60 on x86. This module connects to my FPGA (containing multiple soft cores) and creates a platform_device. For an other driver to use it.

The FPGA embed its own device tree blob in a memory region read by my kernel module. I would like to use __unflatten_device_tree, or of_fdt_unflatten_tree kernel functions to parse the blob and create new device_nodes associated with the created platform_device.

Unfortunately I can't access __unflatten_device_tree, and of_fdt_unflatten_tree would require the user to recompile the kernel with CONFIG_OF=y.

Is there any other kernel function than of_fdt_unflatten_tree to do this? I just need to parse a new blob but not to overlay the current device tree.

Edit: Once I have my device tree root in a struct device_node, can I create a list of struct devices or structe platform_devices automatically?

7
  • You don't need that. It should be done by FPGA framework: kernel.org/doc/html/latest/driver-api/fpga/fpga-region.html Commented Mar 2, 2023 at 20:38
  • Presumably, the drivers for those created devices would need access to the properties in the device tree nodes? I think this is a bit of a non-starter for a non-device-tree-based system. Commented Mar 3, 2023 at 16:47
  • @0andriy : in this case the FPGA is an emulation platform and I woud like to consider as a normal PCI device Commented Mar 6, 2023 at 15:27
  • @IanAbbott I did not know x86 was non-device-tree, I found some patches that should solve this problem lore.kernel.org/lkml/… Commented Mar 6, 2023 at 15:28
  • @cykoenig There are a couple of x86 platforms that use device trees, but not your typical PC. The OLPC ("One Laptop Per Child") and the Intel "CE4100 TV platform" are X86 platforms that use device trees. Commented Mar 6, 2023 at 16:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.