bcm27xx: update 6.1 patches from RPi foundation
[openwrt/staging/xback.git] / target / linux / bcm27xx / patches-6.1 / 950-0847-PCI-brcmstb-Wait-for-100ms-following-PERST-deassert.patch
1 From 6f634d7efb8876e5953c30c0a613aaa5f575fe05 Mon Sep 17 00:00:00 2001
2 From: Jim Quinlan <jim2101024@gmail.com>
3 Date: Tue, 11 Oct 2022 14:42:07 -0400
4 Subject: [PATCH] PCI: brcmstb: Wait for 100ms following PERST# deassert
5
6 commit 3ae140ad827b359bc4fa7c7985691c4c1e3ca8f4 upstream.
7
8 Be prudent and give some time for power and clocks to become stable. As
9 described in the PCIe CEM specification sections 2.2 and 2.2.1; as well as
10 PCIe r5.0, 6.6.1.
11
12 Link: https://lore.kernel.org/r/20221011184211.18128-3-jim2101024@gmail.com
13 Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
14 Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
15 Acked-by: Florian Fainelli <f.fainelli@gmail.com>
16 ---
17 drivers/pci/controller/pcie-brcmstb.c | 11 +++++++++--
18 1 file changed, 9 insertions(+), 2 deletions(-)
19
20 --- a/drivers/pci/controller/pcie-brcmstb.c
21 +++ b/drivers/pci/controller/pcie-brcmstb.c
22 @@ -1038,8 +1038,15 @@ static int brcm_pcie_start_link(struct b
23 pcie->perst_set(pcie, 0);
24
25 /*
26 - * Give the RC/EP time to wake up, before trying to configure RC.
27 - * Intermittently check status for link-up, up to a total of 100ms.
28 + * Wait for 100ms after PERST# deassertion; see PCIe CEM specification
29 + * sections 2.2, PCIe r5.0, 6.6.1.
30 + */
31 + msleep(100);
32 +
33 + /*
34 + * Give the RC/EP even more time to wake up, before trying to
35 + * configure RC. Intermittently check status for link-up, up to a
36 + * total of 100ms.
37 */
38 for (i = 0; i < 100 && !brcm_pcie_link_up(pcie); i += 5)
39 msleep(5);