Hi:
I used to reply this customer's question by "PCIe imx6 switch issue continuation of SR 1-1159433048" , here is details.
At my side, I used the codes listed below too.
+ /* Force GEN1 */
+ writel(((readl(dbi_base + LNK_CAP) & 0xfffffff0) | 0x1), dbi_base + LNK_CAP);
+ usleep_range(4000, 5000);
My tests:
Because I don’t have PLX8603 switch, I just used the i.MX6Q SD + GEN2 PCIe EP device(usb3.0 xhci device)
to do the suspend/resume tests when the link_cap of PCIe RC(i.MX6Q SD) is limited to PCIe GEN1 speed.
Before suspend:
root@freescale ~$ lspci -vv
00:00.0 PCI bridge: Unknown device 16c3:abcd (rev 01) (prog-if 00 [Normal decode])
...
Device: MaxPayload 128 bytes, MaxReadReq 512 bytes
Link: Supported Speed 2.5Gb/s, Width x1, ASPM L0s L1, Port 0
Link: Latency L0s <1us, L1 <8us
After resume back:
root@freescale ~$ lspci -vv
00:00.0 PCI bridge: Unknown device 16c3:abcd (rev 01) (prog-if 00 [Normal decode])
...
Link: ASPM Disabled RCB 64 bytes CommClk- ExtSynch-
Link: Speed 2.5Gb/s, Width x1
Root: Correctable- Non-Fatal- Fatal- PME-
...
The ‘Max_Link_Speeds’ of 0x7c LNK_CAP is always 1 after out of the suspend.
root@freescale ~$ ./memtool -32 01ffc000 40
Reading 0x80 count starting at address 0x01FFC000
0x01FFC000: ABCD16C3 00100147 06040001 00010010
0x01FFC010: 01000000 00000000 00010100 000000F0
0x01FFC020: 01100110 0000FFF0 00000000 00000000
0x01FFC030: 00000000 00000040 00000000 0001019B
0x01FFC040: DBC35001 00000000 00000000 00000000
0x01FFC050: 01807005 00000000 00000000 00000000
0x01FFC060: 00000000 00000000 00000000 00000000
0x01FFC070: 00420010 00008000 00102010 0011CC11
Regarding to your description, it seems that the LNK_CAP is changed, right?
So I suggest customer that
"can you debug into the code, and make a check when LNK_CAP is changed?"
BTW, attached the email.
Best Regards
Richard