aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>2012-04-18 15:48:22 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-19 20:09:06 -0400
commit31ea38eefea0a8b40d1ef65842ed66847b13979f (patch)
treece41d4f60486e6ce752888e73540386f9488a073
parent0f1f88a875bd6c6725501183fabeb99a70c35757 (diff)
stmmac: do not fail when probe and there is no csr clk defined
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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac.h13
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c5
2 files changed, 11 insertions, 7 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 9f2435c53f57..db2de9a49952 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,
107#ifdef CONFIG_HAVE_CLK 107#ifdef CONFIG_HAVE_CLK
108static inline int stmmac_clk_enable(struct stmmac_priv *priv) 108static inline int stmmac_clk_enable(struct stmmac_priv *priv)
109{ 109{
110 if (priv->stmmac_clk) 110 if (!IS_ERR(priv->stmmac_clk))
111 return clk_enable(priv->stmmac_clk); 111 return clk_enable(priv->stmmac_clk);
112 112
113 return 0; 113 return 0;
@@ -115,17 +115,18 @@ static inline int stmmac_clk_enable(struct stmmac_priv *priv)
115 115
116static inline void stmmac_clk_disable(struct stmmac_priv *priv) 116static inline void stmmac_clk_disable(struct stmmac_priv *priv)
117{ 117{
118 if (priv->stmmac_clk) 118 if (IS_ERR(priv->stmmac_clk))
119 clk_disable(priv->stmmac_clk); 119 return;
120
121 clk_disable(priv->stmmac_clk);
120} 122}
121static inline int stmmac_clk_get(struct stmmac_priv *priv) 123static inline int stmmac_clk_get(struct stmmac_priv *priv)
122{ 124{
123 priv->stmmac_clk = clk_get(priv->device, NULL); 125 priv->stmmac_clk = clk_get(priv->device, NULL);
124 126
125 if (IS_ERR(priv->stmmac_clk)) { 127 if (IS_ERR(priv->stmmac_clk))
126 pr_err("%s: ERROR clk_get failed\n", __func__);
127 return PTR_ERR(priv->stmmac_clk); 128 return PTR_ERR(priv->stmmac_clk);
128 } 129
129 return 0; 130 return 0;
130} 131}
131#else 132#else
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index efc42e1f9b4a..1a4cf8128f91 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)
168#ifdef CONFIG_HAVE_CLK 168#ifdef CONFIG_HAVE_CLK
169 u32 clk_rate; 169 u32 clk_rate;
170 170
171 if (IS_ERR(priv->stmmac_clk))
172 return;
173
171 clk_rate = clk_get_rate(priv->stmmac_clk); 174 clk_rate = clk_get_rate(priv->stmmac_clk);
172 175
173 /* Platform provided default clk_csr would be assumed valid 176 /* Platform provided default clk_csr would be assumed valid
@@ -1923,7 +1926,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
1923 } 1926 }
1924 1927
1925 if (stmmac_clk_get(priv)) 1928 if (stmmac_clk_get(priv))
1926 goto error; 1929 pr_warning("%s: warning: cannot get CSR clock\n", __func__);
1927 1930
1928 /* If a specific clk_csr value is passed from the platform 1931 /* If a specific clk_csr value is passed from the platform
1929 * this means that the CSR Clock Range selection cannot be 1932 * this means that the CSR Clock Range selection cannot be