linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
To: <netdev@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <andrew@lunn.ch>, <f.fainelli@gmail.com>, <hkallweit1@gmail.com>,
	<linux@armlinux.org.uk>, <davem@davemloft.net>,
	Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Subject: [PATCH] net: mdio: of: Do not treat fixed-link as PHY
Date: Mon, 30 Mar 2020 19:01:36 +0300	[thread overview]
Message-ID: <20200330160136.23018-1-codrin.ciubotariu@microchip.com> (raw)

Some ethernet controllers, such as cadence's macb, have an embedded MDIO.
For this reason, the ethernet PHY nodes are not under an MDIO bus, but
directly under the ethernet node. Since these drivers might use
of_mdiobus_child_is_phy(), we should fix this function by returning false
if a fixed-link is found.

Fixes: 801a8ef54e8b ("of: phy: Only register a phy device for phys")
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
---
 drivers/of/of_mdio.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 9f982c0627a0..7cf8aad645a4 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -195,12 +195,17 @@ static const struct of_device_id whitelist_phys[] = {
  * o Compatible string of "ethernet-phy-ieee802.3-c22"
  * o In the white list above (and issue a warning)
  * o No compatibility string
+ * o Not a fixed-link
  *
  * A device which is not a phy is expected to have a compatible string
  * indicating what sort of device it is.
  */
 bool of_mdiobus_child_is_phy(struct device_node *child)
 {
+	const struct of_device_id fixed_link[] = {
+		{ .name = "fixed-link" },
+		{}
+	};
 	u32 phy_id;
 
 	if (of_get_phy_id(child, &phy_id) != -EINVAL)
@@ -219,7 +224,8 @@ bool of_mdiobus_child_is_phy(struct device_node *child)
 		return true;
 	}
 
-	if (!of_find_property(child, "compatible", NULL))
+	if (!of_find_property(child, "compatible", NULL) &&
+	    !of_match_node(fixed_link, child))
 		return true;
 
 	return false;
-- 
2.20.1


             reply	other threads:[~2020-03-30 16:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30 16:01 Codrin Ciubotariu [this message]
2020-03-30 16:17 ` [PATCH] net: mdio: of: Do not treat fixed-link as PHY Andrew Lunn
2020-03-30 16:21   ` Russell King - ARM Linux admin
2020-03-30 16:24     ` Andrew Lunn
2020-03-30 16:30 ` Andrew Lunn
2020-03-30 17:22   ` Florian Fainelli
2020-03-31  8:54     ` Codrin.Ciubotariu
2020-03-31 12:59       ` Andrew Lunn
2020-04-01  7:50         ` Codrin.Ciubotariu
2020-04-01 13:06           ` Andrew Lunn

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=20200330160136.23018-1-codrin.ciubotariu@microchip.com \
    --to=codrin.ciubotariu@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    /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).