ipq806x: fix uninitialized variable usage in cpufreq-krait
[openwrt.git] / target / linux / ipq806x / patches-4.1 / 703-stmmac-add-fixed-link-device-tree-support.patch
1 From 3a95f75867be562cb919ff23a738f70357188fbd Mon Sep 17 00:00:00 2001
2 From: Mathieu Olivari <mathieu@codeaurora.org>
3 Date: Fri, 8 May 2015 16:02:03 -0700
4 Subject: [PATCH 3/8] stmmac: add fixed-link device-tree support
5
6 In case DT is used, this change adds the ability to the stmmac driver to
7 detect a fixed-link PHY, instanciate it, and use it during
8 phy_connect().
9
10 Fixed link PHYs DT usage is described in:
11 Documentation/devicetree/bindings/net/fixed-link.txt
12
13 Signed-off-by: Mathieu Olivari <mathieu@codeaurora.org>
14 ---
15  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     |  2 +-
16  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 12 +++++++++++-
17  2 files changed, 12 insertions(+), 2 deletions(-)
18
19 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
20 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
21 @@ -856,7 +856,7 @@ static int stmmac_init_phy(struct net_de
22          * device as well.
23          * Note: phydev->phy_id is the result of reading the UID PHY registers.
24          */
25 -       if (phydev->phy_id == 0) {
26 +       if (!priv->plat->phy_node && phydev->phy_id == 0) {
27                 phy_disconnect(phydev);
28                 return -ENODEV;
29         }
30 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
31 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
32 @@ -177,6 +177,14 @@ static int stmmac_probe_config_dt(struct
33         /* If we find a phy-handle property, use it as the PHY */
34         plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
35  
36 +       /* If phy-handle is not specified, check if we have a fixed-phy */
37 +       if (!plat->phy_node && of_phy_is_fixed_link(np)) {
38 +               if ((of_phy_register_fixed_link(np) < 0))
39 +                       return -ENODEV;
40 +
41 +               plat->phy_node = of_node_get(np);
42 +       }
43 +
44         /* "snps,phy-addr" is not a standard property. Mark it as deprecated
45          * and warn of its use. Remove this when phy node support is added.
46          */
47 @@ -243,7 +251,7 @@ static int stmmac_probe_config_dt(struct
48                                        GFP_KERNEL);
49                 if (!dma_cfg) {
50                         ret = -ENOMEM;
51 -                       goto err;
52 +                       goto err2;
53                 }
54                 plat->dma_cfg = dma_cfg;
55                 of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
56 @@ -263,6 +271,8 @@ static int stmmac_probe_config_dt(struct
57  
58         return 0;
59  
60 +err2:
61 +       of_node_put(np);
62  err:
63         return ret;
64  }