From: Andrew Lunn <andrew@lunn•ch>
To: Russell King - ARM Linux admin <linux@armlinux•org.uk>
Cc: Ivan Bornyakov <i.bornyakov@metrotek•ru>,
netdev@vger•kernel.org, system@metrotek•ru, hkallweit1@gmail•com,
davem@davemloft•net, kuba@kernel•org,
linux-kernel@vger•kernel.org
Subject: Re: [PATCH v2] net: phy: add Marvell 88X2222 transceiver support
Date: Sat, 20 Feb 2021 17:30:29 +0100 [thread overview]
Message-ID: <YDE5Ja/O4sk4hewj@lunn.ch> (raw)
In-Reply-To: <20210220115303.GL1463@shell.armlinux.org.uk>
> > +/* switch line-side interface between 10GBase-R and 1GBase-X
> > + * according to speed */
> > +static void mv2222_update_interface(struct phy_device *phydev)
> > +{
> > + struct mv2222_data *priv = phydev->priv;
> > +
> > + if (phydev->speed == SPEED_10000 &&
> > + priv->line_interface == PHY_INTERFACE_MODE_1000BASEX) {
> > + priv->line_interface = PHY_INTERFACE_MODE_10GBASER;
> > +
> > + phy_write_mmd(phydev, MDIO_MMD_VEND2, MV_PCS_CONFIG,
> > + MV_PCS_HOST_XAUI | MV_PCS_LINE_10GBR);
> > + mv2222_soft_reset(phydev);
> > + }
> > +
> > + if (phydev->speed == SPEED_1000 &&
> > + priv->line_interface == PHY_INTERFACE_MODE_10GBASER) {
> > + priv->line_interface = PHY_INTERFACE_MODE_1000BASEX;
> > +
> > + phy_write_mmd(phydev, MDIO_MMD_VEND2, MV_PCS_CONFIG,
> > + MV_PCS_HOST_XAUI | MV_PCS_LINE_1GBX_AN);
> > + mv2222_soft_reset(phydev);
> > + }
>
> Wouldn't it be better to have a single function to set the line
> interface, used by both this function and your sfp_module_insert
> function? I'm thinking something like:
>
> static int mv2222_set_line_interface(struct phy_device *phydev,
> phy_interface_t line_interface)
> {
> ...
> }
>
> and calling that from both these locations to configure the PHY for
> 10GBASE-R, 1000BASE-X and SGMII modes.
Agreed. This got me confused, wondering where the SGMII handling was.
Andrew
next prev parent reply other threads:[~2021-02-20 16:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 19:22 [PATCH] net: phy: add Marvell 88X2222 transceiver support Ivan Bornyakov
2021-02-01 22:56 ` Andrew Lunn
2021-02-02 15:32 ` Ivan Bornyakov
2021-02-02 16:48 ` Russell King - ARM Linux admin
2021-02-02 20:45 ` Ivan Bornyakov
2021-02-20 9:46 ` [PATCH v2] " Ivan Bornyakov
2021-02-20 11:53 ` Russell King - ARM Linux admin
2021-02-20 15:51 ` Ivan Bornyakov
2021-02-20 16:30 ` Andrew Lunn [this message]
2021-02-20 16:27 ` Andrew Lunn
2021-03-03 10:57 ` [PATCH v3] " Ivan Bornyakov
2021-03-03 11:36 ` Russell King - ARM Linux admin
2021-03-03 15:27 ` Ivan Bornyakov
2021-03-03 16:02 ` [PATCH v4] " Ivan Bornyakov
2021-03-10 9:33 ` Ivan Bornyakov
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=YDE5Ja/O4sk4hewj@lunn.ch \
--to=andrew@lunn$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=hkallweit1@gmail$(echo .)com \
--cc=i.bornyakov@metrotek$(echo .)ru \
--cc=kuba@kernel$(echo .)org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux@armlinux$(echo .)org.uk \
--cc=netdev@vger$(echo .)kernel.org \
--cc=system@metrotek$(echo .)ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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