[PATCH] net: phy: gmii2rgmii: Support external rgmii-id phy

Michal Simek michal.simek at amd.com
Wed Mar 22 08:58:34 CET 2023



On 3/20/23 16:55, Stefan Herbrechtsmeier wrote:
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>
> 
> Read the phy mode of the external phy from the device tree if available.
> 
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>
> 
> ---
> 
>   drivers/net/phy/xilinx_gmii2rgmii.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
> index 7376283956..12519a8d57 100644
> --- a/drivers/net/phy/xilinx_gmii2rgmii.c
> +++ b/drivers/net/phy/xilinx_gmii2rgmii.c
> @@ -48,7 +48,10 @@ static int xilinxgmiitorgmii_config(struct phy_device *phydev)
>   		return -EINVAL;
>   	}
>   
> -	ext_phydev->interface = PHY_INTERFACE_MODE_RGMII;
> +	ext_phydev->interface = ofnode_read_phy_mode(node);
> +	if (ext_phydev->interface == PHY_INTERFACE_MODE_NA)
> +		ext_phydev->interface = PHY_INTERFACE_MODE_RGMII;
> +

This is open a way to pretty much define any mode which doesn't look right.

I think it would be good to also check that mode is setup based on what IP 
itself supports. It means check that rgmii or rgmii-id are selected.

If in DT someone put sgmii it should error out.

Thanks,
Michal


More information about the U-Boot mailing list