From: Russell King <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: Jeremy Linton <jeremy.linton@arm.com>,
Florian Fainelli <f.fainelli@gmail.com>,
netdev@vger.kernel.org
Subject: [PATCH RFC v2 9/9] net: phy: read MMD ID from all present MMDs
Date: Wed, 27 May 2020 11:34:27 +0100 [thread overview]
Message-ID: <E1jdtOF-00084V-7R@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20200527103318.GK1551@shell.armlinux.org.uk>
Expand the device_ids[] array to allow all MMD IDs to be read rather
than just the first 8 MMDs, but only read the ID if the MDIO_STAT2
register reports that a device really is present here for these new
devices to maintain compatibility with our current behaviour.
88X3310 PHY vendor MMDs do are marked as present in the
devices_in_package, but do not contain IEE 802.3 compatible register
sets in their lower space. This avoids reading incorrect values as MMD
identifiers.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phy_device.c | 13 +++++++++++++
include/linux/phy.h | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index c90409b00e94..ebd3306610a4 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -772,6 +772,19 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr,
if (!(devs_in_pkg & (1 << i)))
continue;
+ if (i == MDIO_MMD_VEND1 || i == MDIO_MMD_VEND2) {
+ /* Probe the "Device Present" bits for the vendor MMDs
+ * to ignore these if they do not contain IEEE 802.3
+ * registers.
+ */
+ ret = phy_c45_probe_present(bus, addr, i);
+ if (ret < 0)
+ return ret;
+
+ if (!ret)
+ continue;
+ }
+
phy_reg = mdiobus_c45_read(bus, addr, i, MII_PHYSID1);
if (phy_reg < 0)
return -EIO;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 0d41c710339a..3325dd8fb9ac 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -361,7 +361,7 @@ enum phy_state {
struct phy_c45_device_ids {
u32 devices_in_package;
u32 mmds_present;
- u32 device_ids[8];
+ u32 device_ids[MDIO_MMD_NUM];
};
struct macsec_context;
--
2.20.1
next prev parent reply other threads:[~2020-05-27 10:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-27 10:33 [PATCH RFC v2 0/9] Clause 45 PHY probing cleanups Russell King - ARM Linux admin
2020-05-27 10:33 ` [PATCH RFC v2 1/9] net: phy: clean up cortina workaround Russell King
2020-05-27 10:33 ` [PATCH RFC v2 2/9] net: phy: clean up PHY ID reading Russell King
2020-05-27 16:31 ` Florian Fainelli
2020-05-27 10:33 ` [PATCH RFC v2 3/9] net: phy: clean up get_phy_c45_ids() failure handling Russell King
2020-05-27 16:32 ` Florian Fainelli
2020-05-27 10:34 ` [PATCH RFC v2 4/9] net: phy: clean up get_phy_c22_id() invalid ID handling Russell King
2020-05-27 16:33 ` Florian Fainelli
2020-05-27 10:34 ` [PATCH RFC v2 5/9] net: phy: reword get_phy_device() kerneldoc Russell King
2020-05-27 16:33 ` Florian Fainelli
2020-05-27 10:34 ` [PATCH RFC v2 6/9] net: phy: add support for probing MMDs >= 8 for devices-in-package Russell King
2020-05-27 16:34 ` Florian Fainelli
2020-06-10 16:16 ` Calvin Johnson
2020-06-10 16:34 ` Russell King - ARM Linux admin
2020-06-11 6:01 ` Calvin Johnson
2020-05-27 10:34 ` [PATCH RFC v2 7/9] net: phy: set devices_in_package only after validation Russell King
2020-05-27 16:35 ` Florian Fainelli
2020-05-27 10:34 ` [PATCH RFC v2 8/9] net: phy: split devices_in_package Russell King
2020-05-27 16:36 ` Florian Fainelli
2020-05-27 10:34 ` Russell King [this message]
2020-05-27 16:40 ` [PATCH RFC v2 9/9] net: phy: read MMD ID from all present MMDs Florian Fainelli
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=E1jdtOF-00084V-7R@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=jeremy.linton@arm.com \
--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).