Netdev Archive on lore.kernel.org help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org> To: Dan Murphy <dmurphy@ti.com> Cc: <davem@davemloft.net>, <andrew@lunn.ch>, <f.fainelli@gmail.com>, <hkallweit1@gmail.com>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: Re: [PATCH net-next v3 1/3] net: dp83869: Add ability to advertise Fiber connection Date: Sat, 5 Sep 2020 11:17:55 -0700 [thread overview] Message-ID: <20200905111755.4bd874b2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw) In-Reply-To: <20200903114259.14013-2-dmurphy@ti.com> On Thu, 3 Sep 2020 06:42:57 -0500 Dan Murphy wrote: > Add the ability to advertise the Fiber connection if the strap or the > op-mode is configured for 100Base-FX. > > Auto negotiation is not supported on this PHY when in fiber mode. > > Signed-off-by: Dan Murphy <dmurphy@ti.com> Some comments, I'm not very phy-knowledgeable so bear with me (hopefully PHY maintainers can correct me, too). > diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c > index 58103152c601..48a68474f89c 100644 > --- a/drivers/net/phy/dp83869.c > +++ b/drivers/net/phy/dp83869.c > @@ -52,6 +52,11 @@ > BMCR_FULLDPLX | \ > BMCR_SPEED1000) > > +#define MII_DP83869_FIBER_ADVERTISE (ADVERTISED_TP | ADVERTISED_MII | \ > + ADVERTISED_FIBRE | ADVERTISED_BNC | \ I'm not actually sure myself what the semantics of port type advertise bits are, but if this is fiber why advertise TP and do you really have BNC connectors? :S > + ADVERTISED_Pause | ADVERTISED_Asym_Pause | \ > + ADVERTISED_100baseT_Full) You say 100Base-FX, yet you advertise 100Base-T? > /* This is the same bit mask as the BMCR so re-use the BMCR default */ > #define DP83869_FX_CTRL_DEFAULT MII_DP83869_BMCR_DEFAULT > > @@ -300,6 +305,7 @@ static int dp83869_configure_mode(struct phy_device *phydev, > { > int phy_ctrl_val; > int ret; > + int bmcr; Please keep reverse xmas tree ordering. > if (dp83869->mode < DP83869_RGMII_COPPER_ETHERNET || > dp83869->mode > DP83869_SGMII_COPPER_ETHERNET) > @@ -383,7 +389,37 @@ static int dp83869_configure_mode(struct phy_device *phydev, > > break; > case DP83869_RGMII_1000_BASE: > + break; > case DP83869_RGMII_100_BASE: > + /* Only allow advertising what this PHY supports */ > + linkmode_and(phydev->advertising, phydev->advertising, > + phydev->supported); > + > + linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, > + phydev->supported); > + linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, > + phydev->advertising); > + > + /* Auto neg is not supported in fiber mode */ > + bmcr = phy_read(phydev, MII_BMCR); > + if (bmcr < 0) > + return bmcr; > + > + phydev->autoneg = AUTONEG_DISABLE; > + linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, > + phydev->supported); > + linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, > + phydev->advertising); > + > + if (bmcr & BMCR_ANENABLE) { > + ret = phy_modify(phydev, MII_BMCR, BMCR_ANENABLE, 0); > + if (ret < 0) > + return ret; > + } > + > + phy_modify_changed(phydev, MII_ADVERTISE, > + MII_DP83869_FIBER_ADVERTISE, > + MII_DP83869_FIBER_ADVERTISE); This only accesses standard registers, should it perhaps be a helper in the kernel's phy code? > break; > default: > return -EINVAL;
next prev parent reply other threads:[~2020-09-05 18:18 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-03 11:42 [PATCH net-next v3 0/3] DP83869 Feature additions Dan Murphy 2020-09-03 11:42 ` [PATCH net-next v3 1/3] net: dp83869: Add ability to advertise Fiber connection Dan Murphy 2020-09-05 18:17 ` Jakub Kicinski [this message] 2020-09-07 14:29 ` Andrew Lunn 2020-09-10 17:54 ` Dan Murphy 2020-09-10 18:09 ` Andrew Lunn 2020-09-03 11:42 ` [PATCH net-next v3 2/3] net: phy: dp83869: support Wake on LAN Dan Murphy 2020-09-05 18:34 ` Jakub Kicinski 2020-09-10 17:34 ` Dan Murphy 2020-09-10 18:02 ` Andrew Lunn 2020-09-10 18:21 ` Dan Murphy 2020-09-03 11:42 ` [PATCH net-next v3 3/3] net: dp83869: Add speed optimization feature Dan Murphy 2020-09-05 18:38 ` Jakub Kicinski 2020-09-08 14:07 ` Dan Murphy 2020-09-08 17:47 ` Jakub Kicinski 2020-09-10 17:34 ` Dan Murphy
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=20200905111755.4bd874b2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \ --to=kuba@kernel.org \ --cc=andrew@lunn.ch \ --cc=davem@davemloft.net \ --cc=dmurphy@ti.com \ --cc=f.fainelli@gmail.com \ --cc=hkallweit1@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=netdev@vger.kernel.org \ /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: linkBe 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).