From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
To: "Enrique Hernández Bello" <ehbello@gmail.com>
Cc: shawn.lin@rock-chips.com, lpieralisi@kernel.org,
kwilczynski@kernel.org, mani@kernel.org, bhelgaas@google.com,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
heiko@sntech.de, dlemoal@kernel.org, iav@iav.lv,
devicetree@vger.kernel.org, linux-pci@vger.kernel.org,
linux-rockchip@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/2] PCI: rockchip-host: Make the PERST# inactive delay configurable
Date: Sun, 29 Nov 2026 19:35:45 +0530 [thread overview]
Message-ID: <179596114526.2288.5995800864070065544.b4-reply@b4> (raw)
In-Reply-To: <20261104215848.2087944-3-ehbello@gmail.com>
On 2026-11-04 21:58 +0000, Enrique Hernández Bello wrote:
> rockchip_pcie_host_init_port() waits T_PVPERL, 100 ms, before releasing
> PERST#. The GPIO is acquired with GPIOD_OUT_LOW early in probe, so PERST#
> is already asserted when that wait starts, and the wait therefore sets the
> reset pulse width as well.
>
> That suits a board which powers the slot at the moment it asserts PERST#,
> but endpoints do not agree on what they want. On a ROCK Pi 4C carrying a
> JMB585 SATA controller, a pulse that long stops the endpoint answering
> configuration reads at all. Measured on that board with a single kernel and
> two module parameters, one sleeping before the GPIO is acquired and one in
> place of the wait, timing the pulse with a ktime delta across the two
> gpiod_set_value() calls:
>
> pre (ms) post (ms) pulse trials enumerated
> 0 0 1-11 ms 5 5
> 0 10 ~18 ms 3 3
> 0 15 24-47 ms 4 4
> 0 20 ~28 ms 3 1
> 0 100 ~108 ms 4 0
> 200 0 6-11 ms 5 5
> 200 100 ~108 ms 1 0
>
> Delaying the assertion changes nothing, while widening the pulse decides
> everything. The slot supply on this board is regulator-always-on, so power
> had been valid for seconds in every row above, the failing ones included.
>
> Rather than change the delay for every board, read it from the device tree,
> reusing the property names the Rockchip vendor driver already carries for
> the dwc-based controllers in pcie-dw-rockchip.c. The default is unchanged,
> so a board that describes nothing behaves exactly as before. Whatever the
> board asks for, PERST# stays asserted for at least the 100 us minimum the
> specification sets, which covers T_PERST and T_PERST-CLK.
>
Sorry for the delay, but I'm still not convinced that what you are describing is
true. While inspecting the driver, I found out that the driver is starting LTSSM
before PERST# deassert, which is not common and may cause issue with the
Endpoint. When PERST# is not deasserted, the device is not obliged to respond to
any config requests. So it is certainly possible that LTSSM could be getting
timedout here and the 100ms delay can create an impression that delaying PERST#
is what causing the failure.
So can you try this below diff and see if it fixes the issue?
diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c
index 5b071bdc4f90..6482ce075d05 100644
--- a/drivers/pci/controller/pcie-rockchip-host.c
+++ b/drivers/pci/controller/pcie-rockchip-host.c
@@ -311,19 +311,19 @@ static int rockchip_pcie_host_init_port(struct rockchip_pcie *rockchip)
status |= PCI_EXP_LNKCTL_RCB;
rockchip_pcie_write(rockchip, status, PCIE_RC_CONFIG_CR + PCI_EXP_LNKCTL);
- /* Enable Gen1 training */
- rockchip_pcie_write(rockchip, PCIE_CLIENT_LINK_TRAIN_ENABLE,
- PCIE_CLIENT_CONFIG);
-
msleep(PCIE_T_PVPERL_MS);
gpiod_set_value_cansleep(rockchip->perst_gpio, 1);
msleep(PCIE_RESET_CONFIG_WAIT_MS);
+ /* Enable Gen1 training */
+ rockchip_pcie_write(rockchip, PCIE_CLIENT_LINK_TRAIN_ENABLE,
+ PCIE_CLIENT_CONFIG);
+
/* 500ms timeout value should be enough for Gen1/2 training */
err = readl_poll_timeout(rockchip->apb_base + PCIE_CLIENT_BASIC_STATUS1,
status, PCIE_LINK_UP(status), 20,
- 500 * USEC_PER_MSEC);
+ 1000 * USEC_PER_MSEC);
if (err) {
dev_err(dev, "PCIe link training gen1 timeout!\n");
goto err_power_off_phy;
Basically, I just moved the LTSSM start after PERST# deassert and increased the
status check to 1s as per the spec.
- Mani
next prev parent reply other threads:[~2026-11-29 14:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 21:58 [PATCH v5 0/2] " Enrique Hernández Bello
2026-11-04 21:58 ` [PATCH v5 1/2] dt-bindings: PCI: rockchip,rk3399-pcie: Add PERST# inactive delay properties Enrique Hernández Bello
2026-11-05 12:23 ` Krzysztof Kozlowski
2026-11-05 17:40 ` Enrique Hernández Bello
2026-11-05 18:24 ` Krzysztof Kozlowski
2026-11-04 21:58 ` [PATCH v5 2/2] PCI: rockchip-host: Make the PERST# inactive delay configurable Enrique Hernández Bello
2026-11-29 14:05 ` Manivannan Sadhasivam [this message]
2026-11-29 18:20 ` Igor Velkov
2026-11-05 1:44 ` [PATCH v5 0/2] " Igor Velkov
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=179596114526.2288.5995800864070065544.b4-reply@b4 \
--to=manivannan.sadhasivam@oss.qualcomm.com \
--cc=bhelgaas@google.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlemoal@kernel.org \
--cc=ehbello@gmail.com \
--cc=heiko@sntech.de \
--cc=iav@iav.lv \
--cc=krzk+dt@kernel.org \
--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-rockchip@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=shawn.lin@rock-chips.com \
/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®