cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
wonsikleee
Observer
Observer
551 Views
Registered: ‎11-12-2019

Single xdma driver for multiple board

Jump to solution

 

Hi,

I'm rewriting the xdma driver code for multiple board.

I know that a single device driver can probe multiple devices and detect it but how to differentiate each device?

I want to write a different function for each board with a specific ID identifying each board.

How can I give each board a specific ID? And how can I use it in a driver code?

Thanks in advance.

 

Best regards,

 

0 Kudos
Reply
1 Solution

Accepted Solutions
liy
Xilinx Employee
Xilinx Employee
497 Views
Registered: ‎08-02-2007
when you generate the IP, there is an option called device ID this is used by the driver to identify different boards
------------------------------------------------------------------------------
Don't forget to reply, give kudo and accept as solution
------------------------------------------------------------------------------

View solution in original post

2 Replies
liy
Xilinx Employee
Xilinx Employee
498 Views
Registered: ‎08-02-2007
when you generate the IP, there is an option called device ID this is used by the driver to identify different boards
------------------------------------------------------------------------------
Don't forget to reply, give kudo and accept as solution
------------------------------------------------------------------------------

View solution in original post

aforencich
Explorer
Explorer
463 Views
Registered: ‎08-14-2013

There are a few options to consider.  At least as far as Linux kernel modules are concerned, when the module is loaded, it registers a new PCIe device driver.  Registering a device driver involves providing a list of entry points (probe, remove, etc.) along with a set of PCIe device IDs that the driver should be attached to.  The Linux kernel will use that information when scanning devices to figure out which driver to attach. 

In the probe method, the driver can look at identifying information on the device - vendor and product IDs, subsystem vendor and product IDs, device registers, etc. and decide what to do with the device.  So you could set the same vendor and product IDs and differentiate with subsystem IDs.  Or you could set different product IDs, set the driver ID list to match all of them, and then check the actual ID in the kernel module.  Or you could implement read-only informational registers that the driver can read via MMIO.  Setting the vendor and product IDs can be done either in the wizard, or by driving ports on the IP core which may need to be exposed by changing a setting in the wizard.  Adding informational registers is done outside the PCIe IP core by implementing BARs.  If you're using the XDMA core, then setting vendor/product IDs is probably going to be the simplest method.  On the other hand, informational registers can expose the values of verilog parameters without having to regenerate the IP core, which can be very useful.