Registering Soft IPs as Devices for Linux

I am trying to use an SPI bus between HPS and FPGA in order to communicate with a module (which is not directly connected to the HPS). The communication path looks like this:

[HPS] <===(Lightweight Bridge)===> [SPI (Soft IP, inside FPGA)] <===(SPI)===>[Sensor Module]

From what I understand, I should open /dev/mem and do mmap() in order to access the Soft IP’s registers. It seems so challenging and I don’t have much time.

But when a peripheral chip/module is connected to the HPS directly, with drivers and device tree settings, Linux can see it as a device and it appears under /dev/ folder. So, we can use read-write-ioctl system calls to easily communicate with it.

My question is, is there any way to make this SPI Soft IP appear in Linux’s /dev/ file for the ease of communication using system calls? Other than this, I am a newbie in this subject and if any of the above sounds silly, a warning is always appreciated.

Thanks in advance.

If you want the OS to recognize the existence of the SPI core, you need to add it to the device tree.

Once that’s done, if the SPI core has a linux driver, the driver should be able to find it as well (if it’s built-in, or loaded into the kernel), and make your life a lot easier. Better still, your external device may also have a driver. Hunt through the /drivers/ portion of the kernel tree and you might get lucky.