Disable PTM for endpoint mode
v2 cover Disable PTM for endpoint mode
This patch series contains patches to disable PTM for endpoint mode as the PCIe compliance tool requires the PTM be disabled for the endpoint mode.
V2:
* Addressed review comments from Jingoo Han
Vidya Sagar (2):
PCI: Add PCI_PTM_CAP_RES macro
PCI: designware-ep: Disable PTM capabilities for EP mode
.../pci/controller/dwc/pcie-designware-ep.c | 18 ++++++++++++++++++ include/uapi/linux/pci_regs.h | 1 + 2 files changed, 19 insertions(+)
Signature · 1 line
2.17.1
PATCH v2 1/2 PCI: Add PCI_PTM_CAP_RES macro
Add macro defining Responder capable bit in Precision Time Measurement capability register.
---
V2:
* Added "Reviewed-by: Jingoo Han <[email protected]>"
include/uapi/linux/pci_regs.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/pci_regs.h +1 -0
@@ -1058,6 +1058,7 @@/* Precision Time Measurement */ #define PCI_PTM_CAP 0x04/* PTM Capability */ #define PCI_PTM_CAP_REQ 0x00000001/* Requester capable */ +#define PCI_PTM_CAP_RES 0x00000002/* Responder capable */ #define PCI_PTM_CAP_ROOT 0x00000004/* Root capable */ #define PCI_PTM_GRANULARITY_MASK 0x0000FF00/* Clock granularity */ #define PCI_PTM_CTRL 0x08/* PTM Control */
Signature · 1 line
2.17.1
Re: [PATCH V2 1/2] PCI: Add PCI_PTM_CAP_RES macro
Quoted 5 lines · Vidya Sagar
Add macro defining Responder capable bit in Precision Time Measurement capability register.
Signed-off-by Vidya Sagar <[email protected]>Reviewed-by Jingoo Han <[email protected]>
Quoted 22 lines
---
V2:
* Added "Reviewed-by: Jingoo Han <[email protected]>"include/uapi/linux/pci_regs.h | 1 + 1 file changed, 1 insertion(+)include/uapi/linux/pci_regs.h +1
-0@@ -1058,6 +1058,7 @@/* Precision Time Measurement */ #define PCI_PTM_CAP 0x04/* PTM Capability */ #define PCI_PTM_CAP_REQ 0x00000001/* Requester capable */ +#define PCI_PTM_CAP_RES 0x00000002/* Responder capable */ #define PCI_PTM_CAP_ROOT 0x00000004/* Root capable */ #define PCI_PTM_GRANULARITY_MASK 0x0000FF00/* Clock granularity */ #define PCI_PTM_CTRL 0x08/* PTM Control */ Signature · 1 line
2.17.1
PATCH v2 2/2 PCI: designware-ep: Disable PTM capabilities for EP mode
In reply to Vidya SagarDual mode DesignWare PCIe IP has PTM capability enabled (if supported) even in the EP mode. The PCIe compliance for the EP mode expects PTM capabilities (ROOT_CAPABLE, RES_CAPABLE, CLK_GRAN) be disabled. Hence disable PTM for the EP mode.
---
V2:
* Addressed review comment from Jingoo Han
* Added "Reviewed-by: Jingoo Han <[email protected]>"
.../pci/controller/dwc/pcie-designware-ep.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/pci/controller/dwc/pcie-designware-ep.c +18 -0
@@ -638,6 +638,7 @@ static int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep)struct dw_pcie_ep_func *ep_func;struct device *dev = pci->dev;struct pci_epc *epc = ep->epc; +unsigned int ptm_cap_base;unsigned int offset;unsigned int nbars;u8 hdr_type;
@@ -690,6 +691,7 @@ static int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep) } offset =dw_pcie_ep_find_ext_capability (pci,PCI_EXT_CAP_ID_REBAR ); + ptm_cap_base =dw_pcie_ep_find_ext_capability (pci,PCI_EXT_CAP_ID_PTM );dw_pcie_dbi_ro_wr_en (pci);
@@ -702,6 +704,22 @@ static int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep)dw_pcie_writel_dbi (pci, offset +PCI_REBAR_CAP ,0x0 ); } +/* +* PTM responder capability can be disabled only after disabling +* PTM root capability. +*/ +if (ptm_cap_base) { +dw_pcie_dbi_ro_wr_en (pci); + reg =dw_pcie_readl_dbi (pci, ptm_cap_base +PCI_PTM_CAP ); + reg &= ~PCI_PTM_CAP_ROOT ; +dw_pcie_writel_dbi (pci, ptm_cap_base +PCI_PTM_CAP , reg); + + reg =dw_pcie_readl_dbi (pci, ptm_cap_base +PCI_PTM_CAP ); + reg &= ~(PCI_PTM_CAP_RES |PCI_PTM_GRANULARITY_MASK ); +dw_pcie_writel_dbi (pci, ptm_cap_base +PCI_PTM_CAP , reg); +dw_pcie_dbi_ro_wr_dis (pci); + } +dw_pcie_setup (pci);dw_pcie_dbi_ro_wr_dis (pci);
Signature · 1 line
2.17.1
Hi Lorenzo,
Do you have any further comments on this series?
Thanks,
Vidya Sagar
Quoted 15 lines · Vidya Sagar
This patch series contains patches to disable PTM for endpoint mode as the PCIe compliance tool requires the PTM be disabled for the endpoint mode.
V2:
* Addressed review comments from Jingoo HanVidya Sagar (2):
PCI: AddPCI_PTM_CAP_RESmacro
PCI: designware-ep: Disable PTM capabilities for EP mode.../pci/controller/dwc/pcie-designware-ep.c | 18 ++++++++++++++++++ include/uapi/linux/pci_regs.h | 1 + 2 files changed, 19 insertions(+)