diff mbox

[net-next,4/4] stmmac: do not fail when probe and there is no csr clk defined

Message ID 1334814502-29707-4-git-send-email-peppe.cavallaro@st.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Giuseppe CAVALLARO April 19, 2012, 5:48 a.m. UTC
On some platforms, for example where we are doing the bring-up,
the csr clock is not passed from the framework and the Ethernet
device driver is failing when it can work w/o any issues and
using the default values. So this patch just warnings the case
of the csr clock cannot be acquired but w/o failing the probe
step. I have just tested it on ST STiH415 SoC (ARM).

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac.h      |   13 +++++++------
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    5 ++++-
 2 files changed, 11 insertions(+), 7 deletions(-)

Comments

David Miller April 20, 2012, 12:09 a.m. UTC | #1
From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Thu, 19 Apr 2012 07:48:22 +0200

> On some platforms, for example where we are doing the bring-up,
> the csr clock is not passed from the framework and the Ethernet
> device driver is failing when it can work w/o any issues and
> using the default values. So this patch just warnings the case
> of the csr clock cannot be acquired but w/o failing the probe
> step. I have just tested it on ST STiH415 SoC (ARM).
> 
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 9f2435c..db2de9a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -107,7 +107,7 @@  struct stmmac_priv *stmmac_dvr_probe(struct device *device,
 #ifdef CONFIG_HAVE_CLK
 static inline int stmmac_clk_enable(struct stmmac_priv *priv)
 {
-	if (priv->stmmac_clk)
+	if (!IS_ERR(priv->stmmac_clk))
 		return clk_enable(priv->stmmac_clk);
 
 	return 0;
@@ -115,17 +115,18 @@  static inline int stmmac_clk_enable(struct stmmac_priv *priv)
 
 static inline void stmmac_clk_disable(struct stmmac_priv *priv)
 {
-	if (priv->stmmac_clk)
-		clk_disable(priv->stmmac_clk);
+	if (IS_ERR(priv->stmmac_clk))
+		return;
+
+	clk_disable(priv->stmmac_clk);
 }
 static inline int stmmac_clk_get(struct stmmac_priv *priv)
 {
 	priv->stmmac_clk = clk_get(priv->device, NULL);
 
-	if (IS_ERR(priv->stmmac_clk)) {
-		pr_err("%s: ERROR clk_get failed\n", __func__);
+	if (IS_ERR(priv->stmmac_clk))
 		return PTR_ERR(priv->stmmac_clk);
-	}
+
 	return 0;
 }
 #else
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index efc42e1..1a4cf81 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -168,6 +168,9 @@  static void stmmac_clk_csr_set(struct stmmac_priv *priv)
 #ifdef CONFIG_HAVE_CLK
 	u32 clk_rate;
 
+	if (IS_ERR(priv->stmmac_clk))
+		return;
+
 	clk_rate = clk_get_rate(priv->stmmac_clk);
 
 	/* Platform provided default clk_csr would be assumed valid
@@ -1923,7 +1926,7 @@  struct stmmac_priv *stmmac_dvr_probe(struct device *device,
 	}
 
 	if (stmmac_clk_get(priv))
-		goto error;
+		pr_warning("%s: warning: cannot get CSR clock\n", __func__);
 
 	/* If a specific clk_csr value is passed from the platform
 	 * this means that the CSR Clock Range selection cannot be