Subject: Re: [PATCH net] net: dsa: microchip: keep compatibility with device tree blobs with no phy-mode

From: Andrew Lunn <[email-masked]>
Date: Thu, 18 Aug 2022 17:13:51 +0200

> It is important to note that phy_device_create() initializes
> dev->interface = PHY_INTERFACE_MODE_GMII, and so, when we use
> phylink_create(PHY_INTERFACE_MODE_NA), no one will override this, and we
> will end up with a PHY_INTERFACE_MODE_GMII interface inherited from the
> PHY.

Is this actually a bug?

With pure phylib, you should call one of the connect functions, which
underneath calls phy_attach_direct() which has a phy_interface_t. So
the default in practice does not matter.

> All this means that in order to maintain compatibility with device tree
> blobs where the phy-mode property is missing, we need to allow the
> "gmii" phy-mode and treat it as "internal".

of_get_phy_mode() returns PHY_INTERFACE_MODE_NA if the property is
missing, which also suggests this is a bug.

I wonder if we have any ports which actually rely on
PHY_INTERFACE_MODE_GMII?

	 Andrew