stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Stas Sergeev <stsp@users.sourceforge.net>,
	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, netdev@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 4.2 28/30] of_mdio: add new DT property managed to specify the PHY management type
Date: Thu,  1 Oct 2015 11:21:50 +0200	[thread overview]
Message-ID: <20151001092039.411588779@linuxfoundation.org> (raw)
In-Reply-To: <20151001092038.213304276@linuxfoundation.org>

4.2-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Stas Sergeev <stsp@list.ru>

[ Upstream commit 4cba5c2103657d43d0886e4cff8004d95a3d0def in net-next tree,
  will be pushed to Linus very soon. ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 Documentation/devicetree/bindings/net/ethernet.txt |    4 ++++
 drivers/of/of_mdio.c                               |   19 +++++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

--- a/Documentation/devicetree/bindings/net/ethernet.txt
+++ b/Documentation/devicetree/bindings/net/ethernet.txt
@@ -25,7 +25,11 @@ The following properties are common to t
   flow control thresholds.
 - tx-fifo-depth: the size of the controller's transmit fifo in bytes. This
   is used for components that can have configurable fifo sizes.
+- managed: string, specifies the PHY management type. Supported values are:
+  "auto", "in-band-status". "auto" is the default, it usess MDIO for
+  management if fixed-link is not specified.
 
 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.
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -266,7 +266,8 @@ EXPORT_SYMBOL(of_phy_attach);
 bool of_phy_is_fixed_link(struct device_node *np)
 {
 	struct device_node *dn;
-	int len;
+	int len, err;
+	const char *managed;
 
 	/* New binding */
 	dn = of_get_child_by_name(np, "fixed-link");
@@ -275,6 +276,10 @@ bool of_phy_is_fixed_link(struct device_
 		return true;
 	}
 
+	err = of_property_read_string(np, "managed", &managed);
+	if (err == 0 && strcmp(managed, "auto") != 0)
+		return true;
+
 	/* Old binding */
 	if (of_get_property(np, "fixed-link", &len) &&
 	    len == (5 * sizeof(__be32)))
@@ -289,8 +294,18 @@ int of_phy_register_fixed_link(struct de
 	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, "in-band-status") == 0) {
+			/* status is zeroed, namely its .link member */
+			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");



  parent reply	other threads:[~2015-10-01  9:23 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01  9:21 [PATCH 4.2 00/30] 4.2.3-stable review Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 01/30] phylib: fix device deletion order in mdiobus_unregister() Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 02/30] sock, diag: fix panic in sock_diag_put_filterinfo Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 03/30] ipv6: fix exthdrs offload registration in out_rt path Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 04/30] net: fec: clear receive interrupts before processing a packet Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 05/30] net: eth: altera: fix napi poll_list corruption Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 06/30] net/ipv6: Correct PIM6 mrt_lock handling Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 07/30] net: dsa: bcm_sf2: Fix ageing conditions and operation Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 08/30] ipv6: fix multipath route replace error recovery Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 09/30] net: dsa: bcm_sf2: Fix 64-bits register writes Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 10/30] netlink, mmap: transform mmap skb into full skb on taps Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 11/30] sctp: fix race on protocol/netns initialization Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 13/30] net: mvneta: fix DMA buffer unmapping in mvneta_rx() Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 14/30] rtnetlink: catch -EOPNOTSUPP errors from ndo_bridge_getlink Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 15/30] net/mlx4_en: really allow to change RSS key Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 16/30] macvtap: fix TUNSETSNDBUF values > 64k Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 17/30] netlink: Fix autobind race condition that leads to zero port ID Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 18/30] netlink: Replace rhash_portid with bound Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 19/30] net: dsa: actually force the speed on the CPU port Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 20/30] openvswitch: Zero flows on allocation Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 21/30] tcp: add proper TS val into RST packets Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 22/30] Fix AF_PACKET ABI breakage in 4.2 Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 23/30] net: revert "net_sched: move tp->root allocation into fw_init()" Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 24/30] fib_rules: fix fib rule dumps across multiple skbs Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 25/30] ppp: fix lockdep splat in ppp_dev_uninit() Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 26/30] net: dsa: bcm_sf2: Do not override speed settings Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 27/30] net: phy: fixed_phy: handle link-down case Greg Kroah-Hartman
2015-10-01  9:21 ` Greg Kroah-Hartman [this message]
2015-10-01  9:21 ` [PATCH 4.2 29/30] mvneta: use inband status only when explicitly enabled Greg Kroah-Hartman
2015-10-01  9:21 ` [PATCH 4.2 30/30] net/mlx4_core: Capping number of requested MSIXs to MAX_MSIX Greg Kroah-Hartman
2015-10-02  1:27 ` [PATCH 4.2 00/30] 4.2.3-stable review Guenter Roeck
2015-10-03 11:37   ` Greg Kroah-Hartman
2015-10-03 14:45     ` Guenter Roeck
2015-10-18  0:45       ` Greg Kroah-Hartman
2015-10-02  5:14 ` Sudip Mukherjee
2015-10-03 11:36   ` Greg Kroah-Hartman
2015-10-02 15:41 ` Shuah Khan
2015-10-03 11:36   ` Greg Kroah-Hartman

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=20151001092039.411588779@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --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=netdev@vger.kernel.org \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=stable@vger.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).