Forráskód Böngészése

[DM/FIXUP] Add ms sleep for link status change

We should wait a while for success or failure
after link status change or will communicate
fail with the endpoint.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
GuEe-GUI 8 hónapja
szülő
commit
71520fa9f1
1 módosított fájl, 5 hozzáadás és 1 törlés
  1. 5 1
      components/drivers/pci/probe.c

+ 5 - 1
components/drivers/pci/probe.c

@@ -486,7 +486,7 @@ static void pcie_fixup_link(struct rt_pci_device *pdev)
 
         if (!!(exp_lnksta & PCIEM_LINK_STA_DL_ACTIVE))
         {
-            return;
+            goto _status_sync;
         }
 
         rt_thread_mdelay(10);
@@ -496,6 +496,10 @@ static void pcie_fixup_link(struct rt_pci_device *pdev)
     rt_pci_write_config_u16(pdev, pos + PCIER_LINK_CTL2, exp_lnkctl2);
     rt_pci_write_config_u16(pdev, pos + PCIER_LINK_CTL,
             exp_lnkctl | PCIEM_LINK_CTL_RETRAIN_LINK);
+
+_status_sync:
+    /* Wait a while for success or failure */
+    rt_thread_mdelay(100);
 }
 
 static rt_uint32_t pci_scan_bridge_extend(struct rt_pci_bus *bus, struct rt_pci_device *pdev,