From 71520fa9f1b769fa838e39ea5f00175424154376 Mon Sep 17 00:00:00 2001 From: GuEe-GUI <2991707448@qq.com> Date: Mon, 25 Nov 2024 20:42:08 +0800 Subject: [PATCH] [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> --- components/drivers/pci/probe.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/drivers/pci/probe.c b/components/drivers/pci/probe.c index 62ac252c4a..fc15eaae7e 100644 --- a/components/drivers/pci/probe.c +++ b/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,