summary refs log tree commit diff
path: root/drivers/phy/cadence
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@nxp.com>2020-05-13 20:56:05 +0800
committerVinod Koul <vkoul@kernel.org>2020-05-15 13:20:21 +0530
commit11c82afac8d19eb0364521ebfc3b76cb6863dcb8 (patch)
treec746128950492940eebe3ff179d3a43d4fb9da4a /drivers/phy/cadence
parentf004be596c28f90fbcc50e1b0f4b29ebab56bfca (diff)
downloadlinux-11c82afac8d19eb0364521ebfc3b76cb6863dcb8.tar.gz
phy: phy-cadence-salvo: add phy .init API
The .init is used for one-time PHY's initialization, and .power_on
is called many times during the device lifecycle.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Link: https://lore.kernel.org/r/20200513125605.5545-1-peter.chen@nxp.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/phy/cadence')
-rw-r--r--drivers/phy/cadence/phy-cadence-salvo.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/phy/cadence/phy-cadence-salvo.c b/drivers/phy/cadence/phy-cadence-salvo.c
index 292e9b4dd41a..1ecbb964cd21 100644
--- a/drivers/phy/cadence/phy-cadence-salvo.c
+++ b/drivers/phy/cadence/phy-cadence-salvo.c
@@ -205,7 +205,7 @@ static struct cdns_reg_pairs cdns_nxp_sequence_pair[] = {
 	{0x0090, TB_ADDR_XCVR_DIAG_LANE_FCM_EN_MGN_TMR},
 };
 
-static int cdns_salvo_phy_power_on(struct phy *phy)
+static int cdns_salvo_phy_init(struct phy *phy)
 {
 	struct cdns_salvo_phy *salvo_phy = phy_get_drvdata(phy);
 	struct cdns_salvo_data *data = salvo_phy->data;
@@ -230,9 +230,18 @@ static int cdns_salvo_phy_power_on(struct phy *phy)
 
 	udelay(10);
 
+	clk_disable_unprepare(salvo_phy->clk);
+
 	return ret;
 }
 
+static int cdns_salvo_phy_power_on(struct phy *phy)
+{
+	struct cdns_salvo_phy *salvo_phy = phy_get_drvdata(phy);
+
+	return clk_prepare_enable(salvo_phy->clk);
+}
+
 static int cdns_salvo_phy_power_off(struct phy *phy)
 {
 	struct cdns_salvo_phy *salvo_phy = phy_get_drvdata(phy);
@@ -243,6 +252,7 @@ static int cdns_salvo_phy_power_off(struct phy *phy)
 }
 
 static struct phy_ops cdns_salvo_phy_ops = {
+	.init		= cdns_salvo_phy_init,
 	.power_on	= cdns_salvo_phy_power_on,
 	.power_off	= cdns_salvo_phy_power_off,
 	.owner		= THIS_MODULE,