From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Parshuram Thombare <pthombar@cadence.com>
Cc: andrew@lunn.ch, nicolas.ferre@microchip.com, davem@davemloft.net,
f.fainelli@gmail.com, netdev@vger.kernel.org,
hkallweit1@gmail.com, linux-kernel@vger.kernel.org,
rafalc@cadence.com, aniljoy@cadence.com, piotrs@cadence.com
Subject: Re: [PATCH v3 1/5] net: macb: add phylink support
Date: Fri, 21 Jun 2019 14:29:10 +0100 [thread overview]
Message-ID: <20190621132910.kd6y2i3vk6ogcher@shell.armlinux.org.uk> (raw)
In-Reply-To: <1561106084-8241-1-git-send-email-pthombar@cadence.com>
On Fri, Jun 21, 2019 at 09:34:44AM +0100, Parshuram Thombare wrote:
> @@ -438,115 +439,145 @@ static void macb_set_tx_clk(struct clk *clk, int speed, struct net_device *dev)
> netdev_err(dev, "adjusting tx_clk failed.\n");
> }
>
> -static void macb_handle_link_change(struct net_device *dev)
> +static void gem_phylink_validate(struct phylink_config *pl_config,
> + unsigned long *supported,
> + struct phylink_link_state *state)
> {
> - struct macb *bp = netdev_priv(dev);
> - struct phy_device *phydev = dev->phydev;
> - unsigned long flags;
> - int status_change = 0;
> + struct net_device *netdev = to_net_dev(pl_config->dev);
> + struct macb *bp = netdev_priv(netdev);
> + __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
> +
> + switch (state->interface) {
> + case PHY_INTERFACE_MODE_GMII:
> + case PHY_INTERFACE_MODE_RGMII:
> + if (bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE) {
> + phylink_set(mask, 1000baseT_Full);
> + phylink_set(mask, 1000baseX_Full);
> + if (!(bp->caps & MACB_CAPS_NO_GIGABIT_HALF)) {
> + phylink_set(mask, 1000baseT_Half);
> + phylink_set(mask, 1000baseT_Half);
> + }
> + }
> + /* fallthrough */
> + case PHY_INTERFACE_MODE_MII:
> + case PHY_INTERFACE_MODE_RMII:
> + phylink_set(mask, 10baseT_Half);
> + phylink_set(mask, 10baseT_Full);
> + phylink_set(mask, 100baseT_Half);
> + phylink_set(mask, 100baseT_Full);
> + break;
> + default:
> + break;
PHY_INTERFACE_MODE_NA is used to ascertain the _full_ set of support
from the MAC irrespective of interface mode, so that (eg) SFPs can
select an appropriate interface mode from the subset of capabililties
supported by the SFP and MAC.
Also note this behaviour for MACs that support switching between
2500BASE-X and 1000BASE-X (which are fixed speed BASE-X):
static void mvneta_validate(struct net_device *ndev, unsigned long *supported,
struct phylink_link_state *state)
{
...
/* Half-duplex at speeds higher than 100Mbit is unsupported */
if (pp->comphy || state->interface != PHY_INTERFACE_MODE_2500BASEX) {
phylink_set(mask, 1000baseT_Full);
phylink_set(mask, 1000baseX_Full);
}
if (pp->comphy || state->interface == PHY_INTERFACE_MODE_2500BASEX) {
phylink_set(mask, 2500baseT_Full);
phylink_set(mask, 2500baseX_Full);
}
The idea here is that _if_ we have a comphy, we can reprogram the comphy
to select between 1G and 2.5G speeds. So we offer both 1G and 2.5G
capabilities irrespective of interface mode.
When the interface type is set in mvneta_mac_config(), the comphy is
configured for the link mode, including setting the link speed to either
1.25Gbaud or 3.125Gbaud.
So, the speed of the serdes lane is determined by the selected
PHY_INTERFACE_MODE.
There is additional logic in the mvneta_validate() method to deal with
the selection of 1G and 2.5G modes for BASE-X:
/* We can only operate at 2500BaseX or 1000BaseX. If requested
* to advertise both, only report advertising at 2500BaseX.
*/
phylink_helper_basex_speed(state);
What this does is clear state->advertising, ensuring that only one of
2500BASE_X or 1000BASE_X is shown, and also sets state->interface in
the validate callback accordingly to select the interface mode.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
next prev parent reply other threads:[~2019-06-21 13:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 8:33 [PATCH v3 0/5] net: macb: cover letter Parshuram Thombare
2019-06-21 8:34 ` [PATCH v3 1/5] net: macb: add phylink support Parshuram Thombare
2019-06-21 13:29 ` Russell King - ARM Linux admin [this message]
2019-06-21 8:34 ` [PATCH v3 2/5] net: macb: add support for sgmii MAC-PHY interface Parshuram Thombare
2019-06-21 8:52 ` Russell King - ARM Linux admin
2019-06-21 9:03 ` Russell King - ARM Linux admin
2019-06-21 8:34 ` [PATCH v3 3/5] net: macb: add support for c45 PHY Parshuram Thombare
2019-06-21 13:17 ` Andrew Lunn
2019-06-21 8:35 ` [PATCH v3 4/5] net: macb: add support for high speed interface Parshuram Thombare
2019-06-21 8:35 ` [PATCH v3 5/5] net: macb: parameter added to cadence ethernet controller DT binding Parshuram Thombare
2019-06-21 13:16 ` [PATCH v3 0/5] net: macb: cover letter Andrew Lunn
2019-06-22 3:18 ` Parshuram Raju Thombare
2019-06-22 8:41 ` Russell King - ARM Linux admin
2019-06-22 14:54 ` Andrew Lunn
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=20190621132910.kd6y2i3vk6ogcher@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=aniljoy@cadence.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=piotrs@cadence.com \
--cc=pthombar@cadence.com \
--cc=rafalc@cadence.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).