mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Wenbin Yao (Consultant)" <quic_wenbyao@quicinc.com>
To: <jingoohan1@gmail.com>, <manivannan.sadhasivam@linaro.org>,
	<lpieralisi@kernel.org>, <kw@linux.com>, <robh@kernel.org>,
	<bhelgaas@google.com>, <linux-pci@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <quic_cang@quicinc.com>, <mrana@quicinc.com>,
	yuqiang <quic_qianyu@quicinc.com>, <quic_wenbyao@quicinc.com>
Subject: [PATCH] PCI: dwc: Set PORT_LOGIC_LINK_WIDTH to one lane
Date: Thu, 12 Dec 2024 16:19:12 +0800	[thread overview]
Message-ID: <1524e971-8433-1e2d-b39e-65bad0d6c6ce@quicinc.com> (raw)

PORT_LOGIC_LINK_WIDTH field of the PCIE_LINK_WIDTH_SPEED_CONTROL register
indicates the number of lanes to check for exit from Electrical Idle in
Polling.Active and L2.Idle. It is used to limit the effective link width to
ignore broken or unused lanes that detect a receiver to prevent one or more
bad Receivers or Transmitters from holding up a valid Link from being
configured.

In a PCIe link that support muiltiple lanes, setting PORT_LOGIC_LINK_WIDTH
to 1 will not affect the link width that is actually intended to be used.
But setting it to a value other than 1 will lead to link training fail if
one or more lanes are broken.

Hence, always set PORT_LOGIC_LINK_WIDTH to 1 no matter how many lanes the
port actually supports to make linking up more robust. Link can still be
established with one lane at least if other lanes are broken.

Signed-off-by: Wenbin Yao <quic_wenbyao@quicinc.com>
---
  drivers/pci/controller/dwc/pcie-designware.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware.c 
b/drivers/pci/controller/dwc/pcie-designware.c
index 6d6cbc8b5b2c..d40afe74ddd1 100644
--- a/drivers/pci/controller/dwc/pcie-designware.c
+++ b/drivers/pci/controller/dwc/pcie-designware.c
@@ -752,22 +752,19 @@ static void dw_pcie_link_set_max_link_width(struct 
dw_pcie *pci, u32 num_lanes)
      /* Set link width speed control register */
      lwsc = dw_pcie_readl_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL);
      lwsc &= ~PORT_LOGIC_LINK_WIDTH_MASK;
+    lwsc |= PORT_LOGIC_LINK_WIDTH_1_LANES;
      switch (num_lanes) {
      case 1:
          plc |= PORT_LINK_MODE_1_LANES;
-        lwsc |= PORT_LOGIC_LINK_WIDTH_1_LANES;
          break;
      case 2:
          plc |= PORT_LINK_MODE_2_LANES;
-        lwsc |= PORT_LOGIC_LINK_WIDTH_2_LANES;
          break;
      case 4:
          plc |= PORT_LINK_MODE_4_LANES;
-        lwsc |= PORT_LOGIC_LINK_WIDTH_4_LANES;
          break;
      case 8:
          plc |= PORT_LINK_MODE_8_LANES;
-        lwsc |= PORT_LOGIC_LINK_WIDTH_8_LANES;
          break;
      default:
          dev_err(pci->dev, "num-lanes %u: invalid value\n", num_lanes);
-- 
2.34.1



             reply	other threads:[~2024-12-12  8:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12  8:19 Wenbin Yao (Consultant) [this message]
2025-03-31  9:15 ` Wenbin Yao (Consultant)
2025-04-07 17:51 ` Manivannan Sadhasivam
2025-04-14  8:45   ` Qiang Yu
2025-04-18 17:01     ` Manivannan Sadhasivam

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=1524e971-8433-1e2d-b39e-65bad0d6c6ce@quicinc.com \
    --to=quic_wenbyao@quicinc.com \
    --cc=bhelgaas@google.com \
    --cc=jingoohan1@gmail.com \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mrana@quicinc.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_qianyu@quicinc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®