public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] net: spacemit: display phy driver information
@ 2026-01-22  8:00 Chukun Pan
  2026-01-22 13:17 ` Andrew Lunn
  2026-01-22 15:12 ` Yao Zi
  0 siblings, 2 replies; 6+ messages in thread
From: Chukun Pan @ 2026-01-22  8:00 UTC (permalink / raw)
  To: Vivian Wang, Yixun Lan
  Cc: Paolo Abeni, Jakub Kicinski, Eric Dumazet, Andrew Lunn,
	David S . Miller, linux-riscv, linux-kernel, spacemit, netdev,
	Chukun Pan

Print the PHY driver used and interrupt status after connection.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
---
 drivers/net/ethernet/spacemit/k1_emac.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/spacemit/k1_emac.c b/drivers/net/ethernet/spacemit/k1_emac.c
index c85dc742c404..afb5b6a61c2c 100644
--- a/drivers/net/ethernet/spacemit/k1_emac.c
+++ b/drivers/net/ethernet/spacemit/k1_emac.c
@@ -1568,6 +1568,7 @@ static int emac_phy_connect(struct net_device *ndev)
 	struct device *dev = &priv->pdev->dev;
 	struct phy_device *phydev;
 	struct device_node *np;
+	char *irq_str;
 	int ret;
 
 	ret = of_get_phy_mode(dev->of_node, &priv->phy_interface);
@@ -1610,6 +1611,11 @@ static int emac_phy_connect(struct net_device *ndev)
 		goto err_node_put;
 	}
 
+	irq_str = phy_attached_info_irq(phydev);
+	netdev_info(ndev, "PHY driver [%s] (irq=%s)\n",
+		    phydev->drv->name, irq_str);
+	kfree(irq_str);
+
 	phydev->mac_managed_pm = true;
 
 	emac_update_delay_line(priv);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] net: spacemit: display phy driver information
  2026-01-22  8:00 [PATCH 1/1] net: spacemit: display phy driver information Chukun Pan
@ 2026-01-22 13:17 ` Andrew Lunn
  2026-01-22 15:06   ` Chukun Pan
  2026-01-22 15:12 ` Yao Zi
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2026-01-22 13:17 UTC (permalink / raw)
  To: Chukun Pan
  Cc: Vivian Wang, Yixun Lan, Paolo Abeni, Jakub Kicinski, Eric Dumazet,
	Andrew Lunn, David S . Miller, linux-riscv, linux-kernel,
	spacemit, netdev

On Thu, Jan 22, 2026 at 04:00:01PM +0800, Chukun Pan wrote:
> Print the PHY driver used and interrupt status after connection.

The standard way to do this is call phy_attached_info(). Is it missing
some information you need?

    Andrew

---
pw-bot: cr

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] net: spacemit: display phy driver information
  2026-01-22 13:17 ` Andrew Lunn
@ 2026-01-22 15:06   ` Chukun Pan
  2026-01-22 15:18     ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Chukun Pan @ 2026-01-22 15:06 UTC (permalink / raw)
  To: andrew
  Cc: amadeus, andrew+netdev, davem, dlan, edumazet, kuba, linux-kernel,
	linux-riscv, netdev, pabeni, spacemit, wangruikang

Hi,

> > Print the PHY driver used and interrupt status after connection.
>
> The standard way to do this is call phy_attached_info(). Is it missing
> some information you need?

I initially used phy_attached_info(), but it was too long and printed
phydev_name() "cac80000.ethernet:01" twice:

YT8531 Gigabit Ethernet cac80000.ethernet:01: attached PHY driver (mii_bus:phy_addr=cac80000.ethernet:01, irq=POLL)

So I referenced a part of phylink_bringup_phy() to make it look better:

k1_emac cac80000.ethernet eth0: PHY driver [YT8531 Gigabit Ethernet] (irq=POLL)
k1_emac cac80000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off

If we're going to use phy_attached_info(), I think `mii_bus:phy_addr`
is redundant. What's your opinion on this?

Thanks,
Chukun

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] net: spacemit: display phy driver information
  2026-01-22  8:00 [PATCH 1/1] net: spacemit: display phy driver information Chukun Pan
  2026-01-22 13:17 ` Andrew Lunn
@ 2026-01-22 15:12 ` Yao Zi
  1 sibling, 0 replies; 6+ messages in thread
From: Yao Zi @ 2026-01-22 15:12 UTC (permalink / raw)
  To: Chukun Pan, Vivian Wang, Yixun Lan
  Cc: Paolo Abeni, Jakub Kicinski, Eric Dumazet, Andrew Lunn,
	David S . Miller, linux-riscv, linux-kernel, spacemit, netdev

On Thu, Jan 22, 2026 at 04:00:01PM +0800, Chukun Pan wrote:
> Print the PHY driver used and interrupt status after connection.
> 
> Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
> ---
>  drivers/net/ethernet/spacemit/k1_emac.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/spacemit/k1_emac.c b/drivers/net/ethernet/spacemit/k1_emac.c
> index c85dc742c404..afb5b6a61c2c 100644
> --- a/drivers/net/ethernet/spacemit/k1_emac.c
> +++ b/drivers/net/ethernet/spacemit/k1_emac.c
> @@ -1568,6 +1568,7 @@ static int emac_phy_connect(struct net_device *ndev)
>  	struct device *dev = &priv->pdev->dev;
>  	struct phy_device *phydev;
>  	struct device_node *np;
> +	char *irq_str;
>  	int ret;
>  
>  	ret = of_get_phy_mode(dev->of_node, &priv->phy_interface);
> @@ -1610,6 +1611,11 @@ static int emac_phy_connect(struct net_device *ndev)
>  		goto err_node_put;
>  	}
>  
> +	irq_str = phy_attached_info_irq(phydev);
> +	netdev_info(ndev, "PHY driver [%s] (irq=%s)\n",
> +		    phydev->drv->name, irq_str);
> +	kfree(irq_str);

Would phy_attached_print() simplify the code?

Regards,
Yao Zi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] net: spacemit: display phy driver information
  2026-01-22 15:06   ` Chukun Pan
@ 2026-01-22 15:18     ` Andrew Lunn
  2026-01-23  2:10       ` Vivian Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2026-01-22 15:18 UTC (permalink / raw)
  To: Chukun Pan
  Cc: andrew+netdev, davem, dlan, edumazet, kuba, linux-kernel,
	linux-riscv, netdev, pabeni, spacemit, wangruikang

On Thu, Jan 22, 2026 at 11:06:01PM +0800, Chukun Pan wrote:
> Hi,
> 
> > > Print the PHY driver used and interrupt status after connection.
> >
> > The standard way to do this is call phy_attached_info(). Is it missing
> > some information you need?
> 
> I initially used phy_attached_info(), but it was too long and printed
> phydev_name() "cac80000.ethernet:01" twice:
> 
> YT8531 Gigabit Ethernet cac80000.ethernet:01: attached PHY driver (mii_bus:phy_addr=cac80000.ethernet:01, irq=POLL)

This is what everybody expects, so you should use it.

You have some control over the names, it is the name you assign when
creating the struct device. Maybe you can shorten them.

	Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] net: spacemit: display phy driver information
  2026-01-22 15:18     ` Andrew Lunn
@ 2026-01-23  2:10       ` Vivian Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Vivian Wang @ 2026-01-23  2:10 UTC (permalink / raw)
  To: Andrew Lunn, Chukun Pan
  Cc: andrew+netdev, davem, dlan, edumazet, kuba, linux-kernel,
	linux-riscv, netdev, pabeni, spacemit

On 1/22/26 23:18, Andrew Lunn wrote:
> On Thu, Jan 22, 2026 at 11:06:01PM +0800, Chukun Pan wrote:
>> Hi,
>>
>>>> Print the PHY driver used and interrupt status after connection.
>>> The standard way to do this is call phy_attached_info(). Is it missing
>>> some information you need?
>> I initially used phy_attached_info(), but it was too long and printed
>> phydev_name() "cac80000.ethernet:01" twice:
>>
>> YT8531 Gigabit Ethernet cac80000.ethernet:01: attached PHY driver (mii_bus:phy_addr=cac80000.ethernet:01, irq=POLL)
> This is what everybody expects, so you should use it.
>
> You have some control over the names, it is the name you assign when
> creating the struct device. Maybe you can shorten them.

Right... it's just copied from the name of the platform device itself,
which is AFAICT a common approach.

Honestly I think the name doesn't need shortening. The K1 has two of
these MACs, so it needs the identifying information. And at least to me
the platform device name "cac80000.ethernet" is pretty recognizable.

Vivian "dramforever" Wang


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-01-23  2:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-22  8:00 [PATCH 1/1] net: spacemit: display phy driver information Chukun Pan
2026-01-22 13:17 ` Andrew Lunn
2026-01-22 15:06   ` Chukun Pan
2026-01-22 15:18     ` Andrew Lunn
2026-01-23  2:10       ` Vivian Wang
2026-01-22 15:12 ` Yao Zi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox