Merge "net: stmmac: Disable/Enable GDSC regulators on LPM"
This commit is contained in:
commit
d2285b31af
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Copyright (c) 2018-19, Linaro Limited
|
||||
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
// Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
@ -1522,6 +1522,15 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
|
||||
}
|
||||
ETHQOSDBG(": emac_core_version = %d\n", ethqos->emac_ver);
|
||||
|
||||
if (of_property_read_bool(pdev->dev.of_node,
|
||||
"gdsc-off-on-suspend")) {
|
||||
ethqos->gdsc_off_on_suspend = true;
|
||||
} else {
|
||||
ethqos->gdsc_off_on_suspend = false;
|
||||
}
|
||||
ETHQOSDBG("gdsc-off-on-suspend = %d\n",
|
||||
ethqos->gdsc_off_on_suspend);
|
||||
|
||||
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
|
||||
if (ret)
|
||||
goto err_clk;
|
||||
@ -1600,6 +1609,13 @@ static int qcom_ethqos_suspend(struct device *dev)
|
||||
ret = stmmac_suspend(dev);
|
||||
qcom_ethqos_phy_suspend_clks(ethqos);
|
||||
|
||||
if (ethqos->gdsc_off_on_suspend) {
|
||||
if (ethqos->gdsc_emac) {
|
||||
regulator_disable(ethqos->gdsc_emac);
|
||||
ETHQOSDBG("Disabled <%s>\n", EMAC_GDSC_EMAC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
ETHQOSDBG(" ret = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
@ -1619,6 +1635,13 @@ static int qcom_ethqos_resume(struct device *dev)
|
||||
if (!ethqos)
|
||||
return -ENODEV;
|
||||
|
||||
if (ethqos->gdsc_off_on_suspend) {
|
||||
ret = regulator_enable(ethqos->gdsc_emac);
|
||||
if (ret)
|
||||
ETHQOSERR("Can not enable <%s>\n", EMAC_GDSC_EMAC_NAME);
|
||||
ETHQOSDBG("Enabled <%s>\n", EMAC_GDSC_EMAC_NAME);
|
||||
}
|
||||
|
||||
ndev = dev_get_drvdata(dev);
|
||||
if (!ndev || !netif_running(ndev)) {
|
||||
ETHQOSERR(" Resume not possible\n");
|
||||
@ -1626,6 +1649,8 @@ static int qcom_ethqos_resume(struct device *dev)
|
||||
}
|
||||
|
||||
qcom_ethqos_phy_resume_clks(ethqos);
|
||||
if (ethqos->gdsc_off_on_suspend)
|
||||
ethqos_set_func_clk_en(ethqos);
|
||||
|
||||
ret = stmmac_resume(dev);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.*/
|
||||
/*Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.*/
|
||||
#ifndef _DWMAC_QCOM_ETHQOS_H
|
||||
#define _DWMAC_QCOM_ETHQOS_H
|
||||
|
||||
@ -40,6 +40,8 @@
|
||||
#define EMAC_HW_v4_0_0 0x40000000
|
||||
#define EMAC_HW_vMAX 9
|
||||
|
||||
#define EMAC_GDSC_EMAC_NAME "gdsc_emac"
|
||||
|
||||
struct ethqos_emac_por {
|
||||
unsigned int offset;
|
||||
unsigned int value;
|
||||
@ -81,6 +83,9 @@ struct qcom_ethqos {
|
||||
/* Boolean to check if clock is suspended*/
|
||||
int clks_suspended;
|
||||
struct completion clk_enable_done;
|
||||
/* Boolean flag for turning off GDSC during suspend */
|
||||
bool gdsc_off_on_suspend;
|
||||
|
||||
};
|
||||
|
||||
int ethqos_init_reqgulators(struct qcom_ethqos *ethqos);
|
||||
|
Loading…
Reference in New Issue
Block a user