usb: phy: snps: Add support to vote/unvote ref_clk

Move XO clock in phy driver to remove the dependency on
dwc3 glue driver. Add the votes required for phy to
be operational using the optional ref_clk.

Change-Id: Ieb081ad1bbf9a00c4029ae9abdc1c58eaff81462
Signed-off-by: Uttkarsh Aggarwal <quic_uaggarwa@quicinc.com>
This commit is contained in:
Uttkarsh Aggarwal 2023-12-26 10:04:15 +05:30
parent 1dcb6eb63d
commit 373bca6abf

View File

@ -106,6 +106,7 @@ struct msm_hsphy {
struct clk *ref_clk_src;
struct clk *cfg_ahb_clk;
struct clk *ref_clk;
struct reset_control *phy_reset;
struct regulator *vdd;
@ -152,6 +153,9 @@ static void msm_hsphy_enable_clocks(struct msm_hsphy *phy, bool on)
if (!phy->clocks_enabled && on) {
clk_prepare_enable(phy->ref_clk_src);
if (phy->ref_clk)
clk_prepare_enable(phy->ref_clk);
if (phy->cfg_ahb_clk)
clk_prepare_enable(phy->cfg_ahb_clk);
@ -159,6 +163,10 @@ static void msm_hsphy_enable_clocks(struct msm_hsphy *phy, bool on)
}
if (phy->clocks_enabled && !on) {
if (phy->ref_clk)
clk_disable_unprepare(phy->ref_clk);
if (phy->cfg_ahb_clk)
clk_disable_unprepare(phy->cfg_ahb_clk);
@ -891,6 +899,13 @@ static int msm_hsphy_probe(struct platform_device *pdev)
return ret;
}
phy->ref_clk = devm_clk_get_optional(dev, "ref_clk");
if (IS_ERR(phy->ref_clk)) {
dev_dbg(dev, "clk get failed for ref_clk\n");
ret = PTR_ERR(phy->ref_clk);
return ret;
}
if (of_property_match_string(pdev->dev.of_node,
"clock-names", "cfg_ahb_clk") >= 0) {
phy->cfg_ahb_clk = devm_clk_get(dev, "cfg_ahb_clk");