Re: [PATCH net-next v1 1/3] net: phy: micrel: add MDI/MDI-X control support for KSZ9477 switch-integrated PHYs
From: Andrew Lunn
Date: Tue Jun 10 2025 - 09:17:28 EST
On Tue, Jun 10, 2025 at 02:46:11PM +0200, Oleksij Rempel wrote:
> On Tue, Jun 10, 2025 at 02:31:45PM +0200, Andrew Lunn wrote:
> > On Tue, Jun 10, 2025 at 11:13:52AM +0200, Oleksij Rempel wrote:
> > > Add MDI/MDI-X configuration support for PHYs integrated in the KSZ9477
> > > family of Ethernet switches.
> > >
> > > All MDI/MDI-X configuration modes are supported:
> > > - Automatic MDI/MDI-X (ETH_TP_MDI_AUTO)
> > > - Forced MDI (ETH_TP_MDI)
> > > - Forced MDI-X (ETH_TP_MDI_X)
> > >
> > > However, when operating in automatic mode, the PHY does not expose the
> > > resolved crossover status (i.e., whether MDI or MDI-X is active).
> > > Therefore, in auto mode, the driver reports ETH_TP_MDI_INVALID as
> > > the current status.
> >
> > I assume you also considered returning ETH_TP_MDI_AUTO? What makes
> > INVALID better than AUTO?
>
> The phydev->mdix_ctrl returns configuration state, which cant be set to
> ETH_TP_MDI_AUTO.
> The phydev->mdix should return actual crossover state, which is
> ETH_TP_MDI or ETH_TP_MDI_X. Setting it to ETH_TP_MDI_AUTO, would not
> provide any usable information.
[Goes and looks at the code]
#define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */
#define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */
#define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */
#define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */
So _AUTO is not listed as being valid as a status. And _INVALID has
the comment unkown. So:
Reviewed-by: Andrew Lunn <andrew@xxxxxxx>
Andrew