From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Gregor Herburger <gregor.herburger@ew.tq-group.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Dimitri Fedrau <dima.fedrau@gmail.com>,
Stefan Eichenberger <eichest@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux@ew.tq-group.com, alexander.stein@ew.tq-group.com
Subject: Re: [PATCH] net: phy: marvell-88q2xxx: add support for Rev B1 and B2
Date: Wed, 3 Apr 2024 14:59:37 +0100 [thread overview]
Message-ID: <Zg1gycEDL4llYrjI@shell.armlinux.org.uk> (raw)
In-Reply-To: <20240403-mv88q222x-revb1-b2-init-v1-1-48b855464c37@ew.tq-group.com>
On Wed, Apr 03, 2024 at 03:45:22PM +0200, Gregor Herburger wrote:
> +static int mv88q222x_revb1_revb2_config_init(struct phy_device *phydev)
> +{
> + bool is_rev_b2 = phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] == PHY_ID_88Q2220_REVB2;
> + int ret, i;
> +
> + for (i = 0; i < ARRAY_SIZE(mv88q222x_revb1_init_seq0); i++) {
> + /* Rev B2 init sequence differs compared to Rev B1. As noted in Marvell API:
> + * Remove the instruction to enable TXDAC setting overwrite bit for Rev B2.
> + */
> + if (is_rev_b2 && mv88q222x_revb1_init_seq1[i].regnum == 0xffe3)
> + continue;
> +
> + ret = phy_write_mmd(phydev, mv88q222x_revb1_init_seq0[i].devad,
> + mv88q222x_revb1_init_seq0[i].regnum,
> + mv88q222x_revb1_init_seq0[i].val);
> + if (ret < 0)
> + return ret;
> + }
> +
> + usleep_range(3000, 5000);
> +
> + for (i = 0; i < ARRAY_SIZE(mv88q222x_revb1_init_seq1); i++) {
> + ret = phy_write_mmd(phydev, mv88q222x_revb1_init_seq1[i].devad,
> + mv88q222x_revb1_init_seq1[i].regnum,
> + mv88q222x_revb1_init_seq1[i].val);
> + if (ret < 0)
> + return ret;
> + }
I think a helper would be useful to write these sequences, rather than
writing the same code several times:
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;
}
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2024-04-03 13:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 13:45 [PATCH] net: phy: marvell-88q2xxx: add support for Rev B1 and B2 Gregor Herburger
2024-04-03 13:59 ` Russell King (Oracle) [this message]
2024-04-04 14:06 ` Gregor Herburger
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=Zg1gycEDL4llYrjI@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=alexander.stein@ew.tq-group.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=dima.fedrau@gmail.com \
--cc=edumazet@google.com \
--cc=eichest@gmail.com \
--cc=gregor.herburger@ew.tq-group.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@ew.tq-group.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).