[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ad2oatdtyjr3d65daxl3haciywxjl4s57i6lnnzgqpwpwkcgc2@c4inrmr55uca>
Date: Thu, 14 Sep 2023 18:04:09 +0300
From: Serge Semin <fancer.lancer@...il.com>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc: Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>, Alexei Starovoitov <ast@...nel.org>, bpf@...r.kernel.org,
Daniel Borkmann <daniel@...earbox.net>, "David S. Miller" <davem@...emloft.net>,
Emil Renner Berthing <kernel@...il.dk>, Eric Dumazet <edumazet@...gle.com>,
Fabio Estevam <festevam@...il.com>, Jakub Kicinski <kuba@...nel.org>,
Jesper Dangaard Brouer <hawk@...nel.org>, John Fastabend <john.fastabend@...il.com>,
linux-arm-kernel@...ts.infradead.org, linux-stm32@...md-mailman.stormreply.com,
Maxime Coquelin <mcoquelin.stm32@...il.com>, netdev@...r.kernel.org, NXP Linux Team <linux-imx@....com>,
Paolo Abeni <pabeni@...hat.com>, Pengutronix Kernel Team <kernel@...gutronix.de>,
Samin Guo <samin.guo@...rfivetech.com>, Sascha Hauer <s.hauer@...gutronix.de>,
Shawn Guo <shawnguo@...nel.org>
Subject: Re: [PATCH net-next 5/6] net: stmmac: starfive: use
stmmac_set_tx_clk_gmii()
On Thu, Sep 14, 2023 at 02:51:40PM +0100, Russell King (Oracle) wrote:
> Use stmmac_set_tx_clk_gmii().
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
Reviewed-by: Serge Semin <fancer.lancer@...il.com>
-Serge(y)
> ---
> .../ethernet/stmicro/stmmac/dwmac-starfive.c | 28 +++++--------------
> 1 file changed, 7 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
> index 9289bb87c3e3..c2931464e977 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
> @@ -27,29 +27,15 @@ struct starfive_dwmac {
> static void starfive_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
> {
> struct starfive_dwmac *dwmac = priv;
> - unsigned long rate;
> int err;
>
> - rate = clk_get_rate(dwmac->clk_tx);
> -
> - switch (speed) {
> - case SPEED_1000:
> - rate = 125000000;
> - break;
> - case SPEED_100:
> - rate = 25000000;
> - break;
> - case SPEED_10:
> - rate = 2500000;
> - break;
> - default:
> - dev_err(dwmac->dev, "invalid speed %u\n", speed);
> - break;
> - }
> -
> - err = clk_set_rate(dwmac->clk_tx, rate);
> - if (err)
> - dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate);
> + err = stmmac_set_tx_clk_gmii(dwmac->clk_tx, speed);
> + if (err == -ENOTSUPP)
> + dev_err(dwmac->dev, "invalid speed %uMbps\n", speed);
> + else if (err)
> + dev_err(dwmac->dev,
> + "failed to set tx rate for speed %uMbps: %pe\n",
> + speed, ERR_PTR(err));
> }
>
> static int starfive_dwmac_set_mode(struct plat_stmmacenet_data *plat_dat)
> --
> 2.30.2
>
>
Powered by blists - more mailing lists