diff --git a/drivers/usb/usb3v2phy/phy-aml-new-usb3-v2.c b/drivers/usb/usb3v2phy/phy-aml-new-usb3-v2.c index 88e5e4ea9..4e2406642 100644 --- a/drivers/usb/usb3v2phy/phy-aml-new-usb3-v2.c +++ b/drivers/usb/usb3v2phy/phy-aml-new-usb3-v2.c @@ -60,6 +60,8 @@ static void amlogic_new_usb3phy_shutdown(struct usb_phy *x) struct amlogic_usb_v2 *phy = phy_to_amlusb(x); if (phy->phy.flags == AML_USB3_PHY_ENABLE) { + if (phy->pcie_bgp) + clk_disable_unprepare(phy->pcie_bgp); clk_disable_unprepare(phy->clk); writel(0x1d, phy->phy3_cfg); } @@ -189,6 +191,8 @@ static int amlogic_new_usb3_init(struct usb_phy *x) if (phy->suspend_flag) { if (phy->phy.flags == AML_USB3_PHY_ENABLE) { clk_prepare_enable(phy->clk); + if (phy->pcie_bgp) + clk_prepare_enable(phy->pcie_bgp); writel(0x7c, phy->phy3_cfg); } phy->suspend_flag = 0; @@ -687,6 +691,7 @@ static int amlogic_new_usb3_v2_probe(struct platform_device *pdev) phy->disable_port_a = usb3_v2_force_disable_port_a; phy->usb2_phy_init = usb3_v2_aml_new_usb2_init; phy->usb2_get_mode = usb2_v2_get_mode; + phy->pcie_bgp = NULL; /* set the phy from pcie to usb3 */ if (phy->portnum > 0) { @@ -706,6 +711,19 @@ static int amlogic_new_usb3_v2_probe(struct platform_device *pdev) ret = PTR_ERR(phy->clk); return ret; } + + phy->pcie_bgp = devm_clk_get(dev, "pcie_bgp"); + if (IS_ERR(phy->pcie_bgp)) { + dev_err(dev, "Failed to get pcie_bgp\n"); + phy->pcie_bgp = NULL; + } else { + ret = clk_prepare_enable(phy->pcie_bgp); + if (ret) { + dev_err(dev, "Failed to enable pcie_bgp\n"); + ret = PTR_ERR(phy->clk); + return ret; + } + } phy->phy.flags = AML_USB3_PHY_ENABLE; }