From: Dimitri Fedrau <dima.fedrau@gmail.com>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Stefan Eichenberger <eichest@gmail.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [net-next 2/3] net: phy: marvell-88q2xxx: Make register writer function generic
Date: Thu, 12 Sep 2024 18:52:27 +0200 [thread overview]
Message-ID: <20240912165227.GB176933@debian> (raw)
In-Reply-To: <20240906133951.3433788-3-niklas.soderlund+renesas@ragnatech.se>
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@ragnatech.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@gmail.com>
Best regards,
Dimitri Fedrau
next prev parent reply other threads:[~2024-09-12 16:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-06 13:39 [net-next 0/3] net: phy: marvell-88q2xxx: Enable auto negotiation for mv88q2110 Niklas Söderlund
2024-09-06 13:39 ` [net-next 1/3] net: phy: marvell-88q2xxx: Align soft reset for mv88q2110 and mv88q2220 Niklas Söderlund
2024-09-10 20:21 ` Andrew Lunn
2024-09-12 16:51 ` Dimitri Fedrau
2024-09-25 12:22 ` Stefan Eichenberger
2024-09-06 13:39 ` [net-next 2/3] net: phy: marvell-88q2xxx: Make register writer function generic Niklas Söderlund
2024-09-06 20:18 ` Andrew Lunn
2024-09-10 20:21 ` Andrew Lunn
2024-09-12 16:52 ` Dimitri Fedrau [this message]
2024-09-25 12:23 ` Stefan Eichenberger
2024-09-06 13:39 ` [net-next 3/3] net: phy: marvell-88q2xxx: Enable auto negotiation for mv88q2110 Niklas Söderlund
2024-09-06 20:36 ` Andrew Lunn
2024-09-06 21:39 ` Niklas Söderlund
2024-09-10 16:32 ` Andrew Lunn
2024-09-10 18:02 ` Stefan Eichenberger
2024-09-10 20:18 ` Andrew Lunn
2024-09-10 20:23 ` Andrew Lunn
2024-09-14 14:00 ` Stefan Eichenberger
2024-09-14 14:21 ` Niklas Söderlund
2024-09-14 14:43 ` Andrew Lunn
2024-09-25 13:04 ` Stefan Eichenberger
2024-10-05 11:08 ` Niklas Söderlund
2024-09-14 14:50 ` Andrew Lunn
2024-09-25 11:56 ` Stefan Eichenberger
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=20240912165227.GB176933@debian \
--to=dima.fedrau@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eichest@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=pabeni@redhat.com \
--cc=yoshihiro.shimoda.uh@renesas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.