diff mbox series

amd-xgbe: print the right c45 id

Message ID 20200707173347.1564682-1-Shyam-sundar.S-k@amd.com
State Changes Requested
Delegated to: David Miller
Headers show
Series amd-xgbe: print the right c45 id | expand

Commit Message

Shyam Sundar S K July 7, 2020, 5:33 p.m. UTC
If an external PHY uses the CL45 protocol, then phydev->phy_id will be
zero. Update the debug message that prints the PHY ID to check the PHY
mode and print the PMAPMD MMD PHY ID value for a CL45 PHY.

Also, removing the TODO note, as the CL45 support has been updated to
do this.

Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Andrew Lunn July 7, 2020, 6:04 p.m. UTC | #1
On Tue, Jul 07, 2020 at 05:33:47PM +0000, Shyam Sundar S K wrote:
> If an external PHY uses the CL45 protocol, then phydev->phy_id will be
> zero. Update the debug message that prints the PHY ID to check the PHY
> mode and print the PMAPMD MMD PHY ID value for a CL45 PHY.
> 
> Also, removing the TODO note, as the CL45 support has been updated to
> do this.
> 
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> ---
>  drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
> index 46c3c1ca38d6..5b14fc758c2f 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
> @@ -1024,9 +1024,9 @@ static int xgbe_phy_find_phy_device(struct xgbe_prv_data *pdata)
>  		return -ENODEV;
>  	}
>  	netif_dbg(pdata, drv, pdata->netdev, "external PHY id is %#010x\n",
> -		  phydev->phy_id);
> -
> -	/*TODO: If c45, add request_module based on one of the MMD ids? */
> +		(phy_data->phydev_mode == XGBE_MDIO_MODE_CL45)
> +		? phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD]
> +		: phydev->phy_id);

IDs are pretty low level. And for C45 devices, each sub device can
have its own ID, make it even less useful.

You get more useful information from phy_attached_info().

	Andrew
diff mbox series

Patch

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 46c3c1ca38d6..5b14fc758c2f 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -1024,9 +1024,9 @@  static int xgbe_phy_find_phy_device(struct xgbe_prv_data *pdata)
 		return -ENODEV;
 	}
 	netif_dbg(pdata, drv, pdata->netdev, "external PHY id is %#010x\n",
-		  phydev->phy_id);
-
-	/*TODO: If c45, add request_module based on one of the MMD ids? */
+		(phy_data->phydev_mode == XGBE_MDIO_MODE_CL45)
+		? phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD]
+		: phydev->phy_id);
 
 	ret = phy_device_register(phydev);
 	if (ret) {