linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] phy: freescale: imx8m-pcie: Fix the wrong order of phy_init() and phy_power_on()
@ 2022-08-31  6:55 Richard Zhu
  2022-09-02 17:04 ` Bjorn Helgaas
  2022-09-02 17:49 ` Vinod Koul
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Zhu @ 2022-08-31  6:55 UTC (permalink / raw)
  To: a.fatoum, l.stach, bhelgaas, lorenzo.pieralisi, vkoul,
	marcel.ziswiler, kishon
  Cc: hongxing.zhu, linux-phy, linux-pci, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Refer to phy_core driver, phy_init() must be called before phy_power_on().
Fix the wrong order of phy_init() and phy_power_on() here.
Squash the changes into one patch to avoid the possible bi-section hole.

Fixes: 1aa97b002258 ("phy: freescale: pcie: Initialize the imx8 pcie standalone phy driver")
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 drivers/pci/controller/dwc/pci-imx6.c      | 6 +++---
 drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 6e5debdbc55b..b5f0de455a7b 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -935,7 +935,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp)
 	}
 
 	if (imx6_pcie->phy) {
-		ret = phy_power_on(imx6_pcie->phy);
+		ret = phy_init(imx6_pcie->phy);
 		if (ret) {
 			dev_err(dev, "pcie PHY power up failed\n");
 			goto err_clk_disable;
@@ -949,7 +949,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp)
 	}
 
 	if (imx6_pcie->phy) {
-		ret = phy_init(imx6_pcie->phy);
+		ret = phy_power_on(imx6_pcie->phy);
 		if (ret) {
 			dev_err(dev, "waiting for PHY ready timeout!\n");
 			goto err_phy_off;
@@ -961,7 +961,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp)
 
 err_phy_off:
 	if (imx6_pcie->phy)
-		phy_power_off(imx6_pcie->phy);
+		phy_exit(imx6_pcie->phy);
 err_clk_disable:
 	imx6_pcie_clk_disable(imx6_pcie);
 err_reg_disable:
diff --git a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
index ad7d2edfc414..c93286483b42 100644
--- a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
+++ b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
@@ -59,7 +59,7 @@ struct imx8_pcie_phy {
 	bool			clkreq_unused;
 };
 
-static int imx8_pcie_phy_init(struct phy *phy)
+static int imx8_pcie_phy_power_on(struct phy *phy)
 {
 	int ret;
 	u32 val, pad_mode;
@@ -137,14 +137,14 @@ static int imx8_pcie_phy_init(struct phy *phy)
 	return ret;
 }
 
-static int imx8_pcie_phy_power_on(struct phy *phy)
+static int imx8_pcie_phy_init(struct phy *phy)
 {
 	struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy);
 
 	return clk_prepare_enable(imx8_phy->clk);
 }
 
-static int imx8_pcie_phy_power_off(struct phy *phy)
+static int imx8_pcie_phy_exit(struct phy *phy)
 {
 	struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy);
 
@@ -155,8 +155,8 @@ static int imx8_pcie_phy_power_off(struct phy *phy)
 
 static const struct phy_ops imx8_pcie_phy_ops = {
 	.init		= imx8_pcie_phy_init,
+	.exit		= imx8_pcie_phy_exit,
 	.power_on	= imx8_pcie_phy_power_on,
-	.power_off	= imx8_pcie_phy_power_off,
 	.owner		= THIS_MODULE,
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] phy: freescale: imx8m-pcie: Fix the wrong order of phy_init() and phy_power_on()
  2022-08-31  6:55 [PATCH v2] phy: freescale: imx8m-pcie: Fix the wrong order of phy_init() and phy_power_on() Richard Zhu
@ 2022-09-02 17:04 ` Bjorn Helgaas
  2022-09-05  2:14   ` Hongxing Zhu
  2022-09-02 17:49 ` Vinod Koul
  1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2022-09-02 17:04 UTC (permalink / raw)
  To: Richard Zhu
  Cc: a.fatoum, l.stach, bhelgaas, lorenzo.pieralisi, vkoul,
	marcel.ziswiler, kishon, linux-phy, linux-pci, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

On Wed, Aug 31, 2022 at 02:55:56PM +0800, Richard Zhu wrote:
> Refer to phy_core driver, phy_init() must be called before phy_power_on().
> Fix the wrong order of phy_init() and phy_power_on() here.

> Squash the changes into one patch to avoid the possible bi-section hole.

Avoiding bisection holes goes without saying, so I don't think we need
to even mention it ;)

> Fixes: 1aa97b002258 ("phy: freescale: pcie: Initialize the imx8 pcie standalone phy driver")
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>

I propose merging this via PCI, since I suspect pci-imx6.c is more
active than phy-fsl-imx8m-pcie.c.

Vinod, if you agree, I'm sure Lorenzo will look for your ack.

> ---
>  drivers/pci/controller/dwc/pci-imx6.c      | 6 +++---
>  drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 8 ++++----
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 6e5debdbc55b..b5f0de455a7b 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -935,7 +935,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp)
>  	}
>  
>  	if (imx6_pcie->phy) {
> -		ret = phy_power_on(imx6_pcie->phy);
> +		ret = phy_init(imx6_pcie->phy);
>  		if (ret) {
>  			dev_err(dev, "pcie PHY power up failed\n");
>  			goto err_clk_disable;
> @@ -949,7 +949,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp)
>  	}
>  
>  	if (imx6_pcie->phy) {
> -		ret = phy_init(imx6_pcie->phy);
> +		ret = phy_power_on(imx6_pcie->phy);
>  		if (ret) {
>  			dev_err(dev, "waiting for PHY ready timeout!\n");
>  			goto err_phy_off;
> @@ -961,7 +961,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp)
>  
>  err_phy_off:
>  	if (imx6_pcie->phy)
> -		phy_power_off(imx6_pcie->phy);
> +		phy_exit(imx6_pcie->phy);
>  err_clk_disable:
>  	imx6_pcie_clk_disable(imx6_pcie);
>  err_reg_disable:
> diff --git a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
> index ad7d2edfc414..c93286483b42 100644
> --- a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
> +++ b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
> @@ -59,7 +59,7 @@ struct imx8_pcie_phy {
>  	bool			clkreq_unused;
>  };
>  
> -static int imx8_pcie_phy_init(struct phy *phy)
> +static int imx8_pcie_phy_power_on(struct phy *phy)
>  {
>  	int ret;
>  	u32 val, pad_mode;
> @@ -137,14 +137,14 @@ static int imx8_pcie_phy_init(struct phy *phy)
>  	return ret;
>  }
>  
> -static int imx8_pcie_phy_power_on(struct phy *phy)
> +static int imx8_pcie_phy_init(struct phy *phy)
>  {
>  	struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy);
>  
>  	return clk_prepare_enable(imx8_phy->clk);
>  }
>  
> -static int imx8_pcie_phy_power_off(struct phy *phy)
> +static int imx8_pcie_phy_exit(struct phy *phy)
>  {
>  	struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy);
>  
> @@ -155,8 +155,8 @@ static int imx8_pcie_phy_power_off(struct phy *phy)
>  
>  static const struct phy_ops imx8_pcie_phy_ops = {
>  	.init		= imx8_pcie_phy_init,
> +	.exit		= imx8_pcie_phy_exit,
>  	.power_on	= imx8_pcie_phy_power_on,
> -	.power_off	= imx8_pcie_phy_power_off,
>  	.owner		= THIS_MODULE,
>  };
>  
> -- 
> 2.25.1
> 
> 
> -- 
> linux-phy mailing list
> linux-phy@lists.infradead.org
> https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] phy: freescale: imx8m-pcie: Fix the wrong order of phy_init() and phy_power_on()
  2022-08-31  6:55 [PATCH v2] phy: freescale: imx8m-pcie: Fix the wrong order of phy_init() and phy_power_on() Richard Zhu
  2022-09-02 17:04 ` Bjorn Helgaas
@ 2022-09-02 17:49 ` Vinod Koul
  1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2022-09-02 17:49 UTC (permalink / raw)
  To: Richard Zhu
  Cc: a.fatoum, l.stach, bhelgaas, lorenzo.pieralisi, marcel.ziswiler,
	kishon, linux-phy, linux-pci, linux-arm-kernel, linux-kernel,
	kernel, linux-imx

On 31-08-22, 14:55, Richard Zhu wrote:
> Refer to phy_core driver, phy_init() must be called before phy_power_on().
> Fix the wrong order of phy_init() and phy_power_on() here.
> Squash the changes into one patch to avoid the possible bi-section hole.
> 
> Fixes: 1aa97b002258 ("phy: freescale: pcie: Initialize the imx8 pcie standalone phy driver")
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
>  drivers/pci/controller/dwc/pci-imx6.c      | 6 +++---
>  drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 8 ++++----

Acked-By: Vinod Koul <vkoul@kernel.org>

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v2] phy: freescale: imx8m-pcie: Fix the wrong order of phy_init() and phy_power_on()
  2022-09-02 17:04 ` Bjorn Helgaas
@ 2022-09-05  2:14   ` Hongxing Zhu
  0 siblings, 0 replies; 4+ messages in thread
From: Hongxing Zhu @ 2022-09-05  2:14 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: a.fatoum, l.stach, bhelgaas, lorenzo.pieralisi, vkoul,
	Marcel Ziswiler, kishon, linux-phy, linux-pci, linux-arm-kernel,
	linux-kernel, kernel, dl-linux-imx

> -----Original Message-----
> From: Bjorn Helgaas <helgaas@kernel.org>
> Sent: 2022年9月3日 1:05
> To: Hongxing Zhu <hongxing.zhu@nxp.com>
> Cc: a.fatoum@pengutronix.de; l.stach@pengutronix.de; bhelgaas@google.com;
> lorenzo.pieralisi@arm.com; vkoul@kernel.org; Marcel Ziswiler
> <marcel.ziswiler@toradex.com>; kishon@ti.com; linux-phy@lists.infradead.org;
> linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org; kernel@pengutronix.de; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: Re: [PATCH v2] phy: freescale: imx8m-pcie: Fix the wrong order of
> phy_init() and phy_power_on()
> 
> On Wed, Aug 31, 2022 at 02:55:56PM +0800, Richard Zhu wrote:
> > Refer to phy_core driver, phy_init() must be called before phy_power_on().
> > Fix the wrong order of phy_init() and phy_power_on() here.
> 
> > Squash the changes into one patch to avoid the possible bi-section hole.
> 
> Avoiding bisection holes goes without saying, so I don't think we need to even
> mention it ;)
Hi Bjorn:
Understood 😊. Thanks for your kindly help on this fix.
For ease of merging, I would remove that line, and re-send the v3 with Vinod's
 ACK added.

Best Regards
Richard Zhu

> 
> > Fixes: 1aa97b002258 ("phy: freescale: pcie: Initialize the imx8 pcie
> > standalone phy driver")
> > Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> > Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> 
> I propose merging this via PCI, since I suspect pci-imx6.c is more active than
> phy-fsl-imx8m-pcie.c.
> 
> Vinod, if you agree, I'm sure Lorenzo will look for your ack.
> 
> > ---
> >  drivers/pci/controller/dwc/pci-imx6.c      | 6 +++---
> >  drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 8 ++++----
> >  2 files changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pci-imx6.c
> > b/drivers/pci/controller/dwc/pci-imx6.c
> > index 6e5debdbc55b..b5f0de455a7b 100644
> > --- a/drivers/pci/controller/dwc/pci-imx6.c
> > +++ b/drivers/pci/controller/dwc/pci-imx6.c
> > @@ -935,7 +935,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp
> *pp)
> >  	}
> >
> >  	if (imx6_pcie->phy) {
> > -		ret = phy_power_on(imx6_pcie->phy);
> > +		ret = phy_init(imx6_pcie->phy);
> >  		if (ret) {
> >  			dev_err(dev, "pcie PHY power up failed\n");
> >  			goto err_clk_disable;
> > @@ -949,7 +949,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp
> *pp)
> >  	}
> >
> >  	if (imx6_pcie->phy) {
> > -		ret = phy_init(imx6_pcie->phy);
> > +		ret = phy_power_on(imx6_pcie->phy);
> >  		if (ret) {
> >  			dev_err(dev, "waiting for PHY ready timeout!\n");
> >  			goto err_phy_off;
> > @@ -961,7 +961,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp
> > *pp)
> >
> >  err_phy_off:
> >  	if (imx6_pcie->phy)
> > -		phy_power_off(imx6_pcie->phy);
> > +		phy_exit(imx6_pcie->phy);
> >  err_clk_disable:
> >  	imx6_pcie_clk_disable(imx6_pcie);
> >  err_reg_disable:
> > diff --git a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
> > b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
> > index ad7d2edfc414..c93286483b42 100644
> > --- a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
> > +++ b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c
> > @@ -59,7 +59,7 @@ struct imx8_pcie_phy {
> >  	bool			clkreq_unused;
> >  };
> >
> > -static int imx8_pcie_phy_init(struct phy *phy)
> > +static int imx8_pcie_phy_power_on(struct phy *phy)
> >  {
> >  	int ret;
> >  	u32 val, pad_mode;
> > @@ -137,14 +137,14 @@ static int imx8_pcie_phy_init(struct phy *phy)
> >  	return ret;
> >  }
> >
> > -static int imx8_pcie_phy_power_on(struct phy *phy)
> > +static int imx8_pcie_phy_init(struct phy *phy)
> >  {
> >  	struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy);
> >
> >  	return clk_prepare_enable(imx8_phy->clk);
> >  }
> >
> > -static int imx8_pcie_phy_power_off(struct phy *phy)
> > +static int imx8_pcie_phy_exit(struct phy *phy)
> >  {
> >  	struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy);
> >
> > @@ -155,8 +155,8 @@ static int imx8_pcie_phy_power_off(struct phy
> > *phy)
> >
> >  static const struct phy_ops imx8_pcie_phy_ops = {
> >  	.init		= imx8_pcie_phy_init,
> > +	.exit		= imx8_pcie_phy_exit,
> >  	.power_on	= imx8_pcie_phy_power_on,
> > -	.power_off	= imx8_pcie_phy_power_off,
> >  	.owner		= THIS_MODULE,
> >  };
> >
> > --
> > 2.25.1
> >
> >
> > --
> > linux-phy mailing list
> > linux-phy@lists.infradead.org
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> >
> s.infradead.org%2Fmailman%2Flistinfo%2Flinux-phy&amp;data=05%7C01%7C
> ho
> >
> ngxing.zhu%40nxp.com%7Cb81201c8994c4e2b871208da8d0541a1%7C686ea
> 1d3bc2b
> >
> 4c6fa92cd99c5c301635%7C0%7C0%7C637977350972030265%7CUnknown%
> 7CTWFpbGZs
> >
> b3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0
> %3D
> > %7C3000%7C%7C%7C&amp;sdata=gMUzhflQuE92NFlmAP3GBKijjv6lhQEZxu
> xuYFPfosw
> > %3D&amp;reserved=0

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-05  2:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31  6:55 [PATCH v2] phy: freescale: imx8m-pcie: Fix the wrong order of phy_init() and phy_power_on() Richard Zhu
2022-09-02 17:04 ` Bjorn Helgaas
2022-09-05  2:14   ` Hongxing Zhu
2022-09-02 17:49 ` Vinod Koul

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).