From: Wong Vee Khee <vee.khee.wong@intel.com>
To: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Ong Boon Leong <boon.leong.ong@intel.com>,
Voon Wei Feng <weifeng.voon@intel.com>,
Wong Vee Khee <vee.khee.wong@intel.com>
Subject: [PATCH net-next 1/1] net: phy: Add additional logics on probing C45 PHY devices
Date: Thu, 12 Nov 2020 23:03:51 +0800 [thread overview]
Message-ID: <20201112150351.12662-1-vee.khee.wong@intel.com> (raw)
For clause 45 PHY, introduce additional logics in get_phy_c45_ids() to
check if there is at least one valid device ID, return 0 on true, and
-ENODEV otherwise.
Signed-off-by: Wong Vee Khee <vee.khee.wong@intel.com>
---
drivers/net/phy/phy_device.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index e13a46c25437..c9ddcd7a63d4 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -730,6 +730,7 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr,
const int num_ids = ARRAY_SIZE(c45_ids->device_ids);
u32 devs_in_pkg = 0;
int i, ret, phy_reg;
+ u32 valid_did = 0;
/* Find first non-zero Devices In package. Device zero is reserved
* for 802.3 c45 complied PHYs, so don't probe it at first.
@@ -796,12 +797,21 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr,
if (phy_reg < 0)
return -EIO;
c45_ids->device_ids[i] |= phy_reg;
+
+ /* Check if there is at least one valid device ID */
+ if (c45_ids->device_ids[i] &&
+ (c45_ids->device_ids[i] & 0x1fffffff) != 0x1fffffff)
+ valid_did |= (1 << i);
}
c45_ids->devices_in_package = devs_in_pkg;
/* Bit 0 doesn't represent a device, it indicates c22 regs presence */
c45_ids->mmds_present = devs_in_pkg & ~BIT(0);
+ /* There is no valid device ID */
+ if (!valid_did)
+ return -ENODEV;
+
return 0;
}
--
2.17.0
next reply other threads:[~2020-11-12 15:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 15:03 Wong Vee Khee [this message]
2020-11-12 15:21 ` [PATCH net-next 1/1] net: phy: Add additional logics on probing C45 PHY devices Andrew Lunn
2020-11-17 19:56 ` Jakub Kicinski
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=20201112150351.12662-1-vee.khee.wong@intel.com \
--to=vee.khee.wong@intel.com \
--cc=andrew@lunn.ch \
--cc=boon.leong.ong@intel.com \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=weifeng.voon@intel.com \
/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).