[PATCH net-next v2 02/13] net: stmmac: loongson1: use PHY_INTF_SEL_x directly

Maxime Chevallier maxime.chevallier at bootlin.com
Wed Nov 12 07:47:25 PST 2025



On 11/11/2025 09:11, Russell King (Oracle) wrote:
> Use the PHY_INTF_SEL_xx values directly in ls1c_dwmac_syscon_init(),
> converting them to the PHY_INTF_SELI bitfield when calling
> regmap_update_bits().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>

Reviewed-by: Maxime Chevallier <maxime.chevallier at bootlin.com>

Maxime

> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
> index 09e2af1d778a..5f9f66fbc191 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
> @@ -38,8 +38,6 @@
>  #define GMAC_SHUT		BIT(6)
>  
>  #define PHY_INTF_SELI		GENMASK(30, 28)
> -#define PHY_INTF_MII		FIELD_PREP(PHY_INTF_SELI, PHY_INTF_SEL_GMII_MII)
> -#define PHY_INTF_RMII		FIELD_PREP(PHY_INTF_SELI, PHY_INTF_SEL_RMII)
>  
>  struct ls1x_dwmac {
>  	struct plat_stmmacenet_data *plat_dat;
> @@ -140,15 +138,14 @@ static int ls1c_dwmac_syscon_init(struct platform_device *pdev, void *priv)
>  	struct ls1x_dwmac *dwmac = priv;
>  	struct plat_stmmacenet_data *plat = dwmac->plat_dat;
>  	struct regmap *regmap = dwmac->regmap;
> +	int phy_intf_sel;
>  
>  	switch (plat->phy_interface) {
>  	case PHY_INTERFACE_MODE_MII:
> -		regmap_update_bits(regmap, LS1X_SYSCON1, PHY_INTF_SELI,
> -				   PHY_INTF_MII);
> +		phy_intf_sel = PHY_INTF_SEL_GMII_MII;
>  		break;
>  	case PHY_INTERFACE_MODE_RMII:
> -		regmap_update_bits(regmap, LS1X_SYSCON1, PHY_INTF_SELI,
> -				   PHY_INTF_RMII);
> +		phy_intf_sel = PHY_INTF_SEL_RMII;
>  		break;
>  	default:
>  		dev_err(&pdev->dev, "Unsupported PHY-mode %u\n",
> @@ -156,6 +153,8 @@ static int ls1c_dwmac_syscon_init(struct platform_device *pdev, void *priv)
>  		return -EOPNOTSUPP;
>  	}
>  
> +	regmap_update_bits(regmap, LS1X_SYSCON1, PHY_INTF_SELI,
> +			   FIELD_PREP(PHY_INTF_SELI, phy_intf_sel));
>  	regmap_update_bits(regmap, LS1X_SYSCON0, GMAC0_SHUT, 0);
>  
>  	return 0;




More information about the linux-arm-kernel mailing list