From: Stas Sergeev <stsp@list.ru> To: netdev <netdev@vger.kernel.org> Cc: Linux kernel <linux-kernel@vger.kernel.org>, Sebastien Rannou <mxs@sbrk.org>, Arnaud Ebalard <arno@natisbad.org>, Stas Sergeev <stsp@users.sourceforge.net>, Florian Fainelli <f.fainelli@gmail.com>, Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>, Mark Rutland <mark.rutland@arm.com>, Ian Campbell <ijc+devicetree@hellion.org.uk>, Kumar Gala <galak@codeaurora.org>, Florian Fainelli <f.fainelli@gmail.com>, Grant Likely <grant.likely@linaro.org>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org> Subject: [PATCH 2/3] of_mdio: add new DT property 'managed' to specify the PHY management type Date: Tue, 14 Jul 2015 20:13:16 +0300 [thread overview] Message-ID: <55A5432C.1080609@list.ru> (raw) In-Reply-To: <55A5424D.4030809@list.ru> 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 "mdio" - use MDIO "in-band-status" - use in-band status "none" - use fixed-link description 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 --- Documentation/devicetree/bindings/net/ethernet.txt | 5 ++++ drivers/of/of_mdio.c | 28 ++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/net/ethernet.txt b/Documentation/devicetree/bindings/net/ethernet.txt index 3fc3605..23743e9 100644 --- a/Documentation/devicetree/bindings/net/ethernet.txt +++ b/Documentation/devicetree/bindings/net/ethernet.txt @@ -19,7 +19,12 @@ The following properties are common to the Ethernet controllers: - phy: the same as "phy-handle" property, not recommended for new bindings. - phy-device: the same as "phy-handle" property, not recommended for new bindings. +- managed: string, specifies the PHY management type. Supported values are: + "auto", "mdio", "in-band-status", "none". "auto" is the default, and it + sets the management type to either "mdio" or "none", depending on the + presence of the "fixed-link" child node. Child nodes of the Ethernet controller are typically the individual PHY devices connected via the MDIO bus (sometimes the MDIO bus controller is separate). They are described in the phy.txt file in this same directory. +For non-MDIO PHY management see fixed-link.txt. diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 1bd4305..a460812 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -262,7 +262,16 @@ EXPORT_SYMBOL(of_phy_attach); bool of_phy_is_fixed_link(struct device_node *np) { struct device_node *dn; - int len; + int len, m_err; + const char *managed; + + m_err = of_property_read_string(np, "managed", &managed); + if (m_err == 0) { + if (strcmp(managed, "none") == 0) + return true; + if (strcmp(managed, "mdio") == 0) + return false; + } /* New binding */ dn = of_get_child_by_name(np, "fixed-link"); @@ -271,6 +280,9 @@ bool of_phy_is_fixed_link(struct device_node *np) return true; } + if (m_err == 0 && strcmp(managed, "auto") != 0) + return true; + /* Old binding */ if (of_get_property(np, "fixed-link", &len) && len == (5 * sizeof(__be32))) @@ -285,8 +297,20 @@ int of_phy_register_fixed_link(struct device_node *np) struct fixed_phy_status status = {}; struct device_node *fixed_link_node; const __be32 *fixed_link_prop; - int len; + int len, err; struct phy_device *phy; + const char *managed; + + err = of_property_read_string(np, "managed", &managed); + if (err == 0) { + if (strcmp(managed, "mdio") == 0) + return -EINVAL; + if (strcmp(managed, "in-band-status") == 0) { + status.link = 0; + phy = fixed_phy_register(PHY_POLL, &status, np); + return IS_ERR(phy) ? PTR_ERR(phy) : 0; + } + } /* New binding */ fixed_link_node = of_get_child_by_name(np, "fixed-link"); -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Stas Sergeev <stsp@list.ru> To: netdev <netdev@vger.kernel.org> Cc: Linux kernel <linux-kernel@vger.kernel.org>, Sebastien Rannou <mxs@sbrk.org>, Arnaud Ebalard <arno@natisbad.org>, Stas Sergeev <stsp@users.sourceforge.net>, Florian Fainelli <f.fainelli@gmail.com>, Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>, Mark Rutland <mark.rutland@arm.com>, Ian Campbell <ijc+devicetree@hellion.org.uk>, Kumar Gala <galak@codeaurora.org>Florian Fainelli <f.fainelli@gmail.com>, Grant Likely <grant.likely@linaro.org>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org> Subject: [PATCH 2/3] of_mdio: add new DT property 'managed' to specify the PHY management type Date: Tue, 14 Jul 2015 20:13:16 +0300 [thread overview] Message-ID: <55A5432C.1080609@list.ru> (raw) In-Reply-To: <55A5424D.4030809@list.ru> 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 "mdio" - use MDIO "in-band-status" - use in-band status "none" - use fixed-link description 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 --- Documentation/devicetree/bindings/net/ethernet.txt | 5 ++++ drivers/of/of_mdio.c | 28 ++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/net/ethernet.txt b/Documentation/devicetree/bindings/net/ethernet.txt index 3fc3605..23743e9 100644 --- a/Documentation/devicetree/bindings/net/ethernet.txt +++ b/Documentation/devicetree/bindings/net/ethernet.txt @@ -19,7 +19,12 @@ The following properties are common to the Ethernet controllers: - phy: the same as "phy-handle" property, not recommended for new bindings. - phy-device: the same as "phy-handle" property, not recommended for new bindings. +- managed: string, specifies the PHY management type. Supported values are: + "auto", "mdio", "in-band-status", "none". "auto" is the default, and it + sets the management type to either "mdio" or "none", depending on the + presence of the "fixed-link" child node. Child nodes of the Ethernet controller are typically the individual PHY devices connected via the MDIO bus (sometimes the MDIO bus controller is separate). They are described in the phy.txt file in this same directory. +For non-MDIO PHY management see fixed-link.txt. diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 1bd4305..a460812 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -262,7 +262,16 @@ EXPORT_SYMBOL(of_phy_attach); bool of_phy_is_fixed_link(struct device_node *np) { struct device_node *dn; - int len; + int len, m_err; + const char *managed; + + m_err = of_property_read_string(np, "managed", &managed); + if (m_err == 0) { + if (strcmp(managed, "none") == 0) + return true; + if (strcmp(managed, "mdio") == 0) + return false; + } /* New binding */ dn = of_get_child_by_name(np, "fixed-link"); @@ -271,6 +280,9 @@ bool of_phy_is_fixed_link(struct device_node *np) return true; } + if (m_err == 0 && strcmp(managed, "auto") != 0) + return true; + /* Old binding */ if (of_get_property(np, "fixed-link", &len) && len == (5 * sizeof(__be32))) @@ -285,8 +297,20 @@ int of_phy_register_fixed_link(struct device_node *np) struct fixed_phy_status status = {}; struct device_node *fixed_link_node; const __be32 *fixed_link_prop; - int len; + int len, err; struct phy_device *phy; + const char *managed; + + err = of_property_read_string(np, "managed", &managed); + if (err == 0) { + if (strcmp(managed, "mdio") == 0) + return -EINVAL; + if (strcmp(managed, "in-band-status") == 0) { + status.link = 0; + phy = fixed_phy_register(PHY_POLL, &status, np); + return IS_ERR(phy) ? PTR_ERR(phy) : 0; + } + } /* New binding */ fixed_link_node = of_get_child_by_name(np, "fixed-link"); -- 1.9.1
next prev parent reply other threads:[~2015-07-14 17:13 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-07-14 17:09 [PATCH v3 0/3] net: enable inband link state negotiation only when explicitly requested Stas Sergeev 2015-07-14 17:11 ` [PATCH 1/3] fixed_phy: handle link-down case Stas Sergeev 2015-07-14 18:28 ` Florian Fainelli [not found] ` <55A56D4D.5090004@list.ru> 2015-07-15 15:33 ` Fwd: " Stas Sergeev 2015-07-14 17:13 ` Stas Sergeev [this message] 2015-07-14 17:13 ` [PATCH 2/3] of_mdio: add new DT property 'managed' to specify the PHY management type Stas Sergeev 2015-07-14 17:51 ` Florian Fainelli 2015-07-14 17:51 ` Florian Fainelli 2015-07-14 20:26 ` Stas Sergeev 2015-07-14 17:14 ` [PATCH 3/3] mvneta: use inband status only when explicitly enabled Stas Sergeev 2015-07-16 14:49 [PATCH v4 0/3] net: enable inband link state negotiation only when explicitly requested Stas Sergeev 2015-07-16 14:52 ` [PATCH 2/3] of_mdio: add new DT property 'managed' to specify the PHY management type Stas Sergeev 2015-07-16 14:52 ` Stas Sergeev
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=55A5432C.1080609@list.ru \ --to=stsp@list.ru \ --cc=arno@natisbad.org \ --cc=devicetree@vger.kernel.org \ --cc=f.fainelli@gmail.com \ --cc=galak@codeaurora.org \ --cc=grant.likely@linaro.org \ --cc=ijc+devicetree@hellion.org.uk \ --cc=linux-kernel@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=mxs@sbrk.org \ --cc=netdev@vger.kernel.org \ --cc=pawel.moll@arm.com \ --cc=robh+dt@kernel.org \ --cc=stsp@users.sourceforge.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.