sc2: usb: fix SC2 suspend power consumption [1/1]

PD#SWPL-143832

Problem:
fix SC2 suspend power consumption.

Solution:
fix SC2 suspend power consumption.

Verify:
AH212

Change-Id: I8596d84d5cefbb8281245450922be86653d680cf
Signed-off-by: dian.shao <dian.shao@amlogic.com>
This commit is contained in:
dian.shao
2023-10-26 11:38:05 +08:00
committed by gerrit autosubmit
parent db11e0d8aa
commit a5998d5c09
@@ -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;
}