nvethernet: fix monitor clk enable/disable warnings

Issue: Adjust link from the phy subsystem can be called
multiple times either with link down or up. If its called
second time with same link down then code tries to disable
the same clks again which results in clock warinigs.

Fix: Maintain the state of the clk and then disable/enable
the clock based on the state.

Bug 3585098

Change-Id: I7d259e6066c7b67d0a970122eb0841e4b5871b43
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2688290
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Bhadram Varka
2022-03-28 13:22:46 +05:30
committed by Revanth Kumar Uppala
parent e1f730c060
commit 6479c24ff8
2 changed files with 16 additions and 5 deletions

View File

@@ -884,25 +884,31 @@ static void ether_en_dis_monitor_clks(struct ether_priv_data *pdata,
{
if (en_dis == OSI_ENABLE) {
/* Enable Monitoring clocks */
if (!IS_ERR_OR_NULL(pdata->rx_m_clk)) {
if (!IS_ERR_OR_NULL(pdata->rx_m_clk) && !pdata->rx_m_enabled) {
if (clk_prepare_enable(pdata->rx_m_clk) < 0)
dev_err(pdata->dev,
"failed to enable rx_m_clk");
else
pdata->rx_m_enabled = true;
}
if (!IS_ERR_OR_NULL(pdata->rx_pcs_m_clk)) {
if (!IS_ERR_OR_NULL(pdata->rx_pcs_m_clk) && !pdata->rx_pcs_m_enabled) {
if (clk_prepare_enable(pdata->rx_pcs_m_clk) < 0)
dev_err(pdata->dev,
"failed to enable rx_pcs_m_clk");
else
pdata->rx_pcs_m_enabled = true;
}
} else {
/* Disable Monitoring clocks */
if (!IS_ERR_OR_NULL(pdata->rx_pcs_m_clk)) {
if (!IS_ERR_OR_NULL(pdata->rx_pcs_m_clk) && pdata->rx_pcs_m_enabled) {
clk_disable_unprepare(pdata->rx_pcs_m_clk);
pdata->rx_pcs_m_enabled = false;
}
if (!IS_ERR_OR_NULL(pdata->rx_m_clk)) {
if (!IS_ERR_OR_NULL(pdata->rx_m_clk) && pdata->rx_m_enabled) {
clk_disable_unprepare(pdata->rx_m_clk);
pdata->rx_m_enabled = false;
}
}
}
@@ -6449,7 +6455,8 @@ static int ether_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&pdata->mac_addr_list_head);
INIT_LIST_HEAD(&pdata->tx_ts_skb_head);
INIT_DELAYED_WORK(&pdata->tx_ts_work, ether_get_tx_ts);
pdata->rx_m_enabled = false;
pdata->rx_pcs_m_enabled = false;
#ifdef ETHER_NVGRO
__skb_queue_head_init(&pdata->mq);
__skb_queue_head_init(&pdata->fq);

View File

@@ -610,6 +610,10 @@ struct ether_priv_data {
unsigned int skip_mac_reset;
/** Fixed link enable/disable */
unsigned int fixed_link;
/** Flag to represent rx_m clk enabled or not */
bool rx_m_enabled;
/** Flag to represent rx_pcs_m clk enabled or not */
bool rx_pcs_m_enabled;
};
/**