Re: [PATCH v5 3/3] PCI: cadence: Add LGA IP debugfs for LTSSM status
From: Aksh Garg
Date: Tue May 19 2026 - 01:41:27 EST
On 15/05/26 20:27, Hans Zhang wrote:
Extend debugfs support to LGA-based Cadence PCIe controllers. The
'ltssm_status' file now works for both HPA and LGA IP by selecting the
appropriate register access based on the 'is_hpa' flag.
Signed-off-by: Hans Zhang <18255117159@xxxxxxx>
---
Hi Aksh
Could you please assist in checking whether the ltssm_status of LGA is
correct? If there are any inaccuracies, please point them out.
---
.../controller/cadence/pcie-cadence-debugfs.c | 61 ++++++++++++++++++-
.../pci/controller/cadence/pcie-cadence-ep.c | 3 +
.../controller/cadence/pcie-cadence-host.c | 9 ++-
drivers/pci/controller/cadence/pcie-cadence.h | 43 +++++++++++++
4 files changed, 112 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/controller/cadence/pcie-cadence-debugfs.c b/drivers/pci/controller/cadence/pcie-cadence-debugfs.c
index 97c5deef2b1a..ac985699b974 100644
--- a/drivers/pci/controller/cadence/pcie-cadence-debugfs.c
+++ b/drivers/pci/controller/cadence/pcie-cadence-debugfs.c
@@ -13,6 +13,58 @@
#define CDNS_DEBUGFS_BUF_MAX 128
+static const char *cdns_pcie_lga_ltssm_status_string(enum cdns_pcie_lga_ltssm ltssm)
+{
+ const char *str;
+
+ switch (ltssm) {
+#define CDNS_PCIE_LGA_LTSSM_NAME(n) case n: str = #n; break
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_DETECT_QUIET);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_DETECT_ACTIVE);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_POLLING_ACTIVE);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_POLLING_COMPLIANCE);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_POLLING_CONFIGURATION);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS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_LGA_LTSSM_NAME(CDNS_PCIE_LGA_L2_IDLE);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_L2_TRANSMITWAKE);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_DISABLED);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_LOOPBACK_ENTRY_MASTER);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_LOOPBACK_ACTIVE_MASTER);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_LOOPBACK_EXIT_MASTER);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_LOOPBACK_ENTRY_SLAVE);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_LOOPBACK_ACTIVE_SLAVE);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_LOOPBACK_EXIT_SLAVE);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_HOT_RESET);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_RECOVERY_EQUALIZATION_PHASE_0);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_RECOVERY_EQUALIZATION_PHASE_1);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_RECOVERY_EQUALIZATION_PHASE_2);
+ CDNS_PCIE_LGA_LTSSM_NAME(CDNS_PCIE_LGA_RECOVERY_EQUALIZATION_PHASE_3);
Hi Hans,
You might need to rename the states as CDNS_PCIE_LGA_LTSSM_* as
suggested by Sashiko to print the state names correctly, and also to
complement the naming used for HPA LTSSM states.
+ default:
+ str = "CDNS_PCIE_LGA_LTSSM_UNKNOWN";
+ break;
+ }
+
+ return str + strlen("CDNS_PCIE_LGA_LTSSM_");
I have tested for LGA IP by updating this to strlen("CDNS_PCIE_LGA_").
The state encodings looks good to me.
Regards,
Aksh Garg