2022-09-05 03:32:04

by Richard Zhu

[permalink] [raw]
Subject: [PATCH v3] phy: freescale: imx8m-pcie: Fix the wrong order of phy_init() and phy_power_on()

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.

Fixes: 1aa97b002258 ("phy: freescale: pcie: Initialize the imx8 pcie standalone phy driver")
Signed-off-by: Richard Zhu <[email protected]>
Tested-by: Alexander Stein <[email protected]>
Acked-by: Vinod Koul <[email protected]>
---
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


2022-09-29 09:05:09

by Lorenzo Pieralisi

[permalink] [raw]
Subject: Re: [PATCH v3] phy: freescale: imx8m-pcie: Fix the wrong order of phy_init() and phy_power_on()

On Mon, Sep 05, 2022 at 10:23:03AM +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.
>
> Fixes: 1aa97b002258 ("phy: freescale: pcie: Initialize the imx8 pcie standalone phy driver")
> Signed-off-by: Richard Zhu <[email protected]>
> Tested-by: Alexander Stein <[email protected]>
> Acked-by: Vinod Koul <[email protected]>
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 6 +++---
> drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 8 ++++----
> 2 files changed, 7 insertions(+), 7 deletions(-)

Who is picking this up ? I believe this is supposed to
go via the PHY tree, so:

Acked-by: Lorenzo Pieralisi <[email protected]>

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

2022-09-29 10:52:56

by Lorenzo Pieralisi

[permalink] [raw]
Subject: Re: [PATCH v3] phy: freescale: imx8m-pcie: Fix the wrong order of phy_init() and phy_power_on()

On Mon, 5 Sep 2022 10:23:03 +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.
>
>

Applied to pci/dwc, thanks!

[1/1] phy: freescale: imx8m-pcie: Fix the wrong order of phy_init() and phy_power_on()
https://git.kernel.org/lpieralisi/pci/c/2810b99c95b1

Thanks,
Lorenzo