Skip to contentSkip to conversation

PCI: cadence: Enable Controller to respond to received PTM Requests

PATCH In review Christian Gmeiner 2 participants 6 messages Feb 22, 2022 – Apr 28, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 PCI: cadence: Enable Controller to respond to received PTM Requests

This enables the Controller [RP] to automatically respond with Response/ResponseD messages if CDNS_PCIE_LM_TPM_CTRL_PTMRSEN and PCI_PTM_CTRL_ENABLE bits are both set.

---
 drivers/pci/controller/cadence/pcie-cadence-host.c | 10 ++++++++++
 drivers/pci/controller/cadence/pcie-cadence.h      |  4 ++++
 2 files changed, 14 insertions(+)
drivers/pci/controller/cadence/pcie-cadence-host.c +10 -0
index fb96d37a135c..940c7dd701d6 100644
@@ -123,6 +123,14 @@ static int cdns_pcie_retrain(struct cdns_pcie *pcie)
 	return ret;
 }
 
+static void cdns_pcie_host_enable_ptm_response(struct cdns_pcie *pcie)
+{
+	u32 val;
+
+	val = cdns_pcie_readl(pcie, CDNS_PCIE_LM_PTM_CTRL);
+	cdns_pcie_writel(pcie, CDNS_PCIE_LM_PTM_CTRL, val | CDNS_PCIE_LM_TPM_CTRL_PTMRSEN);
+}
+
 static int cdns_pcie_host_start_link(struct cdns_pcie_rc *rc)
 {
 	struct cdns_pcie *pcie = &rc->pcie;
@@ -501,6 +509,8 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
 	if (rc->quirk_detect_quiet_flag)
 		cdns_pcie_detect_quiet_min_delay_set(&rc->pcie);
 
+	cdns_pcie_host_enable_ptm_response(pcie);
+
 	ret = cdns_pcie_start_link(pcie);
 	if (ret) {
 		dev_err(dev, "Failed to start link\n");
drivers/pci/controller/cadence/pcie-cadence.h +4 -0
index c8a27b6290ce..1ffa8fa77a8a 100644
@@ -116,6 +116,10 @@
 #define LM_RC_BAR_CFG_APERTURE(bar, aperture)		\
 					(((aperture) - 2) << ((bar) * 8))
 
+/* PTM Control Register */
+#define CDNS_PCIE_LM_PTM_CTRL 	(CDNS_PCIE_LM_BASE + 0x0da8)
+#define CDNS_PCIE_LM_TPM_CTRL_PTMRSEN 	BIT(17)
+
 /*
  * Endpoint Function Registers (PCI configuration space for endpoint functions)
  */
Signature · 1 line
2.35.1
#1 lore raw

Hi all

Quoted 54 lines

This enables the Controller [RP] to automatically respond with Response/ResponseD messages if CDNS_PCIE_LM_TPM_CTRL_PTMRSEN and PCI_PTM_CTRL_ENABLE bits are both set.

---
 drivers/pci/controller/cadence/pcie-cadence-host.c | 10 ++++++++++
 drivers/pci/controller/cadence/pcie-cadence.h      |  4 ++++
 2 files changed, 14 insertions(+)
drivers/pci/controller/cadence/pcie-cadence-host.c +10 -0
index fb96d37a135c..940c7dd701d6 100644
@@ -123,6 +123,14 @@ static int cdns_pcie_retrain(struct cdns_pcie *pcie)
        return ret;
 }
 
+static void cdns_pcie_host_enable_ptm_response(struct cdns_pcie *pcie)
+{
+       u32 val;
+
+       val = cdns_pcie_readl(pcie, CDNS_PCIE_LM_PTM_CTRL);
+       cdns_pcie_writel(pcie, CDNS_PCIE_LM_PTM_CTRL, val | CDNS_PCIE_LM_TPM_CTRL_PTMRSEN);
+}
+
 static int cdns_pcie_host_start_link(struct cdns_pcie_rc *rc)
 {
        struct cdns_pcie *pcie = &rc->pcie;
@@ -501,6 +509,8 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
        if (rc->quirk_detect_quiet_flag)
                cdns_pcie_detect_quiet_min_delay_set(&rc->pcie);
 
+       cdns_pcie_host_enable_ptm_response(pcie);
+
        ret = cdns_pcie_start_link(pcie);
        if (ret) {
                dev_err(dev, "Failed to start link\n");
drivers/pci/controller/cadence/pcie-cadence.h +4 -1
index c8a27b6290ce..1ffa8fa77a8a 100644
@@ -116,6 +116,10 @@
 #define LM_RC_BAR_CFG_APERTURE(bar, aperture)          \
                                        (((aperture) - 2) << ((bar) * 8))
 
+/* PTM Control Register */
+#define CDNS_PCIE_LM_PTM_CTRL  (CDNS_PCIE_LM_BASE + 0x0da8)
+#define CDNS_PCIE_LM_TPM_CTRL_PTMRSEN  BIT(17)
+
 /*
  * Endpoint Function Registers (PCI configuration space for endpoint functions)
  */
--
Quoted 2 lines

2.35.1

This patch should be ready to land - or is anything missing?

Signature · 5 lines
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy
#2 lore raw

Am Do., 10. März 2022 um 13:14 Uhr schrieb Christian Gmeiner <[email protected]>:

Quoted 49 lines

Hi all

Quoted 46 lines

This enables the Controller [RP] to automatically respond with Response/ResponseD messages if CDNS_PCIE_LM_TPM_CTRL_PTMRSEN and PCI_PTM_CTRL_ENABLE bits are both set.

---
 drivers/pci/controller/cadence/pcie-cadence-host.c | 10 ++++++++++
 drivers/pci/controller/cadence/pcie-cadence.h      |  4 ++++
 2 files changed, 14 insertions(+)
drivers/pci/controller/cadence/pcie-cadence-host.c +10 -0
index fb96d37a135c..940c7dd701d6 100644
@@ -123,6 +123,14 @@ static int cdns_pcie_retrain(struct cdns_pcie *pcie)
        return ret;
 }
 
+static void cdns_pcie_host_enable_ptm_response(struct cdns_pcie *pcie)
+{
+       u32 val;
+
+       val = cdns_pcie_readl(pcie, CDNS_PCIE_LM_PTM_CTRL);
+       cdns_pcie_writel(pcie, CDNS_PCIE_LM_PTM_CTRL, val | CDNS_PCIE_LM_TPM_CTRL_PTMRSEN);
+}
+
 static int cdns_pcie_host_start_link(struct cdns_pcie_rc *rc)
 {
        struct cdns_pcie *pcie = &rc->pcie;
@@ -501,6 +509,8 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
        if (rc->quirk_detect_quiet_flag)
                cdns_pcie_detect_quiet_min_delay_set(&rc->pcie);
 
+       cdns_pcie_host_enable_ptm_response(pcie);
+
        ret = cdns_pcie_start_link(pcie);
        if (ret) {
                dev_err(dev, "Failed to start link\n");
drivers/pci/controller/cadence/pcie-cadence.h +0 -0
index c8a27b6290ce..1ffa8fa77a8a 100644
@@ -116,6 +116,10 @@
 #define LM_RC_BAR_CFG_APERTURE(bar, aperture)          \
                                        (((aperture) - 2) << ((bar) * 8))
 
Quoted 13 lines
Quoted 10 lines
drivers/pci/controller/cadence/pcie-cadence.h +4 -1
+/* PTM Control Register */
+#define CDNS_PCIE_LM_PTM_CTRL  (CDNS_PCIE_LM_BASE + 0x0da8)
+#define CDNS_PCIE_LM_TPM_CTRL_PTMRSEN  BIT(17)
+
 /*
  * Endpoint Function Registers (PCI configuration space for endpoint functions)
  */
--

2.35.1

This patch should be ready to land - or is anything missing?

Gentle ping.

Signature · 5 lines
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy
#3 lore raw
Quoted 10 lines · Christian Gmeiner

Am Do., 10. März 2022 um 13:14 Uhr schrieb Christian Gmeiner <[email protected]>:

Quoted 8 lines

Hi all

Quoted 5 lines

This enables the Controller [RP] to automatically respond with Response/ResponseD messages if CDNS_PCIE_LM_TPM_CTRL_PTMRSEN and PCI_PTM_CTRL_ENABLE bits are both set.

We're in the middle of the merge window right now, but I'm sure Lorenzo will be able to look at it after -rc1. This looks fine to me.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
---
 drivers/pci/controller/cadence/pcie-cadence-host.c | 10 ++++++++++
 drivers/pci/controller/cadence/pcie-cadence.h      |  4 ++++
 2 files changed, 14 insertions(+)
drivers/pci/controller/cadence/pcie-cadence-host.c +0 -0
index fb96d37a135c..940c7dd701d6 100644
@@ -123,6 +123,14 @@ static int cdns_pcie_retrain(struct cdns_pcie *pcie)
        return ret;
 }
 
Quoted 6 lines
Quoted 6 lines

drivers/pci/controller/cadence/pcie-cadence-host.c static int cdns_pcie_retrain(struct cdns_pcie *pcie) · line 131

Quoted 6 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +6 -0
+static void cdns_pcie_host_enable_ptm_response(struct cdns_pcie *pcie)
+{
+       u32 val;
+
+       val = cdns_pcie_readl(pcie, CDNS_PCIE_LM_PTM_CTRL);
+       cdns_pcie_writel(pcie, CDNS_PCIE_LM_PTM_CTRL, val | CDNS_PCIE_LM_TPM_CTRL_PTMRSEN);

Lorenzo will likely wrap this line to fit in 80 columns like the rest of the file, or if you rebase to v5.18-rc1 and post a v3, you could do so.

Quoted 44 lines
Quoted 22 lines
Quoted 22 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +4 -0
+}
+
 static int cdns_pcie_host_start_link(struct cdns_pcie_rc *rc)
 {
        struct cdns_pcie *pcie = &rc->pcie;
@@ -501,6 +509,8 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
        if (rc->quirk_detect_quiet_flag)
                cdns_pcie_detect_quiet_min_delay_set(&rc->pcie);
 
+       cdns_pcie_host_enable_ptm_response(pcie);
+
        ret = cdns_pcie_start_link(pcie);
        if (ret) {
                dev_err(dev, "Failed to start link\n");
drivers/pci/controller/cadence/pcie-cadence.h +0 -0
index c8a27b6290ce..1ffa8fa77a8a 100644
@@ -116,6 +116,10 @@
 #define LM_RC_BAR_CFG_APERTURE(bar, aperture)          \
                                        (((aperture) - 2) << ((bar) * 8))
 
Quoted 13 lines
Quoted 10 lines
drivers/pci/controller/cadence/pcie-cadence.h +4 -1
+/* PTM Control Register */
+#define CDNS_PCIE_LM_PTM_CTRL  (CDNS_PCIE_LM_BASE + 0x0da8)
+#define CDNS_PCIE_LM_TPM_CTRL_PTMRSEN  BIT(17)
+
 /*
  * Endpoint Function Registers (PCI configuration space for endpoint functions)
  */
--

2.35.1

This patch should be ready to land - or is anything missing?

Gentle ping.

Signature · 5 lines
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy
#4 lore raw
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This enables the Controller [RP] to automatically respond with Response/ResponseD messages if CDNS_PCIE_LM_TPM_CTRL_PTMRSEN and PCI_PTM_CTRL_ENABLE bits are both set.

We're in the middle of the merge window right now, but I'm sure Lorenzo will be able to look at it after -rc1. This looks fine to me.

Another gentle ping :(

Signature · 5 lines
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy
#5 lore raw
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This enables the Controller [RP] to automatically respond with Response/ResponseD messages if CDNS_PCIE_LM_TPM_CTRL_PTMRSEN and PCI_PTM_CTRL_ENABLE bits are both set.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

We're in the middle of the merge window right now, but I'm sure Lorenzo will be able to look at it after -rc1. This looks fine to me.

Another gentle ping :(

Ping..

Signature · 5 lines
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy