upgrade 3.13 targets to 3.13.2, refresh patches
[openwrt/staging/mkresin.git] / target / linux / sunxi / patches-3.13 / 190-stmmac-enable-main-clock-when-probing.patch
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
5
6 Signed-off-by: Chen-Yu Tsai <wens@csie.org>
7 ---
8 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 24 +++++++++++++----------
9 1 file changed, 14 insertions(+), 10 deletions(-)
10
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;
16
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__);
20 + goto error_clk_get;
21 + }
22 + clk_prepare_enable(priv->stmmac_clk);
23 +
24 /* Init MAC and get the capabilities */
25 ret = stmmac_hw_init(priv);
26 if (ret)
27 - goto error_free_netdev;
28 + goto error_hw_init;
29
30 ndev->netdev_ops = &stmmac_netdev_ops;
31
32 @@ -2721,12 +2728,6 @@ struct stmmac_priv *stmmac_dvr_probe(str
33 goto error_netdev_register;
34 }
35
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__);
39 - goto error_clk_get;
40 - }
41 -
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
46 }
47 }
48
49 + clk_disable_unprepare(priv->stmmac_clk);
50 +
51 return priv;
52
53 error_mdio_register:
54 - clk_put(priv->stmmac_clk);
55 -error_clk_get:
56 unregister_netdev(ndev);
57 error_netdev_register:
58 netif_napi_del(&priv->napi);
59 -error_free_netdev:
60 +error_hw_init:
61 + clk_disable_unprepare(priv->stmmac_clk);
62 + clk_put(priv->stmmac_clk);
63 +error_clk_get:
64 free_netdev(ndev);
65
66 return NULL;