Commit ebe8b48b authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Jakub Kicinski
Browse files

phy: qcom-sgmii-eth: relax order of .power_on() vs .set_mode*()



Allow any order of the .power_on() and .set_mode*() methods as per the
recent discussion. This means phy_power_on() with this SerDes will now
restore the previous setup without requiring a subsequent
phy_set_mode*() call.

Tested-by: default avatarMohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
Acked-by: default avatarVinod Koul <vkoul@kernel.org>
Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1vxS4P-0000000BQXs-0vGB@rmk-PC.armlinux.org.uk


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f82210ce
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -271,8 +271,17 @@ static int qcom_dwmac_sgmii_phy_calibrate(struct phy *phy)
static int qcom_dwmac_sgmii_phy_power_on(struct phy *phy)
{
	struct qcom_dwmac_sgmii_phy_data *data = phy_get_drvdata(phy);
	int ret;

	ret = clk_prepare_enable(data->refclk);
	if (ret < 0)
		return ret;

	ret = qcom_dwmac_sgmii_phy_calibrate(phy);
	if (ret < 0)
		clk_disable_unprepare(data->refclk);

	return clk_prepare_enable(data->refclk);
	return ret;
}

static int qcom_dwmac_sgmii_phy_power_off(struct phy *phy)
@@ -318,6 +327,9 @@ static int qcom_dwmac_sgmii_phy_set_mode(struct phy *phy, enum phy_mode mode,
	if (submode != data->interface)
		data->interface = submode;

	if (phy->power_count == 0)
		return 0;

	return qcom_dwmac_sgmii_phy_calibrate(phy);
}