5b9b09c672e95151016a722187fbd65fe6fe6928
[openwrt/openwrt.git] / target / linux / sunxi / patches-3.13 / 153-5-stmmac-deprecate-snps-phy-addr.patch
1 From 436f7ecdcc08f71ddc106b7bbe3bcbf1785f3bff Mon Sep 17 00:00:00 2001
2 From: Chen-Yu Tsai <wens@csie.org>
3 Date: Fri, 17 Jan 2014 21:24:45 +0800
4 Subject: [PATCH] net: stmmac: Deprecate snps, phy-addr and auto-detect PHY
5 address
6
7 The snps,phy-addr device tree property is non-standard, and should be
8 removed in favor of proper phy node support. Remove it from the binding
9 documents and warn if the property is still used.
10
11 Most PHYs respond to address 0, but a few don't, so auto-detect PHY
12 address by default, to make up for the lack of explicit address selection.
13
14 Signed-off-by: Chen-Yu Tsai <wens@csie.org>
15 Signed-off-by: David S. Miller <davem@davemloft.net>
16 ---
17 Documentation/devicetree/bindings/net/stmmac.txt | 1 -
18 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 ++++++++-
19 2 files changed, 8 insertions(+), 2 deletions(-)
20
21 diff --git a/Documentation/devicetree/bindings/net/stmmac.txt b/Documentation/devicetree/bindings/net/stmmac.txt
22 index d132513..aefb639 100644
23 --- a/Documentation/devicetree/bindings/net/stmmac.txt
24 +++ b/Documentation/devicetree/bindings/net/stmmac.txt
25 @@ -12,7 +12,6 @@ Required properties:
26 property
27 - phy-mode: String, operation mode of the PHY interface.
28 Supported values are: "mii", "rmii", "gmii", "rgmii".
29 -- snps,phy-addr phy address to connect to.
30 - snps,reset-gpio gpio number for phy reset.
31 - snps,reset-active-low boolean flag to indicate if phy reset is active low.
32 - snps,reset-delays-us is triplet of delays
33 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
34 index 634260e..82110f1 100644
35 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
36 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
37 @@ -50,7 +50,14 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
38 if (plat->bus_id < 0)
39 plat->bus_id = 0;
40
41 - of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr);
42 + /* Default to phy auto-detection */
43 + plat->phy_addr = -1;
44 +
45 + /* "snps,phy-addr" is not a standard property. Mark it as deprecated
46 + * and warn of its use. Remove this when phy node support is added.
47 + */
48 + if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0)
49 + dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n");
50
51 plat->mdio_bus_data = devm_kzalloc(&pdev->dev,
52 sizeof(struct stmmac_mdio_bus_data),
53 --
54 1.8.5.5
55