linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Hongxing Zhu <hongxing.zhu@nxp.com>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>,
	"vkoul@kernel.org" <vkoul@kernel.org>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"l.stach@pengutronix.de" <l.stach@pengutronix.de>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"lorenzo.pieralisi@arm.com" <lorenzo.pieralisi@arm.com>,
	"robh@kernel.org" <robh@kernel.org>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"alexander.stein@ew.tq-group.com"
	<alexander.stein@ew.tq-group.com>,
	"marex@denx.de" <marex@denx.de>,
	"richard.leitner@linux.dev" <richard.leitner@linux.dev>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: RE: [PATCH v10 3/4] phy: freescale: imx8m-pcie: Refine i.MX8MM PCIe PHY driver
Date: Mon, 3 Oct 2022 05:14:56 +0000	[thread overview]
Message-ID: <AS8PR04MB86764711BAD58E47AEAD6D738C5B9@AS8PR04MB8676.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <0017a1b1-f932-7bb3-7d00-a139bd4cc98d@pengutronix.de>

> -----Original Message-----
> From: Ahmad Fatoum <a.fatoum@pengutronix.de>
> Sent: 2022年9月30日 16:29
> To: Hongxing Zhu <hongxing.zhu@nxp.com>; vkoul@kernel.org;
> p.zabel@pengutronix.de; l.stach@pengutronix.de; bhelgaas@google.com;
> lorenzo.pieralisi@arm.com; robh@kernel.org; shawnguo@kernel.org;
> alexander.stein@ew.tq-group.com; marex@denx.de; richard.leitner@linux.dev
> Cc: devicetree@vger.kernel.org; linux-pci@vger.kernel.org;
> linux-kernel@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>;
> kernel@pengutronix.de; linux-phy@lists.infradead.org;
> linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH v10 3/4] phy: freescale: imx8m-pcie: Refine i.MX8MM
> PCIe PHY driver
> 
> On 29.09.22 09:37, Richard Zhu wrote:
> > To make it more flexible and easy to expand. Refine i.MX8MM PCIe PHY
> > driver.
> > - Use gpr compatible string to avoid the codes duplications when add
> >   another platform PCIe PHY support.
> > - Re-orange the codes to let it more flexible and easy to expand.
> 
> Re-arrange
Sorry for the spell mistake. Thanks for your review comments.

> 
> > No functions changes basicly.
> 
> No functional change.
Got that, thanks.
> 
> >
> > Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > Tested-by: Marek Vasut <marex@denx.de>
> > Tested-by: Richard Leitner <richard.leitner@skidata.com>
> > Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> >  drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 106
> > +++++++++++++--------
> >  1 file changed, 66 insertions(+), 40 deletions(-)
> >
> > diff --git a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
> > b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
> > index 2377ed307b53..59b46a4ae069 100644
> > --- a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
> > +++ b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
> > @@ -11,6 +11,7 @@
> >  #include <linux/mfd/syscon.h>
> >  #include <linux/mfd/syscon/imx7-iomuxc-gpr.h>
> >  #include <linux/module.h>
> > +#include <linux/of_device.h>
> >  #include <linux/phy/phy.h>
> >  #include <linux/platform_device.h>
> >  #include <linux/regmap.h>
> > @@ -45,6 +46,15 @@
> >  #define IMX8MM_GPR_PCIE_SSC_EN		BIT(16)
> >  #define IMX8MM_GPR_PCIE_AUX_EN_OVERRIDE	BIT(9)
> >
> > +enum imx8_pcie_phy_type {
> > +	IMX8MM,
> > +};
> > +
> > +struct imx8_pcie_phy_drvdata {
> > +	enum		imx8_pcie_phy_type variant;
> 
> Better do indentation on the member name.
Got that, would make them indent later thanks.
> 
> > +	const char	*gpr;
> > +};
> > +
> >  struct imx8_pcie_phy {
> >  	void __iomem		*base;
> >  	struct clk		*clk;
> > @@ -55,6 +65,7 @@ struct imx8_pcie_phy {
> >  	u32			tx_deemph_gen1;
> >  	u32			tx_deemph_gen2;
> >  	bool			clkreq_unused;
> > +	const struct imx8_pcie_phy_drvdata	*drvdata;
> >  };
> >
> >  static int imx8_pcie_phy_init(struct phy *phy) @@ -66,31 +77,17 @@
> > static int imx8_pcie_phy_init(struct phy *phy)
> >  	reset_control_assert(imx8_phy->reset);
> >
> >  	pad_mode = imx8_phy->refclk_pad_mode;
> > -	/* Set AUX_EN_OVERRIDE 1'b0, when the CLKREQ# isn't hooked */
> > -	regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14,
> > -			   IMX8MM_GPR_PCIE_AUX_EN_OVERRIDE,
> > -			   imx8_phy->clkreq_unused ?
> > -			   0 : IMX8MM_GPR_PCIE_AUX_EN_OVERRIDE);
> > -	regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14,
> > -			   IMX8MM_GPR_PCIE_AUX_EN,
> > -			   IMX8MM_GPR_PCIE_AUX_EN);
> > -	regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14,
> > -			   IMX8MM_GPR_PCIE_POWER_OFF, 0);
> > -	regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14,
> > -			   IMX8MM_GPR_PCIE_SSC_EN, 0);
> > -
> > -	regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14,
> > -			   IMX8MM_GPR_PCIE_REF_CLK_SEL,
> > -			   pad_mode == IMX8_PCIE_REFCLK_PAD_INPUT ?
> > -			   IMX8MM_GPR_PCIE_REF_CLK_EXT :
> > -			   IMX8MM_GPR_PCIE_REF_CLK_PLL);
> > -	usleep_range(100, 200);
> > -
> > -	/* Do the PHY common block reset */
> > -	regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14,
> > -			   IMX8MM_GPR_PCIE_CMN_RST,
> > -			   IMX8MM_GPR_PCIE_CMN_RST);
> > -	usleep_range(200, 500);
> > +	switch (imx8_phy->drvdata->variant) {
> > +	case IMX8MM:
> > +		/* Tune PHY de-emphasis setting to pass PCIe compliance. */
> > +		if (imx8_phy->tx_deemph_gen1)
> > +			writel(imx8_phy->tx_deemph_gen1,
> > +			       imx8_phy->base + PCIE_PHY_TRSV_REG5);
> > +		if (imx8_phy->tx_deemph_gen2)
> > +			writel(imx8_phy->tx_deemph_gen2,
> > +			       imx8_phy->base + PCIE_PHY_TRSV_REG6);
> > +		break;
> > +	}
> 
> If you say no functional change intended, I'd expect that register writes happen
> in the same sequence. It might be ok, that you do this tuning here, but I think
> it warrants a mention in the commit message why it's ok.
> 
> 
> Looks good otherwise. With nitpicks addressed:
> 
> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> 
Got that, thanks a lot.

Best Regards
Richard Zhu
> 
> --
> Pengutronix e.K.                           |
> |
> Steuerwalder Str. 21                       |
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.pe
> ngutronix.de%2F&amp;data=05%7C01%7Chongxing.zhu%40nxp.com%7C3f75
> 643ad03b406ddfbf08daa2bdd804%7C686ea1d3bc2b4c6fa92cd99c5c301635
> %7C0%7C0%7C638001233500315244%7CUnknown%7CTWFpbGZsb3d8eyJW
> IjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3
> 000%7C%7C%7C&amp;sdata=6NPsGMBN8culT%2BjIWtay0qT0o4L66lnmOtXI
> 4fo7z0M%3D&amp;reserved=0  |
> 31137 Hildesheim, Germany                  | Phone:
> +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:
> +49-5121-206917-5555 |
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-10-03  5:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29  8:36 [PATCH v10 0/4] Add the iMX8MP PCIe support Richard Zhu
2022-09-29  8:36 ` [PATCH v10 1/4] dt-binding: phy: Add i.MX8MP PCIe PHY binding Richard Zhu
2022-09-29  8:37 ` [PATCH v10 2/4] phy: freescale: imx8m-pcie: Refine register definitions Richard Zhu
2022-09-29  8:37 ` [PATCH v10 3/4] phy: freescale: imx8m-pcie: Refine i.MX8MM PCIe PHY driver Richard Zhu
2022-09-30  8:28   ` Ahmad Fatoum
2022-10-03  5:14     ` Hongxing Zhu [this message]
2022-09-29  8:37 ` [PATCH v10 4/4] phy: freescale: imx8m-pcie: Add i.MX8MP PCIe PHY support Richard Zhu
2022-09-30  8:46   ` Ahmad Fatoum
2022-10-03  5:15     ` Hongxing 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=AS8PR04MB86764711BAD58E47AEAD6D738C5B9@AS8PR04MB8676.eurprd04.prod.outlook.com \
    --to=hongxing.zhu@nxp.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@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=linux-phy@lists.infradead.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marex@denx.de \
    --cc=p.zabel@pengutronix.de \
    --cc=richard.leitner@linux.dev \
    --cc=robh@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=vkoul@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).