1 From 133a9b75e2b0c48cd1d8f93b0ee61089821c32d9 Mon Sep 17 00:00:00 2001
2 From: Chen-Yu Tsai <wens@csie.org>
3 Date: Sat, 7 Dec 2013 01:29:34 +0800
4 Subject: [PATCH] net: stmmac: Enable stmmac main clock when probing hardware
6 Signed-off-by: Chen-Yu Tsai <wens@csie.org>
8 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 24 +++++++++++++----------
9 1 file changed, 14 insertions(+), 10 deletions(-)
11 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
12 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
13 @@ -2680,10 +2680,17 @@ struct stmmac_priv *stmmac_dvr_probe(str
14 if ((phyaddr >= 0) && (phyaddr <= 31))
15 priv->plat->phy_addr = phyaddr;
17 + priv->stmmac_clk = clk_get(priv->device, STMMAC_RESOURCE_NAME);
18 + if (IS_ERR(priv->stmmac_clk)) {
19 + pr_warn("%s: warning: cannot get CSR clock\n", __func__);
22 + clk_prepare_enable(priv->stmmac_clk);
24 /* Init MAC and get the capabilities */
25 ret = stmmac_hw_init(priv);
27 - goto error_free_netdev;
30 ndev->netdev_ops = &stmmac_netdev_ops;
32 @@ -2721,12 +2728,6 @@ struct stmmac_priv *stmmac_dvr_probe(str
33 goto error_netdev_register;
36 - priv->stmmac_clk = clk_get(priv->device, STMMAC_RESOURCE_NAME);
37 - if (IS_ERR(priv->stmmac_clk)) {
38 - pr_warn("%s: warning: cannot get CSR clock\n", __func__);
42 /* If a specific clk_csr value is passed from the platform
43 * this means that the CSR Clock Range selection cannot be
44 * changed at run-time and it is fixed. Viceversa the driver'll try to
45 @@ -2751,15 +2752,18 @@ struct stmmac_priv *stmmac_dvr_probe(str
49 + clk_disable_unprepare(priv->stmmac_clk);
54 - clk_put(priv->stmmac_clk);
56 unregister_netdev(ndev);
57 error_netdev_register:
58 netif_napi_del(&priv->napi);
61 + clk_disable_unprepare(priv->stmmac_clk);
62 + clk_put(priv->stmmac_clk);