
On 08/02/2017 07:58 PM, Bao Xiaowei wrote:
modifiy the ls_pcie_link_up function, add the following three judging mechanisms:
detect state: return link down status; L0 state: return link up status; other state: delay about 100ms retrieve Status Returns the corresponding link status;
Please pay attention to your upper case and lower case in commit message.
What does the spec say about the timeout? Is 100ms the right time? If so, please put a comment in the source code.
Signed-off-by: Bao Xiaowei xiaowei.bao@nxp.com
drivers/pci/pcie_layerscape.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pcie_layerscape.c b/drivers/pci/pcie_layerscape.c index 7565e2f..4446ac9 100644 --- a/drivers/pci/pcie_layerscape.c +++ b/drivers/pci/pcie_layerscape.c @@ -65,13 +65,22 @@ static int ls_pcie_ltssm(struct ls_pcie *pcie)
static int ls_pcie_link_up(struct ls_pcie *pcie) {
- int ltssm;
int ltssm, i;
ltssm = ls_pcie_ltssm(pcie);
- if (ltssm < LTSSM_PCIE_L0)
- if ((ltssm == 0) || (ltssm == 1)) return 0;
- return 1;
- else if (ltssm == LTSSM_PCIE_L0)
return 1;
- else {
for (i = 0; i < 100; i++) {
udelay(1000);
ltssm = ls_pcie_ltssm(pcie);
if (ltssm == LTSSM_PCIE_L0)
return 1;
}
return 0;
- }
A comment to summary the logic would be nice.
York