]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: brcmstb: Set generation limit before PCIe link up
authorJim Quinlan <james.quinlan@broadcom.com>
Fri, 14 Feb 2025 17:39:29 +0000 (12:39 -0500)
committerKrzysztof Wilczyński <kwilczynski@kernel.org>
Tue, 4 Mar 2025 15:54:15 +0000 (15:54 +0000)
When the user elects to limit the PCIe generation via the appropriate
devicetree property, apply the settings before the PCIe link up, not
after.

Fixes: c0452137034b ("PCI: brcmstb: Add Broadcom STB PCIe host controller driver")
Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20250214173944.47506-2-james.quinlan@broadcom.com
[kwilczynski: commit log]
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
drivers/pci/controller/pcie-brcmstb.c

index d171ee61eab38faed87042c599c59af6250b723f..2f1b2a4fe540670fc3d85f58b5482ca82500db56 100644 (file)
@@ -1324,6 +1324,10 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
        bool ssc_good = false;
        int ret, i;
 
+       /* Limit the generation if specified */
+       if (pcie->gen)
+               brcm_pcie_set_gen(pcie, pcie->gen);
+
        /* Unassert the fundamental reset */
        ret = pcie->cfg->perst_set(pcie, 0);
        if (ret)
@@ -1350,9 +1354,6 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
 
        brcm_config_clkreq(pcie);
 
-       if (pcie->gen)
-               brcm_pcie_set_gen(pcie, pcie->gen);
-
        if (pcie->ssc) {
                ret = brcm_pcie_set_ssc(pcie);
                if (ret == 0)