Skip to content

Commit 820eeb9

Browse files
anderssonkishon
authored andcommitted
phy: qualcomm: usb-hs-28nm: Prepare clocks in init
The AHB clock must be on for qcom_snps_hsphy_init() to be able to write the initialization sequence to the hardware, so move the clock enablement to phy init and exit. Fixes: 67b27db ("phy: qualcomm: Add Synopsys 28nm Hi-Speed USB PHY driver") Signed-off-by: Bjorn Andersson <[email protected]> Reviewed-by: Bryan O'Donoghue <[email protected]> Signed-off-by: Vinod Koul <[email protected]> Signed-off-by: Kishon Vijay Abraham I <[email protected]>
1 parent 6f8280c commit 820eeb9

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

drivers/phy/qualcomm/phy-qcom-usb-hs-28nm.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,11 @@ static int qcom_snps_hsphy_power_on(struct phy *phy)
160160
ret = regulator_bulk_enable(VREG_NUM, priv->vregs);
161161
if (ret)
162162
return ret;
163-
ret = clk_bulk_prepare_enable(priv->num_clks, priv->clks);
164-
if (ret)
165-
goto err_disable_regulator;
163+
166164
qcom_snps_hsphy_disable_hv_interrupts(priv);
167165
qcom_snps_hsphy_exit_retention(priv);
168166

169167
return 0;
170-
171-
err_disable_regulator:
172-
regulator_bulk_disable(VREG_NUM, priv->vregs);
173-
174-
return ret;
175168
}
176169

177170
static int qcom_snps_hsphy_power_off(struct phy *phy)
@@ -180,7 +173,6 @@ static int qcom_snps_hsphy_power_off(struct phy *phy)
180173

181174
qcom_snps_hsphy_enter_retention(priv);
182175
qcom_snps_hsphy_enable_hv_interrupts(priv);
183-
clk_bulk_disable_unprepare(priv->num_clks, priv->clks);
184176
regulator_bulk_disable(VREG_NUM, priv->vregs);
185177

186178
return 0;
@@ -266,21 +258,39 @@ static int qcom_snps_hsphy_init(struct phy *phy)
266258
struct hsphy_priv *priv = phy_get_drvdata(phy);
267259
int ret;
268260

269-
ret = qcom_snps_hsphy_reset(priv);
261+
ret = clk_bulk_prepare_enable(priv->num_clks, priv->clks);
270262
if (ret)
271263
return ret;
272264

265+
ret = qcom_snps_hsphy_reset(priv);
266+
if (ret)
267+
goto disable_clocks;
268+
273269
qcom_snps_hsphy_init_sequence(priv);
274270

275271
ret = qcom_snps_hsphy_por_reset(priv);
276272
if (ret)
277-
return ret;
273+
goto disable_clocks;
274+
275+
return 0;
276+
277+
disable_clocks:
278+
clk_bulk_disable_unprepare(priv->num_clks, priv->clks);
279+
return ret;
280+
}
281+
282+
static int qcom_snps_hsphy_exit(struct phy *phy)
283+
{
284+
struct hsphy_priv *priv = phy_get_drvdata(phy);
285+
286+
clk_bulk_disable_unprepare(priv->num_clks, priv->clks);
278287

279288
return 0;
280289
}
281290

282291
static const struct phy_ops qcom_snps_hsphy_ops = {
283292
.init = qcom_snps_hsphy_init,
293+
.exit = qcom_snps_hsphy_exit,
284294
.power_on = qcom_snps_hsphy_power_on,
285295
.power_off = qcom_snps_hsphy_power_off,
286296
.set_mode = qcom_snps_hsphy_set_mode,

0 commit comments

Comments
 (0)