I²C bus over PCI

88 Views Asked by At

I am trying to write an ARM driver for a FPGA device connected over PCI.

The FPGA device has some I²C devices and DMA for which I want to write DMA engine driver. The FPGA design is not mine and different I²C devices sit on the same BAR.

I am a bit puzzled on how to do that. It seems to me that the best way would be to make a Multi-Function Driver (MFD) that will load the drivers and assign the memory for each component. I intend to add the the MFD node device tree (as a PCI device), so that I can specify present HW components in there, as well as the DMA channels.

If I add the PCI device to the device tree, how can I get the struct pci_dev for my device? Previously using pci_register_driver() I get pointer to the struct pci_dev in the .probe() function.

How do I access the struct pci_dev from platform_driver's .probe() function?

Is there a way to get it automatically or do in need to find it by vendor and device using, for example, pci_get_device()?

Does anyone have a better approach for this?

I have made a node inside PCI node but although compatible driver is present (as module) it did not get loaded:

pcie@33800000 {
    compatible = "fsl,imx8mm-pcie\0snps,dw-pcie";
    ...
    pci@0,0 {
        compatible = "ccx-qdma";
        device-type = "pci";
    };
};
0

There are 0 best solutions below