From: Maxime Chevallier <maxime.chevallier@bootlin•com>
To: "Russell King (Oracle)" <rmk+kernel@armlinux•org.uk>,
Andrew Lunn <andrew@lunn•ch>,
Heiner Kallweit <hkallweit1@gmail•com>
Cc: Alexandre Torgue <alexandre.torgue@foss•st.com>,
Andrew Lunn <andrew+netdev@lunn•ch>,
"David S. Miller" <davem@davemloft•net>,
Eric Dumazet <edumazet@google•com>,
Jakub Kicinski <kuba@kernel•org>,
linux-arm-kernel@lists•infradead.org,
linux-stm32@st-md-mailman•stormreply.com,
Maxime Coquelin <mcoquelin.stm32@gmail•com>,
netdev@vger•kernel.org, Paolo Abeni <pabeni@redhat•com>
Subject: Re: [PATCH net-next v2 08/11] net: stmmac: ingenic: simplify mac_set_mode() methods
Date: Thu, 6 Nov 2025 11:15:20 +0100 [thread overview]
Message-ID: <60bd1571-e293-4748-adde-396bf193bac2@bootlin.com> (raw)
In-Reply-To: <E1vGvoZ-0000000DWp2-2cxj@rmk-PC.armlinux.org.uk>
On 06/11/2025 09:57, Russell King (Oracle) wrote:
> x1000, x1600 and x1830 only accept RMII mode. PHY_INTF_SEL_RMII is only
> selected with PHY_INTERFACE_MODE_RMII, and PHY_INTF_SEL_RMII has been
> validated by the SoC's .valid_phy_intf_sel bitmask. Thus, checking the
> interface mode in these functions becomes unnecessary. Remove these.
>
> jz4775 is similar, except for a greater set of PHY_INTF_SEL_x valies.
> Also remove the switch statement here.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux•org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin•com>
Maxime
> ---
> .../ethernet/stmicro/stmmac/dwmac-ingenic.c | 50 +------------------
> 1 file changed, 2 insertions(+), 48 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
> index 539513890db1..7b2576fbb1e1 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
> @@ -75,22 +75,6 @@ static int jz4775_mac_set_mode(struct plat_stmmacenet_data *plat_dat,
> struct ingenic_mac *mac = plat_dat->bsp_priv;
> unsigned int val;
>
> - switch (plat_dat->phy_interface) {
> - case PHY_INTERFACE_MODE_MII:
> - case PHY_INTERFACE_MODE_GMII:
> - case PHY_INTERFACE_MODE_RMII:
> - case PHY_INTERFACE_MODE_RGMII:
> - case PHY_INTERFACE_MODE_RGMII_ID:
> - case PHY_INTERFACE_MODE_RGMII_TXID:
> - case PHY_INTERFACE_MODE_RGMII_RXID:
> - break;
> -
> - default:
> - dev_err(mac->dev, "Unsupported interface %s\n",
> - phy_modes(plat_dat->phy_interface));
> - return -EINVAL;
> - }
> -
> val = FIELD_PREP(MACPHYC_PHY_INFT_MASK, phy_intf_sel) |
> FIELD_PREP(MACPHYC_TXCLK_SEL_MASK, MACPHYC_TXCLK_SEL_INPUT);
>
> @@ -103,16 +87,6 @@ static int x1000_mac_set_mode(struct plat_stmmacenet_data *plat_dat,
> {
> struct ingenic_mac *mac = plat_dat->bsp_priv;
>
> - switch (plat_dat->phy_interface) {
> - case PHY_INTERFACE_MODE_RMII:
> - break;
> -
> - default:
> - dev_err(mac->dev, "Unsupported interface %s\n",
> - phy_modes(plat_dat->phy_interface));
> - return -EINVAL;
> - }
> -
> /* Update MAC PHY control register */
> return regmap_update_bits(mac->regmap, 0, mac->soc_info->mask, 0);
> }
> @@ -123,16 +97,6 @@ static int x1600_mac_set_mode(struct plat_stmmacenet_data *plat_dat,
> struct ingenic_mac *mac = plat_dat->bsp_priv;
> unsigned int val;
>
> - switch (plat_dat->phy_interface) {
> - case PHY_INTERFACE_MODE_RMII:
> - break;
> -
> - default:
> - dev_err(mac->dev, "Unsupported interface %s\n",
> - phy_modes(plat_dat->phy_interface));
> - return -EINVAL;
> - }
> -
> val = FIELD_PREP(MACPHYC_PHY_INFT_MASK, phy_intf_sel);
>
> /* Update MAC PHY control register */
> @@ -145,18 +109,8 @@ static int x1830_mac_set_mode(struct plat_stmmacenet_data *plat_dat,
> struct ingenic_mac *mac = plat_dat->bsp_priv;
> unsigned int val;
>
> - switch (plat_dat->phy_interface) {
> - case PHY_INTERFACE_MODE_RMII:
> - val = FIELD_PREP(MACPHYC_MODE_SEL_MASK, MACPHYC_MODE_SEL_RMII);
> - break;
> -
> - default:
> - dev_err(mac->dev, "Unsupported interface %s\n",
> - phy_modes(plat_dat->phy_interface));
> - return -EINVAL;
> - }
> -
> - val |= FIELD_PREP(MACPHYC_PHY_INFT_MASK, phy_intf_sel);
> + val = FIELD_PREP(MACPHYC_MODE_SEL_MASK, MACPHYC_MODE_SEL_RMII) |
> + FIELD_PREP(MACPHYC_PHY_INFT_MASK, phy_intf_sel);
>
> /* Update MAC PHY control register */
> return regmap_update_bits(mac->regmap, 0, mac->soc_info->mask, val);
next prev parent reply other threads:[~2025-11-06 10:15 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 8:55 [PATCH net-next v2 00/11] net: stmmac: ingenic: convert to set_phy_intf_sel() Russell King (Oracle)
2025-11-06 8:57 ` [PATCH net-next v2 01/11] net: stmmac: ingenic: move ingenic_mac_init() Russell King (Oracle)
2025-11-06 9:58 ` Maxime Chevallier
2025-11-06 8:57 ` [PATCH net-next v2 02/11] net: stmmac: ingenic: simplify jz4775 mac_set_mode() Russell King (Oracle)
2025-11-06 9:59 ` Maxime Chevallier
2025-11-06 8:57 ` [PATCH net-next v2 03/11] net: stmmac: ingenic: use PHY_INTF_SEL_xxx to select PHY interface Russell King (Oracle)
2025-11-06 9:59 ` Maxime Chevallier
2025-11-06 8:57 ` [PATCH net-next v2 04/11] net: stmmac: ingenic: use PHY_INTF_SEL_x directly Russell King (Oracle)
2025-11-06 10:00 ` Maxime Chevallier
2025-11-06 8:57 ` [PATCH net-next v2 05/11] net: stmmac: ingenic: prep PHY_INTF_SEL_x field after switch() Russell King (Oracle)
2025-11-06 10:01 ` Maxime Chevallier
2025-11-06 8:57 ` [PATCH net-next v2 06/11] net: stmmac: ingenic: use stmmac_get_phy_intf_sel() Russell King (Oracle)
2025-11-06 10:05 ` Maxime Chevallier
2025-11-06 8:57 ` [PATCH net-next v2 07/11] net: stmmac: ingenic: move "MAC PHY control register" debug Russell King (Oracle)
2025-11-06 10:13 ` Maxime Chevallier
2025-11-06 8:57 ` [PATCH net-next v2 08/11] net: stmmac: ingenic: simplify mac_set_mode() methods Russell King (Oracle)
2025-11-06 10:15 ` Maxime Chevallier [this message]
2025-11-06 8:58 ` [PATCH net-next v2 09/11] net: stmmac: ingenic: simplify x2000 mac_set_mode() Russell King (Oracle)
2025-11-06 10:20 ` Maxime Chevallier
2025-11-06 8:58 ` [PATCH net-next v2 10/11] net: stmmac: ingenic: pass ingenic_mac struct rather than plat_dat Russell King (Oracle)
2025-11-06 10:22 ` Maxime Chevallier
2025-11-06 8:58 ` [PATCH net-next v2 11/11] net: stmmac: ingenic: use ->set_phy_intf_sel() Russell King (Oracle)
2025-11-06 10:30 ` Maxime Chevallier
2025-11-06 16:48 ` Simon Horman
2025-11-06 9:57 ` [PATCH net-next v2 00/11] net: stmmac: ingenic: convert to set_phy_intf_sel() Maxime Chevallier
2025-11-06 10:23 ` Russell King (Oracle)
2025-11-06 10:35 ` Maxime Chevallier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=60bd1571-e293-4748-adde-396bf193bac2@bootlin.com \
--to=maxime.chevallier@bootlin$(echo .)com \
--cc=alexandre.torgue@foss$(echo .)st.com \
--cc=andrew+netdev@lunn$(echo .)ch \
--cc=andrew@lunn$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=hkallweit1@gmail$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-stm32@st-md-mailman$(echo .)stormreply.com \
--cc=mcoquelin.stm32@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=rmk+kernel@armlinux$(echo .)org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox