AnsweredAssumed Answered

How do I modify the max payload size for PCIe on the i.MX8

Question asked by GregT on Mar 27, 2019
Latest reply on Apr 15, 2019 by GregT

Hi,

 

I'm trying to increase it to 1024.  The reference manual says that it supports up to 4096.  I've tried patching the pci-imx6.c file with the code snippet below but it always hangs on boot up.  Here is the register offset and masking.  We need to set the max payload size before enumeration because the fpga end point needs the payload size to be 1024.

 

At the top of the pci-imx6.c file I put this.

 

/* PCIe Root Complex registers (memory-mapped) */
#define PCIE_RC_DEVICE_CAPABILITIES_REG 0x74
#define PCIE_RC_DCR_MAXPAYLOAD_MASK 0x7
#define PCIE_RC_DCR_MAXPAYLOAD_1024 0x3
#define PCIE_RC_DEVICE_CONTROL_DEVICE_STATUS 0x78
#define PCIE_RC_DCDS_MAXPAYLOAD_MASK 0xe0
#define PCIE_RC_DCDS_MAXPAYLOAD_1024 0x60

 

And I put the code below at the end of the imx6_pcie_probe function.

 

// change the max payload
tmp = dw_pcie_readl_rc(pp, PCIE_RC_DEVICE_CAPABILITIES_REG);
tmp &= ~PCIE_RC_DCR_MAXPAYLOAD_MASK;
tmp |= PCIE_RC_DCR_MAXPAYLOAD_1024;
dev_info(dev, "Change the max payload size, dev cap reg 0x%08x.", tmp);
dw_pcie_writel_rc(pp, PCIE_RC_DEVICE_CAPABILITIES_REG, tmp);
tmp = dw_pcie_readl_rc(pp, PCIE_RC_DEVICE_CONTROL_DEVICE_STATUS);
tmp &= ~PCIE_RC_DCDS_MAXPAYLOAD_MASK;
tmp |= PCIE_RC_DCDS_MAXPAYLOAD_1024;
dev_info(dev, "Change the max payload size, dev ctrl status reg 0x%08x.", tmp);
dw_pcie_writel_rc(pp, PCIE_RC_DEVICE_CONTROL_DEVICE_STATUS, tmp);

 

Thanks,

Greg

Outcomes