I am writing a driver for PCI express (RC mode) on IMX6 (var-som-mx6). I have successfully enabled the clock and have access to PCIe registers. But I cannot link up the port. I followed the steps in imx6 SDK except for two parts
1- In the SDK, external oscillator is being used to provide the clock to the PCIe module whereas I have used internal clock
2 - There was a step to enable 3.3v for PCI mini by making a GPIO high. I couldn't find which pin it was and also I checked the voltages on PCI mini connector on the board and all of the voltages were there, so I am assuming that we don't require this step for my board.
After trying a lot I looked at the Linux driver for IMX6. It does all of the configuration being done in SDK along with some extra things like setting the number of lanes and speed of the link, setting bus number, BARs, memory base and limit etc. It also forces Gen1 operation before starting the link.
I have tried both but I am not successful. Also, I have searched a lot, looked at the PCI specifications document, imx6 reference manual, tried EP mode etc but haven't found anything that helped me. I am writing the PCI driver for the first time and also haven't worked with Phy before.
I will really appreciate if anybody can help me.