[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tgurnug3ftp53gui6wwz25lo77b52clgmoqvgq5dcps2fi2xv5@uzzqvtoogy3i>
Date: Thu, 14 Sep 2023 15:13:10 +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 6/6] net: stmmac: qos-eth: use
dwmac_set_tx_clk_gmii()
On Mon, Sep 11, 2023 at 04:29:36PM +0100, Russell King (Oracle) wrote:
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> ---
> .../stmicro/stmmac/dwmac-dwc-qos-eth.c | 37 ++++++-------------
> 1 file changed, 11 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> index 61ebf36da13d..a8fae37b9858 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> @@ -22,6 +22,7 @@
> #include <linux/stmmac.h>
>
> #include "stmmac_platform.h"
> +#include "stmmac_plat_lib.h"
> #include "dwmac4.h"
>
> struct tegra_eqos {
> @@ -181,32 +182,10 @@ static void dwc_qos_remove(struct platform_device *pdev)
> static void tegra_eqos_fix_speed(void *priv, unsigned int speed, unsigned int mode)
> {
> struct tegra_eqos *eqos = priv;
> - unsigned long rate = 125000000;
> - bool needs_calibration = false;
> u32 value;
> int err;
>
> - switch (speed) {
> - case SPEED_1000:
> - needs_calibration = true;
> - rate = 125000000;
> - break;
> -
> - case SPEED_100:
> - needs_calibration = true;
> - rate = 25000000;
> - break;
> -
> - case SPEED_10:
> - rate = 2500000;
> - break;
> -
> - default:
> - dev_err(eqos->dev, "invalid speed %u\n", speed);
> - break;
> - }
> -
> - if (needs_calibration) {
> + if (speed == SPEED_1000 || speed == SPEED_100) {
> /* calibrate */
> value = readl(eqos->regs + SDMEMCOMPPADCTRL);
> value |= SDMEMCOMPPADCTRL_PAD_E_INPUT_OR_E_PWRD;
> @@ -246,9 +225,15 @@ static void tegra_eqos_fix_speed(void *priv, unsigned int speed, unsigned int mo
> writel(value, eqos->regs + AUTO_CAL_CONFIG);
> }
>
> - err = clk_set_rate(eqos->clk_tx, rate);
> - if (err < 0)
> - dev_err(eqos->dev, "failed to set TX rate: %d\n", err);
> + err = dwmac_set_tx_clk_gmii(eqos->clk_tx, speed);
> + if (err == -ENOTSUPP) {
> + dev_err(eqos->dev, "invalid speed %dMbps\n", speed);
%u?
> + err = dwmac_set_tx_clk_gmii(eqos->clk_tx, SPEED_1000);
> + } else if (err) {
> + dev_err(eqos->dev,
> + "failed to set tx rate for speed %dMbps: %pe\n",
ditto
-Serge(y)
> + speed, ERR_PTR(err));
> + }
> }
>
> static int tegra_eqos_init(struct platform_device *pdev, void *priv)
> --
> 2.30.2
>
>
Powered by blists - more mailing lists