* [PATCH v2] PCI: spacemit: Ignore PERST# input in RC mode on K1
@ 2026-11-06 2:13 Encrow Thorne
2026-11-06 2:16 ` sashiko-bot
2026-11-07 17:06 ` Manivannan Sadhasivam
0 siblings, 2 replies; 3+ messages in thread
From: Encrow Thorne @ 2026-11-06 2:13 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Yixun Lan,
Troy Mitchell, Alex Elder
Cc: linux-pci, linux-riscv, spacemit, linux-kernel, Bruno Banelli,
Ali Tariq, Encrow Thorne
In RC mode, the K1 PERST# pad input also affects the local controller.
Without PCIE_IGNORE_PERSTN set, asserting PERST# to reset the endpoint
also resets the RC, losing previously programmed register values,
including the vendor and device IDs.
Set PCIE_IGNORE_PERSTN during RC initialization to prevent this
feedback. Set it before the first DBI access, since PERST# may already
be low when initialization starts, causing the access to hang.
Fixes: ff64e078e45f ("PCI: spacemit: Add SpacemiT PCIe host driver")
Reported-by: Bruno Banelli <bbanelli@gmail.com>
Link: https://lore.kernel.org/all/20260825052249.66921-1-bbanelli@gmail.com/
Signed-off-by: Encrow Thorne <encrow.thorne@linux.spacemit.com>
---
Changes in v2:
- Rebase onto v7.4-rc1.
- Explain the PERST# pad input feedback into the local RC.
- Use PERST# in the subject, commit log and code comment.
- Add Fixes, Reported-by and Link tags.
- Link to v1: https://lore.kernel.org/r/20260924-spacemit-k1-pcie-fix-v1-1-002b5c1ba9fc@linux.spacemit.com
---
drivers/pci/controller/dwc/pcie-spacemit-k1.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-spacemit-k1.c b/drivers/pci/controller/dwc/pcie-spacemit-k1.c
index 92a71ea90ac3..bb60a35c2885 100644
--- a/drivers/pci/controller/dwc/pcie-spacemit-k1.c
+++ b/drivers/pci/controller/dwc/pcie-spacemit-k1.c
@@ -47,6 +47,7 @@
#define PCIE_CONTROL_LOGIC 0x0004
#define PCIE_SOFT_RESET BIT(0)
+#define PCIE_IGNORE_PERSTN BIT(2)
struct k1_pcie {
struct dw_pcie pci;
@@ -140,6 +141,13 @@ static int k1_pcie_init(struct dw_pcie_rp *pp)
if (ret)
return ret;
+ /*
+ * Ignore the PERST# pad input in RC mode so asserting PERST# to
+ * reset the endpoint does not also reset the local controller.
+ */
+ regmap_set_bits(k1->pmu, k1->pmu_off + PCIE_CONTROL_LOGIC,
+ PCIE_IGNORE_PERSTN);
+
/* Set the PCI vendor and device ID */
dw_pcie_dbi_ro_wr_en(pci);
dw_pcie_writew_dbi(pci, PCI_VENDOR_ID, PCI_VENDOR_ID_SPACEMIT);
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20260921-spacemit-k1-pcie-fix-256ffa8d382d
Best regards,
--
Encrow Thorne <encrow.thorne@linux.spacemit.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] PCI: spacemit: Ignore PERST# input in RC mode on K1
2026-11-06 2:13 [PATCH v2] PCI: spacemit: Ignore PERST# input in RC mode on K1 Encrow Thorne
@ 2026-11-06 2:16 ` sashiko-bot
2026-11-07 17:06 ` Manivannan Sadhasivam
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-06 2:16 UTC (permalink / raw)
To: Encrow Thorne; +Cc: linux-pci
> In RC mode, the K1 PERST# pad input also affects the local controller.
> Without PCIE_IGNORE_PERSTN set, asserting PERST# to reset the endpoint
> also resets the RC, losing previously programmed register values,
> including the vendor and device IDs.
>
> Set PCIE_IGNORE_PERSTN during RC initialization to prevent this
> feedback. Set it before the first DBI access, since PERST# may already
> be low when initialization starts, causing the access to hang.
>
> Fixes: ff64e078e45f ("PCI: spacemit: Add SpacemiT PCIe host driver")
> Reported-by: Bruno Banelli <bbanelli@gmail.com>
> Link: https://lore.kernel.org/all/20260825052249.66921-1-bbanelli@gmail.com/
> Signed-off-by: Encrow Thorne <encrow.thorne@linux.spacemit.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261106-spacemit-k1-pcie-fix-v2-1-6d74563b01d5@linux.spacemit.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] PCI: spacemit: Ignore PERST# input in RC mode on K1
2026-11-06 2:13 [PATCH v2] PCI: spacemit: Ignore PERST# input in RC mode on K1 Encrow Thorne
2026-11-06 2:16 ` sashiko-bot
@ 2026-11-07 17:06 ` Manivannan Sadhasivam
1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2026-11-07 17:06 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Yixun Lan, Troy Mitchell, Alex Elder,
Encrow Thorne
Cc: linux-pci, linux-riscv, spacemit, linux-kernel, Bruno Banelli,
Ali Tariq
On Fri, 06 Nov 2026 10:13:53 +0800, Encrow Thorne wrote:
> In RC mode, the K1 PERST# pad input also affects the local controller.
> Without PCIE_IGNORE_PERSTN set, asserting PERST# to reset the endpoint
> also resets the RC, losing previously programmed register values,
> including the vendor and device IDs.
>
> Set PCIE_IGNORE_PERSTN during RC initialization to prevent this
> feedback. Set it before the first DBI access, since PERST# may already
> be low when initialization starts, causing the access to hang.
>
> [...]
Applied, thanks!
[1/1] PCI: spacemit: Ignore PERST# input in RC mode on K1
commit: d606b0d156c6e34d754fae20b31f69d662eb04e8
Best regards,
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-07 17:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06 2:13 [PATCH v2] PCI: spacemit: Ignore PERST# input in RC mode on K1 Encrow Thorne
2026-11-06 2:16 ` sashiko-bot
2026-11-07 17:06 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox