forked from mirrors/linux
		
	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.
Link: https://lore.kernel.org/r/1662344583-18874-1-git-send-email-hongxing.zhu@nxp.com
Fixes: 1aa97b0022 ("phy: freescale: pcie: Initialize the imx8 pcie standalone phy driver")
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Acked-by: Vinod Koul <vkoul@kernel.org>
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
			
			
This commit is contained in:
		
							parent
							
								
									3db1e531e4
								
							
						
					
					
						commit
						cbcf8722b5
					
				
					 2 changed files with 7 additions and 7 deletions
				
			
		| 
						 | 
					@ -945,7 +945,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (imx6_pcie->phy) {
 | 
						if (imx6_pcie->phy) {
 | 
				
			||||||
		ret = phy_power_on(imx6_pcie->phy);
 | 
							ret = phy_init(imx6_pcie->phy);
 | 
				
			||||||
		if (ret) {
 | 
							if (ret) {
 | 
				
			||||||
			dev_err(dev, "pcie PHY power up failed\n");
 | 
								dev_err(dev, "pcie PHY power up failed\n");
 | 
				
			||||||
			goto err_clk_disable;
 | 
								goto err_clk_disable;
 | 
				
			||||||
| 
						 | 
					@ -959,7 +959,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (imx6_pcie->phy) {
 | 
						if (imx6_pcie->phy) {
 | 
				
			||||||
		ret = phy_init(imx6_pcie->phy);
 | 
							ret = phy_power_on(imx6_pcie->phy);
 | 
				
			||||||
		if (ret) {
 | 
							if (ret) {
 | 
				
			||||||
			dev_err(dev, "waiting for PHY ready timeout!\n");
 | 
								dev_err(dev, "waiting for PHY ready timeout!\n");
 | 
				
			||||||
			goto err_phy_off;
 | 
								goto err_phy_off;
 | 
				
			||||||
| 
						 | 
					@ -971,7 +971,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
err_phy_off:
 | 
					err_phy_off:
 | 
				
			||||||
	if (imx6_pcie->phy)
 | 
						if (imx6_pcie->phy)
 | 
				
			||||||
		phy_power_off(imx6_pcie->phy);
 | 
							phy_exit(imx6_pcie->phy);
 | 
				
			||||||
err_clk_disable:
 | 
					err_clk_disable:
 | 
				
			||||||
	imx6_pcie_clk_disable(imx6_pcie);
 | 
						imx6_pcie_clk_disable(imx6_pcie);
 | 
				
			||||||
err_reg_disable:
 | 
					err_reg_disable:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@ struct imx8_pcie_phy {
 | 
				
			||||||
	bool			clkreq_unused;
 | 
						bool			clkreq_unused;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int imx8_pcie_phy_init(struct phy *phy)
 | 
					static int imx8_pcie_phy_power_on(struct phy *phy)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
	u32 val, pad_mode;
 | 
						u32 val, pad_mode;
 | 
				
			||||||
| 
						 | 
					@ -137,14 +137,14 @@ static int imx8_pcie_phy_init(struct phy *phy)
 | 
				
			||||||
	return ret;
 | 
						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);
 | 
						struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return clk_prepare_enable(imx8_phy->clk);
 | 
						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);
 | 
						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 = {
 | 
					static const struct phy_ops imx8_pcie_phy_ops = {
 | 
				
			||||||
	.init		= imx8_pcie_phy_init,
 | 
						.init		= imx8_pcie_phy_init,
 | 
				
			||||||
 | 
						.exit		= imx8_pcie_phy_exit,
 | 
				
			||||||
	.power_on	= imx8_pcie_phy_power_on,
 | 
						.power_on	= imx8_pcie_phy_power_on,
 | 
				
			||||||
	.power_off	= imx8_pcie_phy_power_off,
 | 
					 | 
				
			||||||
	.owner		= THIS_MODULE,
 | 
						.owner		= THIS_MODULE,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue