Commit 0ad2be79 authored by Thierry Reding's avatar Thierry Reding Committed by David S. Miller

net: stmmac: Balance PTP reference clock enable/disable

clk_prepare_enable() and clk_disable_unprepare() for this clock aren't
properly balanced, which can trigger a WARN_ON() in the common clock
framework.
Reviewed-By: default avatarJoao Pinto <jpinto@synopsys.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c66f6c37
...@@ -1711,6 +1711,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) ...@@ -1711,6 +1711,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
stmmac_mmc_setup(priv); stmmac_mmc_setup(priv);
if (init_ptp) { if (init_ptp) {
ret = clk_prepare_enable(priv->plat->clk_ptp_ref);
if (ret < 0)
netdev_warn(priv->dev, "failed to enable PTP reference clock: %d\n", ret);
ret = stmmac_init_ptp(priv); ret = stmmac_init_ptp(priv);
if (ret == -EOPNOTSUPP) if (ret == -EOPNOTSUPP)
netdev_warn(priv->dev, "PTP not supported by HW\n"); netdev_warn(priv->dev, "PTP not supported by HW\n");
......
...@@ -365,7 +365,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) ...@@ -365,7 +365,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
plat->clk_ptp_ref = NULL; plat->clk_ptp_ref = NULL;
dev_warn(&pdev->dev, "PTP uses main clock\n"); dev_warn(&pdev->dev, "PTP uses main clock\n");
} else { } else {
clk_prepare_enable(plat->clk_ptp_ref);
plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref); plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref);
dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate); dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment