mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: "David S . Miller" <davem@davemloft.net>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Joao Pinto <Joao.Pinto@synopsys.com>,
	Jon Hunter <jonathanh@nvidia.com>,
	Mikko Perttunen <cyndis@kapsi.fi>,
	netdev@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/9] net: stmmac: Disable PTP reference clock on error
Date: Fri, 10 Mar 2017 17:34:55 +0100	[thread overview]
Message-ID: <20170310163501.31811-4-thierry.reding@gmail.com> (raw)
In-Reply-To: <20170310163501.31811-1-thierry.reding@gmail.com>

From: Thierry Reding <treding@nvidia.com>

If an error occurs while opening the device, make sure to disable the
PTP reference clock.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 7c38c9baf238..6060410d2b9e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1754,6 +1754,13 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
 	return 0;
 }
 
+static void stmmac_hw_teardown(struct net_device *dev)
+{
+	struct stmmac_priv *priv = netdev_priv(dev);
+
+	clk_disable_unprepare(priv->plat->clk_ptp_ref);
+}
+
 /**
  *  stmmac_open - open entry point of the driver
  *  @dev : pointer to the device structure.
@@ -1863,6 +1870,7 @@ static int stmmac_open(struct net_device *dev)
 		phy_stop(dev->phydev);
 
 	del_timer_sync(&priv->txtimer);
+	stmmac_hw_teardown(dev);
 init_error:
 	free_dma_desc_resources(priv);
 dma_desc_error:
-- 
2.12.0

  parent reply	other threads:[~2017-03-10 16:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10 16:34 [PATCH v2 0/9] net: stmmac: Fixes and Tegra186 support Thierry Reding
2017-03-10 16:34 ` [PATCH v2 1/9] net: stmmac: Rename clk_ptp_ref clock to ptp_ref Thierry Reding
2017-03-20 15:18   ` Rob Herring
2017-03-10 16:34 ` [PATCH v2 2/9] net: stmmac: Stop PHY and remove TX timer on error Thierry Reding
2017-03-10 16:34 ` Thierry Reding [this message]
2017-03-10 16:34 ` [PATCH v2 4/9] net: stmmac: Balance PTP reference clock enable/disable Thierry Reding
2017-03-10 16:34 ` [PATCH v2 5/9] net: stmmac: Check for DMA mapping errors Thierry Reding
2017-03-10 16:34 ` [PATCH v2 6/9] net: stmmac: Parse FIFO sizes from feature registers Thierry Reding
2017-03-10 16:34 ` [PATCH v2 7/9] net: stmmac: Program RX queue size and flow control Thierry Reding
2017-03-10 16:35 ` [PATCH v2 8/9] net: stmmac: dwc-qos: Split out ->probe() and ->remove() Thierry Reding
2017-03-10 16:35 ` [PATCH v2 9/9] net: stmmac: dwc-qos: Add Tegra186 support Thierry Reding
2017-03-13  6:35 ` [PATCH v2 0/9] net: stmmac: Fixes and " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170310163501.31811-4-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=Joao.Pinto@synopsys.com \
    --cc=alexandre.torgue@st.com \
    --cc=cyndis@kapsi.fi \
    --cc=davem@davemloft.net \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®