diff mbox series

[net-next,RFC,2/6] net: phy: fill phy_id with C45 PHY

Message ID 20240218190034.15447-3-ansuelsmth@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: phy: support multi PHY in phy_driver Was: net: phy: detach PHY driver OPs from phy_driver struct | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 940 this patch: 940
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 957 this patch: 957
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 957 this patch: 957
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Christian Marangi Feb. 18, 2024, 7 p.m. UTC
With C45 PHYs that provide PHY ID in C45 Package regs, PHY device
.phy_id is not filled.

Correctly fill .phy_id from matching dev_id or phy_driver info.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 drivers/net/phy/phy_device.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Russell King (Oracle) Feb. 18, 2024, 7:35 p.m. UTC | #1
On Sun, Feb 18, 2024 at 08:00:28PM +0100, Christian Marangi wrote:
> With C45 PHYs that provide PHY ID in C45 Package regs, PHY device
> .phy_id is not filled.

Intentionally so. Clause 45 PHYs don't have a single ID. Marvell
88X3310 is a case in point - there are at least two different vendor
IDs in this PHY.

Trying to squash Clause 45 PHY IDs down to a single identifier is
not sensible.
Christian Marangi Feb. 18, 2024, 7:59 p.m. UTC | #2
On Sun, Feb 18, 2024 at 07:35:30PM +0000, Russell King (Oracle) wrote:
> On Sun, Feb 18, 2024 at 08:00:28PM +0100, Christian Marangi wrote:
> > With C45 PHYs that provide PHY ID in C45 Package regs, PHY device
> > .phy_id is not filled.
> 
> Intentionally so. Clause 45 PHYs don't have a single ID. Marvell
> 88X3310 is a case in point - there are at least two different vendor
> IDs in this PHY.
> 
> Trying to squash Clause 45 PHY IDs down to a single identifier is
> not sensible.
>

As said in the cover letter was something I notice and was curious if it
was intentional or not. Thanks for the clarification, I will drop.
diff mbox series

Patch

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 9b96357e4de8..60a60f182729 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -3476,6 +3476,10 @@  static int phy_probe(struct device *dev)
 		phy_dev_id->phy_id_mask = phydrv->phy_id_mask;
 	}
 
+	/* Fill PHY ID with dev_id if empty and PHY is C45 */
+	if (!phydev->phy_id && phydev->is_c45)
+		phydev->phy_id = phy_dev_id->phy_id;
+
 	/* Disable the interrupt if the PHY doesn't support it
 	 * but the interrupt is still a valid one
 	 */