From: Lucas Stach <l.stach@pengutronix.de>
To: Richard Zhu <hongxing.zhu@nxp.com>,
bhelgaas@google.com, lorenzo.pieralisi@arm.com
Cc: linux-pci@vger.kernel.org, linux-imx@nxp.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH 3/3] PCI: imx: add compliance tests mode to enable measure signal quality
Date: Wed, 08 Sep 2021 10:34:23 +0200 [thread overview]
Message-ID: <bd4ead76c27afbb3d089bc355d8d3f62b4ad269e.camel@pengutronix.de> (raw)
In-Reply-To: <1631084366-24785-3-git-send-email-hongxing.zhu@nxp.com>
Hi Richard,
Am Mittwoch, dem 08.09.2021 um 14:59 +0800 schrieb Richard Zhu:
> Refer to the system board signal Quality of PCIe archiecture PHY test
> specification. Signal quality tests can be executed with devices in the
> polling.compliance state.
>
> To let the device support polling.compliance stat, the clocks and
> powers shouldn't be turned off during the compliance tests although
> the PHY link might be down.
> Add the i.MX PCIe compliance tests mode enable option to keep the and
> powers on, and finish the driver probe without error return.
>
> Use the "pcie_cmp_enabled=yes" in kernel command line to enable the
> compliance tests mode.
Adding "random" kernel command line options isn't going to fly. If at
all, this should be a module_param so it gets properly namespaced. Also
this needs a more descriptive name, right now this is abbreviating the
one thing that would tell a user what this is about: compliance
testing.
>
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 41 +++++++++++++++++++++------
> 1 file changed, 33 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 129928e42f84..3aef0e86f1c2 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -143,6 +143,7 @@ struct imx6_pcie {
> #define PHY_RX_OVRD_IN_LO_RX_DATA_EN BIT(5)
> #define PHY_RX_OVRD_IN_LO_RX_PLL_EN BIT(3)
>
> +static int imx6_pcie_cmp_enabled;
> static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie);
> static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie);
>
> @@ -748,10 +749,12 @@ 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.
> */
> - 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);
> + if (!imx6_pcie_cmp_enabled) {
> + 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);
> + }
>
> /* Start LTSSM. */
> imx6_pcie_ltssm_enable(dev);
> @@ -812,9 +815,12 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)
> dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0),
> dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1));
> imx6_pcie_reset_phy(imx6_pcie);
> - imx6_pcie_clk_disable(imx6_pcie);
> - if (imx6_pcie->vpcie && regulator_is_enabled(imx6_pcie->vpcie) > 0)
> - regulator_disable(imx6_pcie->vpcie);
> + if (!imx6_pcie_cmp_enabled) {
> + imx6_pcie_clk_disable(imx6_pcie);
> + if (imx6_pcie->vpcie
> + && regulator_is_enabled(imx6_pcie->vpcie) > 0)
> + regulator_disable(imx6_pcie->vpcie);
> + }
> return ret;
> }
>
> @@ -1010,6 +1016,17 @@ static const struct dev_pm_ops imx6_pcie_pm_ops = {
> imx6_pcie_resume_noirq)
> };
>
> +static int __init imx6_pcie_compliance_test_enable(char *str)
> +{
> + if (!strcmp(str, "yes")) {
> + pr_info("Enable the i.MX PCIe TX/CLK compliance tests mode.\n");
> + imx6_pcie_cmp_enabled = 1;
> + }
> + return 1;
> +}
> +
> +__setup("pcie_cmp_enabled=", imx6_pcie_compliance_test_enable);
> +
> static int imx6_pcie_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -1187,8 +1204,16 @@ static int imx6_pcie_probe(struct platform_device *pdev)
> return ret;
>
> ret = dw_pcie_host_init(&pci->pp);
> - if (ret < 0)
> + if (ret < 0) {
> + if (imx6_pcie_cmp_enabled) {
> + /* The PCIE clocks and powers wouldn't be turned off */
> + dev_info(dev, "To do the compliance tests.\n");
This needs a better message, like "Driver loaded with compliance test
mode enabled" and the message needs to be shown unconditionally, not
only when the host init fails. We don't want to have the user track
down weird issues when the compliance test option was specified by
accident and the link is almost working due to this.
Regards,
Lucas
> + ret = 0;
> + } else {
> + dev_err(dev, "Unable to add pcie port.\n");
> + }
> return ret;
> + }
>
> if (pci_msi_enabled()) {
> u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-09-08 8:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-08 6:59 [PATCH 1/3] PCI: imx: encapsulate the clock enable into one standalone function Richard Zhu
2021-09-08 6:59 ` [PATCH 2/3] PCI: imx: add err check to host init and fix regulator dump Richard Zhu
2021-09-08 8:42 ` Lucas Stach
2021-09-08 8:59 ` Richard Zhu
2021-09-08 6:59 ` [PATCH 3/3] PCI: imx: add compliance tests mode to enable measure signal quality Richard Zhu
2021-09-08 8:34 ` Lucas Stach [this message]
2021-09-08 8:46 ` Richard Zhu
2021-09-08 8:47 ` [PATCH 1/3] PCI: imx: encapsulate the clock enable into one standalone function Lucas Stach
2021-09-08 9:02 ` Richard Zhu
2021-09-08 13:41 ` kernel test robot
2021-09-08 15:12 ` Bjorn Helgaas
2021-09-09 2:26 ` Richard Zhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bd4ead76c27afbb3d089bc355d8d3f62b4ad269e.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=bhelgaas@google.com \
--cc=hongxing.zhu@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox