[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<TY7PR01MB148186C2CDCC2FC8694547BF192BD2@TY7PR01MB14818.jpnprd01.prod.outlook.com>
Date: Wed, 16 Apr 2025 04:56:58 +0000
From: <nobuhiro1.iwamatsu@...hiba.co.jp>
To: <rmk+kernel@...linux.org.uk>, <andrew@...n.ch>, <hkallweit1@...il.com>
CC: <alexandre.torgue@...s.st.com>, <andrew+netdev@...n.ch>,
<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<mcoquelin.stm32@...il.com>, <netdev@...r.kernel.org>,
<pabeni@...hat.com>
Subject: RE: [PATCH net-next] net: stmmac: visconti: convert to
set_clk_tx_rate() method
Hi Russell,
Thanks for your update!
> -----Original Message-----
> From: Russell King <rmk@...linux.org.uk> On Behalf Of Russell King (Oracle)
> Sent: Wednesday, April 16, 2025 1:53 AM
> To: Andrew Lunn <andrew@...n.ch>; Heiner Kallweit
> <hkallweit1@...il.com>
> Cc: Alexandre Torgue <alexandre.torgue@...s.st.com>; Andrew Lunn
> <andrew+netdev@...n.ch>; David S. Miller <davem@...emloft.net>; Eric
> Dumazet <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>;
> linux-arm-kernel@...ts.infradead.org;
> linux-stm32@...md-mailman.stormreply.com; Maxime Coquelin
> <mcoquelin.stm32@...il.com>; netdev@...r.kernel.org; iwamatsu
> nobuhiro(岩松 信洋 □DITC○CPT)
> <nobuhiro1.iwamatsu@...hiba.co.jp>; Paolo Abeni <pabeni@...hat.com>
> Subject: [PATCH net-next] net: stmmac: visconti: convert to set_clk_tx_rate()
> method
>
> Convert visconti to use the set_clk_tx_rate() method. By doing so, the GMAC
> control register will already have been updated (unlike with the
> fix_mac_speed() method) so this code can be removed while porting to the
> set_clk_tx_rate() method.
>
> There is also no need for the spinlock, and has never been - neither
> fix_mac_speed() nor set_clk_tx_rate() can be called by more than one thread at
> a time, so the lock does nothing useful.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> ---
> .../ethernet/stmicro/stmmac/dwmac-visconti.c | 18 ++++--------------
> 1 file changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
> b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
> index e1de471b215c..2215aef3ef42 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
> @@ -51,22 +51,16 @@ struct visconti_eth {
> u32 phy_intf_sel;
> struct clk *phy_ref_clk;
> struct device *dev;
> - spinlock_t lock; /* lock to protect register update */
> };
>
> -static void visconti_eth_fix_mac_speed(void *priv, int speed, unsigned int
> mode)
> +static int visconti_eth_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i,
> + phy_interface_t interface, int speed)
> {
> struct visconti_eth *dwmac = priv;
> struct net_device *netdev = dev_get_drvdata(dwmac->dev);
> unsigned int val, clk_sel_val = 0;
> unsigned long flags;
>
> - spin_lock_irqsave(&dwmac->lock, flags);
> -
> - /* adjust link */
> - val = readl(dwmac->reg + MAC_CTRL_REG);
> - val &= ~(GMAC_CONFIG_PS | GMAC_CONFIG_FES);
> -
> switch (speed) {
> case SPEED_1000:
> if (dwmac->phy_intf_sel == ETHER_CONFIG_INTF_RGMII)
> @@ -89,12 +83,9 @@ static void visconti_eth_fix_mac_speed(void *priv, int
> speed, unsigned int mode)
> default:
> /* No bit control */
> netdev_err(netdev, "Unsupported speed request (%d)",
> speed);
> - spin_unlock_irqrestore(&dwmac->lock, flags);
> return;
We need to set the return code (-EINVAL).
Best regards,
Nobuhiro
Powered by blists - more mailing lists