From: Florian Fainelli <florian.fainelli@broadcom.com>
To: linux-pci@vger.kernel.org
Cc: "Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Dom Cobley" <popcornmix@gmail.com>,
	"Phil Elwell" <phil@raspberrypi.com>,
	"Jim Quinlan" <jim2101024@gmail.com>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Hans Zhang" <18255117159@163.com>,
	linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM
	BCM2711/BCM2835 ARM ARCHITECTURE),
	linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM
	BCM2711/BCM2835 ARM ARCHITECTURE),
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v2] PCI: brcmstb: Assign pcie->gen from of_pci_get_max_link_speed()
Date: Wed,  6 May 2026 09:45:37 -0700	[thread overview]
Message-ID: <20260506164537.103196-1-florian.fainelli@broadcom.com> (raw)
In-Reply-To: <mid:20260501202438.376033-1-florian.fainelli@broadcom.com>

After commit 03f920936977 ("PCI: controller: Validate max-link-speed"),
pcie->gen stopped being assigned and as a result the established PCIe
link would stop supporting Gen3 speeds on 2712 since pcie->gen is used
to populate LnkCntl2 and LnkCap in brcm_pcie_set_gen().

Whether the 'max-link-speed' property is not specified, or it exceeds
Gen3, resort to the HW defaults.

Link: https://github.com/raspberrypi/linux/issues/7343
Reported-by: Dom Cobley <popcornmix@gmail.com>
Reported-by: Phil Elwell <phil@raspberrypi.com>
Fixes: 03f920936977 ("PCI: controller: Validate max-link-speed")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Change-Id: Ic5431469dd7a6c8b391f84f27119dad876256880
---
Changes in v2:

- utilize of_pci_get_max_link_speed() directly
- also validate against exceeding Gen3

 drivers/pci/controller/pcie-brcmstb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 714bcab97b60..08a0e7091ced 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -2072,8 +2072,10 @@ static int brcm_pcie_probe(struct platform_device *pdev)
 		return PTR_ERR(pcie->clk);
 
 	ret = of_pci_get_max_link_speed(np);
-	if (pcie_get_link_speed(ret) == PCI_SPEED_UNKNOWN)
+	if (ret < 0 || ret > 3)
 		pcie->gen = 0;
+	else
+		pcie->gen = ret;
 
 	pcie->ssc = of_property_read_bool(np, "brcm,enable-ssc");
 
-- 
2.34.1


       reply	other threads:[~2026-05-06 16:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mid:20260501202438.376033-1-florian.fainelli@broadcom.com>
2026-05-06 16:45 ` Florian Fainelli [this message]
2026-05-06 17:08   ` [PATCH v2] PCI: brcmstb: Assign pcie->gen from of_pci_get_max_link_speed() Manivannan Sadhasivam
2026-05-06 18:15     ` Florian Fainelli
2026-05-07  8:48       ` Manivannan Sadhasivam
2026-05-06 20:40   ` sashiko-bot
2026-05-07  2:55   ` Hans Zhang
2026-05-15 18:14   ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260506164537.103196-1-florian.fainelli@broadcom.com \
    --to=florian.fainelli@broadcom.com \
    --cc=18255117159@163.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bhelgaas@google.com \
    --cc=jim2101024@gmail.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=phil@raspberrypi.com \
    --cc=popcornmix@gmail.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.