MCIMX8M-EVK kit PCIe Linux Driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCIMX8M-EVK kit PCIe Linux Driver

7,803 Views
Tarek
Senior Contributor I

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

Labels (1)
Tags (1)
0 Kudos
6 Replies

6,140 Views
mcggoal
Contributor I

hi, Terak

I have trapped in the same problem: request_irq() return errno -22.

Have you got solution now ?

Thanks !

0 Kudos

6,140 Views
igorpadykov
NXP Employee
NXP Employee

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

6,140 Views
Tarek
Senior Contributor I

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:

  1. Can the PCIe RC in the IMX8M SoC support 64-bit DMA?
  2. How do I enable and assign MSI handler for my end-point?

Thanks for your help

Tarek

0 Kudos

6,140 Views
igorpadykov
NXP Employee
NXP Employee

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-HOWTO.txt [LWN.net] 

MSI Register for pcie device driver - Stack Overflow 

Best regards
igor

0 Kudos

6,140 Views
Tarek
Senior Contributor I

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

0 Kudos

6,140 Views
igorpadykov
NXP Employee
NXP Employee

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

0 Kudos