I am developing a pcie device driver for the iMX8M evaluation kit. The end-point is an FPGA which supports 64-bit DMA and a single MSI interrupt.
First of all in my driver I tried to enable DMA_BIT_MASK(64) using Linux pcie framework API:
pci_set_dma_mask(pdev, DMA_BIT_MASK(64);
This function is failing and the kernel error message is:
[ +0.008434] Can't support > 32 bit dma.
Second when I tried to enable the pcie interrupt using:
pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);then pci_irq_vector(pdev, 0); this function is returnting Linux IRQ 11.
So when I assign a handler to this IRQ using request_irq() it returns err -22.
(1) Is it possible to enable DMA_BIT_MASK(64)?
(2) Why the kernel is not allowing me to assign an IRQ handler? Is there any PCIe driver example for i.MX8?
Thanks
Hi Tarek
pcie driver example can be found on below link with description in
sect.4.9 PCI Express Root Complex attached Linux Manual.
pci-imx6.c\host\pci\drivers - linux-imx - i.MX Linux kernel
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Igor,
Thank you for your prompt reply. The document gives a high-level information about the RC and it does not answer my questions.
Also, the PCI driver source is for the root-complex which I don't need to change. What I need to do is implement a device driver for the FPGA which acts as a PCIe end-point and is connected to the M.2 connector on the MX8MDQLQEVK.
To simplify my query:
Thanks for your help
Tarek
Hi Tarek
seems 64-bit is supported as described in sect.11.2.5.1.1
Table 10-1 DMA Module Features i.MX8MDQ Reference Manual
https://www.nxp.com/docs/en/reference-manual/IMX8MDQLQRM.pdf
>How do I enable and assign MSI handler for my end-point?
please refer to common linux tutorials
MSI Register for pcie device driver - Stack Overflow
Best regards
igor
Hi Igor,
If i.MX8M supports 64-bit why is it forced to 32 in fsl-imx8mq.dtsi file?
dma_cap: dma_cap {
compatible = "dma-capability";
only-dma-mask32 = <1>;
};
fsl-imx8mq.dtsi\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel
Because of this device tree setting the kernel will not accept setting the DMA mask to 64-bit and gives this error:
[ +0.008434] Can't support > 32 bit dma
Can you please confirm that removing this line: "only-dma-mask32 = <1>;" will work fine and not cause any issues?
Thanks,
Tarek
Hi Tarek
I escalated your question internally and received answer:
--------------------------
The internal bus is HW limited to 32-bits. That is why the cap is 32 bits.
---------------------------
Best regards
igor