Hello,
I am developing bare metal application on ARM with a K2L evaluation board. Currently, I am trying to make a PCIe driver to communicate with only one end point (it will be a FPGA), the Keystone is the root complex.
My end point is not available at the moment, so I want to test my driver in loopback mode (PHY) with no hardware connected. I encounter a problem with the link training, the LTSSM state stay in DETECT_QUIET (0x00).
My driver initialises the PCIe 0 lane with the following steps:
- Configuration in root complex (DEVCFG)
- Disable link training (CMD_STATUS)
- Set lane number to x1 (PL_LINK_CTRL)
- Set generation 2 for 5 Gb/s (PL_GEN2)
- Unlock writing to BAR mask (CMD_STATUS)
- Set BAR mask 0 and 1 (respectively 0x0007FFF and 0x0FFFFFFF)
- Lock writing to BAR mask (CMD_STATUS)
- Enable memory access, mastership bus, poisoned TLP, error message (STATUS_COMMAND)
- Enable unsupported request, fatal, non-fatal, correctable errors (DEV_STAT_CTRL)
- Enable ECRC (PCIE_ACCR)
- Set outbound region size to 8 MB (OB_SIZE)
- Clear the outbound region registers (OB_OFFSET_LO/OB_OFFSET_HI)
- Set inbound region (IB_BAR/IB_START/IB_OFFSET)
- Enable inbound/outbound translation (CMD_STATUS)
- Set BAR 0 and 1 (respectively 0x21800000 and 0x80000000)
- Enable PHY loopback (SERDES_CFG0 = 0x0010C000)
- Enable Rx/Tx loopback
- Disable Loss of signal
- Enable link training (CMD_STATUS)
- For link state for PHY loopback (PL_FORCE_LINK)
- Set link state to POLL_ACTIVE
- Set FORCE_LINK
- Wait for LTSSM L0 state (DEBUG0)
By reading the PCIe registers with a memory dump, the LTSSM in DEBUG0 stay at 0. I verify the registers one by one to check if the configuration has been correctly stored, it is appeared that the generation 2 and lane enable flag is not set in the PL_GEN2 register, and the force link seem to do nothing.
I have followed the TI documentation instruction, but I did not found my error. Also, I have tried with the PIPE loopback, but I had the same problem.
Regards William