summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Zhu <hongxing.zhu@nxp.com>2023-04-20 19:51:03 +0800
committerRichard Zhu <hongxing.zhu@nxp.com>2024-10-08 11:23:40 +0800
commit9615e92c7db8fe46a3bef6155f893f1e0b1707fa (patch)
treecdf318a1a577604a34019666d6e26f44c5f4a8da
parent55206c931a10f72a3f0369d23f96e3ab82d922cd (diff)
LF-8859 PCI: imx6: Add the compliance tests enable option for compliance tests
Add the i.MX PCIe compliance tests mode support. Add "pcie_cz_enabled=yes" into kernel command line to enable the compliance tests mode for compliance tests only. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com>
-rw-r--r--drivers/pci/controller/dwc/pci-imx6.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index e3a642c131ad..90e6f14b1759 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -227,6 +227,7 @@ struct imx6_pcie {
#define CTRL2_PM_XMT_TURNOFF BIT(9)
#define STTS0_PM_LINKST_IN_L2 BIT(13)
+static int imx6_pcie_cz_enabled;
static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie)
{
WARN_ON(imx6_pcie->drvdata->variant != IMX8MQ &&
@@ -1135,12 +1136,14 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)
* started in Gen2 mode, there is a possibility the devices on the
* bus will not be detected at all. This happens with PCIe switches.
*/
- dw_pcie_dbi_ro_wr_en(pci);
- tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP);
- tmp &= ~PCI_EXP_LNKCAP_SLS;
- tmp |= PCI_EXP_LNKCAP_SLS_2_5GB;
- dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, tmp);
- dw_pcie_dbi_ro_wr_dis(pci);
+ if (!imx6_pcie_cz_enabled) {
+ dw_pcie_dbi_ro_wr_en(pci);
+ tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP);
+ tmp &= ~PCI_EXP_LNKCAP_SLS;
+ tmp |= PCI_EXP_LNKCAP_SLS_2_5GB;
+ dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, tmp);
+ dw_pcie_dbi_ro_wr_dis(pci);
+ }
/* Start LTSSM. */
imx6_pcie_ltssm_enable(dev);
@@ -1485,6 +1488,11 @@ static void imx6_pcie_host_exit(struct dw_pcie_rp *pp)
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci);
+ if (imx6_pcie_cz_enabled) {
+ pr_info("PCIe compliance tests mode is enabled.\n");
+ return;
+ }
+
if (imx6_pcie->phy) {
if (phy_power_off(imx6_pcie->phy))
dev_err(pci->dev, "unable to power off PHY\n");
@@ -1838,6 +1846,17 @@ irqreturn_t host_wake_irq_handler(int irq, void *priv)
return IRQ_HANDLED;
}
+static int __init imx6_pcie_compliance_test_enable(char *str)
+{
+ if (!strcmp(str, "yes")) {
+ pr_info("Enable the i.MX PCIe compliance tests mode.\n");
+ imx6_pcie_cz_enabled = 1;
+ }
+ return 1;
+}
+
+__setup("pcie_cz_enabled=", imx6_pcie_compliance_test_enable);
+
static int imx6_pcie_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;