Re: [PATCH] PCI: meson: Fix PERST# timing by asserting reset before LTSSM enable
Ronald Claveau <[email protected]>
| Newsgroups | org.infradead.lists.linux-amlogic,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <[email protected]> |
On 6/20/26 5:11 PM, Manivannan Sadhasivam wrote: > On Mon, Jun 15, 2026 at 12:34:11PM +0200, Ronald Claveau wrote: >> On 6/14/26 3:56 AM, Gowtham Kudupudi wrote: >>> On warm reboot, the PCIe controller's LTSSM starts link training >>> immediately if PERST# is already deasserted from the previous boot. >>> The driver then pulses PERST# for only 500us, which is too short to >>> properly reset the endpoint device that has already started training. >>> >>> Fix by moving the PERST# assert/deassert pulse BEFORE enabling LTSSM, >>> so the endpoint gets a clean reset cycle before link training begins. >>> >>> This was found on Amlogic G12B (A311D) with NVMe on an M.2 slot. >>> Cold boot worked because POR held PERST# low; warm reboot did not. >>> The fix was confirmed on a Banana Pi CM4 with Waveshare IO base board. >>> >>> Signed-off-by: Gowtham Kudupudi <[email protected]> >>> --- >>> drivers/pci/controller/dwc/pci-meson.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c >>> index 5f8e2f4b3c12..3a7e9f1d5b8c 100644 >>> --- a/drivers/pci/controller/dwc/pci-meson.c >>> +++ b/drivers/pci/controller/dwc/pci-meson.c >>> @@ -310,8 +310,8 @@ static int meson_pcie_start_link(struct dw_pcie *pci) >>> { >>> struct meson_pcie *mp = to_meson_pcie(pci); >>> >>> + meson_pcie_assert_reset(mp); >>> meson_pcie_ltssm_enable(mp); >>> - meson_pcie_assert_reset(mp); > > meson_pcie_assert_reset() itself is wrong as it toggles PERST#. You'd just need: > > msleep(PCIE_T_PERST_CLK_US); > gpiod_set_value_cansleep(mp->reset_gpio, GPIOD_OUT_LOW) > > but in probe(), after meson_pcie_probe_clocks() as that's when both power and > REFCLK becomes stable. > >>> >>> return 0; >>> } >> >> Hi Gowtham, >> >> I have a patch [1] that I haven't submitted yet. >> This might be related to your issue, what do you think ? >> >> [1] https://github.com/rclaveau-tech/linux-khadas/commit/bee0a02d9756 >> > > This patch is also needed as it correctly fixes the PERST# polarity when > requesting the GPIO. Since the devicetree is defining the PERST# GPIO as > ACIVE_LOW, the driver should request it as GPIOD_OUT_HIGH to make sure that > PERST# is asserted. > > So please submit the referenced patch. > > - Mani > Hi Mani, I sent it here: https://lore.kernel.org/all/[email protected]/ -- Best regards, Ronald _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic