[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240912165227.GB176933@debian>
Date: Thu, 12 Sep 2024 18:52:27 +0200
From: Dimitri Fedrau <dima.fedrau@...il.com>
To: Niklas Söderlund <niklas.soderlund+renesas@...natech.se>
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Stefan Eichenberger <eichest@...il.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
netdev@...r.kernel.org, linux-renesas-soc@...r.kernel.org
Subject: Re: [net-next 2/3] net: phy: marvell-88q2xxx: Make register writer
function generic
Am Fri, Sep 06, 2024 at 03:39:50PM +0200 schrieb Niklas Söderlund:
> In preparation to adding auto negotiation support to mv88q2110 move and
> rename the helper function used to write an array of register values to
> the PHY.
>
> Just as for mv88q2220 devices this helper will be needed to for the
> initial configuration of the mv88q2110 to support auto negotiation.
>
> The function is moved verbatim, there is no change in behavior.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@...natech.se>
> ---
> drivers/net/phy/marvell-88q2xxx.c | 40 +++++++++++++++----------------
> 1 file changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c
> index 850beb4b1722..31f8c976e387 100644
> --- a/drivers/net/phy/marvell-88q2xxx.c
> +++ b/drivers/net/phy/marvell-88q2xxx.c
> @@ -174,6 +174,21 @@ static const struct mmd_val mv88q222x_revb1_revb2_init_seq1[] = {
> { MDIO_MMD_PCS, 0xfe11, 0x1105 },
> };
>
> +static int mv88q2xxx_write_mmd_vals(struct phy_device *phydev,
> + const struct mmd_val *vals, size_t len)
> +{
> + int ret;
> +
> + for (; len; vals++, len--) {
> + ret = phy_write_mmd(phydev, vals->devad, vals->regnum,
> + vals->val);
> + if (ret < 0)
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> static int mv88q2xxx_soft_reset(struct phy_device *phydev)
> {
> int ret;
> @@ -724,33 +739,18 @@ static int mv88q2xxx_probe(struct phy_device *phydev)
> return mv88q2xxx_hwmon_probe(phydev);
> }
>
> -static int mv88q222x_write_mmd_vals(struct phy_device *phydev,
> - const struct mmd_val *vals, size_t len)
> -{
> - int ret;
> -
> - for (; len; vals++, len--) {
> - ret = phy_write_mmd(phydev, vals->devad, vals->regnum,
> - vals->val);
> - if (ret < 0)
> - return ret;
> - }
> -
> - return 0;
> -}
> -
> static int mv88q222x_revb0_config_init(struct phy_device *phydev)
> {
> int ret;
>
> - ret = mv88q222x_write_mmd_vals(phydev, mv88q222x_revb0_init_seq0,
> + ret = mv88q2xxx_write_mmd_vals(phydev, mv88q222x_revb0_init_seq0,
> ARRAY_SIZE(mv88q222x_revb0_init_seq0));
> if (ret < 0)
> return ret;
>
> usleep_range(5000, 10000);
>
> - ret = mv88q222x_write_mmd_vals(phydev, mv88q222x_revb0_init_seq1,
> + ret = mv88q2xxx_write_mmd_vals(phydev, mv88q222x_revb0_init_seq1,
> ARRAY_SIZE(mv88q222x_revb0_init_seq1));
> if (ret < 0)
> return ret;
> @@ -764,17 +764,17 @@ static int mv88q222x_revb1_revb2_config_init(struct phy_device *phydev)
> int ret;
>
> if (is_rev_b1)
> - ret = mv88q222x_write_mmd_vals(phydev, mv88q222x_revb1_init_seq0,
> + ret = mv88q2xxx_write_mmd_vals(phydev, mv88q222x_revb1_init_seq0,
> ARRAY_SIZE(mv88q222x_revb1_init_seq0));
> else
> - ret = mv88q222x_write_mmd_vals(phydev, mv88q222x_revb2_init_seq0,
> + ret = mv88q2xxx_write_mmd_vals(phydev, mv88q222x_revb2_init_seq0,
> ARRAY_SIZE(mv88q222x_revb2_init_seq0));
> if (ret < 0)
> return ret;
>
> usleep_range(3000, 5000);
>
> - ret = mv88q222x_write_mmd_vals(phydev, mv88q222x_revb1_revb2_init_seq1,
> + ret = mv88q2xxx_write_mmd_vals(phydev, mv88q222x_revb1_revb2_init_seq1,
> ARRAY_SIZE(mv88q222x_revb1_revb2_init_seq1));
> if (ret < 0)
> return ret;
> --
> 2.46.0
>
Hi Niklas,
tested with a mv88q2220 device, worked as expected.
Tested-by: Dimitri Fedrau <dima.fedrau@...il.com>
Best regards,
Dimitri Fedrau
Powered by blists - more mailing lists