aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorStas Sergeev <stsp@list.ru>2015-07-20 20:49:57 -0400
committerDavid S. Miller <davem@davemloft.net>2015-07-21 19:12:55 -0400
commit4cba5c2103657d43d0886e4cff8004d95a3d0def (patch)
tree87a68d814b5947eff3451760e8b81dd45b2b846a /drivers/of
parent868a4215be9a6d80548ccb74763b883dc99d32a2 (diff)
of_mdio: add new DT property 'managed' to specify the PHY management type
Currently the PHY management type is selected by the MAC driver arbitrary. The decision is based on the presence of the "fixed-link" node and on a will of the driver's authors. This caused a regression recently, when mvneta driver suddenly started to use the in-band status for auto-negotiation on fixed links. It appears the auto-negotiation may not work when expected by the MAC driver. Sebastien Rannou explains: << Yes, I confirm that my HW does not generate an in-band status. AFAIK, it's a PHY that aggregates 4xSGMIIs to 1xQSGMII ; the MAC side of the PHY (with inband status) is connected to the switch through QSGMII, and in this context we are on the media side of the PHY. >> https://lkml.org/lkml/2015/7/10/206 This patch introduces the new string property 'managed' that allows the user to set the management type explicitly. The supported values are: "auto" - default. Uses either MDIO or nothing, depending on the presence of the fixed-link node "in-band-status" - use in-band status Signed-off-by: Stas Sergeev <stsp@users.sourceforge.net> CC: Rob Herring <robh+dt@kernel.org> CC: Pawel Moll <pawel.moll@arm.com> CC: Mark Rutland <mark.rutland@arm.com> CC: Ian Campbell <ijc+devicetree@hellion.org.uk> CC: Kumar Gala <galak@codeaurora.org> CC: Florian Fainelli <f.fainelli@gmail.com> CC: Grant Likely <grant.likely@linaro.org> CC: devicetree@vger.kernel.org CC: linux-kernel@vger.kernel.org CC: netdev@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/of_mdio.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index fdc60db60829..7c8c23cc6896 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -266,7 +266,8 @@ EXPORT_SYMBOL(of_phy_attach);
266bool of_phy_is_fixed_link(struct device_node *np) 266bool of_phy_is_fixed_link(struct device_node *np)
267{ 267{
268 struct device_node *dn; 268 struct device_node *dn;
269 int len; 269 int len, err;
270 const char *managed;
270 271
271 /* New binding */ 272 /* New binding */
272 dn = of_get_child_by_name(np, "fixed-link"); 273 dn = of_get_child_by_name(np, "fixed-link");
@@ -275,6 +276,10 @@ bool of_phy_is_fixed_link(struct device_node *np)
275 return true; 276 return true;
276 } 277 }
277 278
279 err = of_property_read_string(np, "managed", &managed);
280 if (err == 0 && strcmp(managed, "auto") != 0)
281 return true;
282
278 /* Old binding */ 283 /* Old binding */
279 if (of_get_property(np, "fixed-link", &len) && 284 if (of_get_property(np, "fixed-link", &len) &&
280 len == (5 * sizeof(__be32))) 285 len == (5 * sizeof(__be32)))
@@ -289,8 +294,18 @@ int of_phy_register_fixed_link(struct device_node *np)
289 struct fixed_phy_status status = {}; 294 struct fixed_phy_status status = {};
290 struct device_node *fixed_link_node; 295 struct device_node *fixed_link_node;
291 const __be32 *fixed_link_prop; 296 const __be32 *fixed_link_prop;
292 int len; 297 int len, err;
293 struct phy_device *phy; 298 struct phy_device *phy;
299 const char *managed;
300
301 err = of_property_read_string(np, "managed", &managed);
302 if (err == 0) {
303 if (strcmp(managed, "in-band-status") == 0) {
304 /* status is zeroed, namely its .link member */
305 phy = fixed_phy_register(PHY_POLL, &status, np);
306 return IS_ERR(phy) ? PTR_ERR(phy) : 0;
307 }
308 }
294 309
295 /* New binding */ 310 /* New binding */
296 fixed_link_node = of_get_child_by_name(np, "fixed-link"); 311 fixed_link_node = of_get_child_by_name(np, "fixed-link");