public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn•ch>
To: Russell King <rmk+kernel@armlinux•org.uk>
Cc: Florian Fainelli <f.fainelli@gmail•com>, netdev@vger•kernel.org
Subject: Re: [PATCH 5/5] net: phy: add Marvell Alaska X 88X3310 10Gigabit PHY support
Date: Thu, 1 Jun 2017 14:51:50 +0200	[thread overview]
Message-ID: <20170601125150.GE9282@lunn.ch> (raw)
In-Reply-To: <E1dGNJc-000442-8H@rmk-PC.armlinux.org.uk>

> +static int mv3310_read_status(struct phy_device *phydev)
> +{
> +	u32 mmd_mask = phydev->c45_ids.devices_in_package;
> +	int val;
> +
> +	/* The vendor devads do not report link status.  Avoid the PHYXS
> +	 * instance as there are three, and its status depends on the MAC
> +	 * being appropriately configured for the negotiated speed.
> +	 */
> +	mmd_mask &= ~(BIT(MDIO_MMD_VEND1) | BIT(MDIO_MMD_VEND2) |
> +		      BIT(MDIO_MMD_PHYXS));
> +
> +	phydev->speed = SPEED_UNKNOWN;
> +	phydev->duplex = DUPLEX_UNKNOWN;
> +	phydev->lp_advertising = 0;
> +	phydev->link = 0;
> +	phydev->pause = 0;
> +	phydev->asym_pause = 0;
> +
> +	val = phy_read_mmd(phydev, MDIO_MMD_PCS, MV_PCS_BASE_R + MDIO_STAT1);
> +	if (val < 0)
> +		return val;
> +
> +	if (val & MDIO_STAT1_LSTATUS)
> +		return mv3310_read_10gbr_status(phydev);
> +
> +	val = genphy_c45_read_link(phydev, mmd_mask);
> +	if (val < 0)
> +		return val;
> +
> +	phydev->link = val > 0 ? 1 : 0;
> +
> +	val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1);
> +	if (val < 0)
> +		return val;
> +
> +	if (val & MDIO_AN_STAT1_COMPLETE) {
> +		val = genphy_c45_read_lpa(phydev);
> +		if (val < 0)
> +			return val;
> +
> +		/* Read the link partner's 1G advertisment */
> +		val = phy_read_mmd(phydev, MDIO_MMD_AN, MV_AN_STAT1000);
> +		if (val < 0)
> +			return val;
> +
> +		phydev->lp_advertising |= mii_stat1000_to_ethtool_lpa_t(val);
> +
> +		if (phydev->autoneg == AUTONEG_ENABLE) {
> +			val = phy_read_mmd(phydev, MDIO_MMD_AN, MV_AN_RESULT);
> +			if (val < 0)
> +				return val;
> +
> +			if (val & MV_AN_RESULT_SPD_10000)
> +				phydev->speed = SPEED_10000;
> +			else if (val & MV_AN_RESULT_SPD_1000)
> +				phydev->speed = SPEED_1000;
> +			else if (val & MV_AN_RESULT_SPD_100)
> +				phydev->speed = SPEED_100;
> +			else if (val & MV_AN_RESULT_SPD_10)
> +				phydev->speed = SPEED_10;
> +
> +			phydev->duplex = DUPLEX_FULL;
> +		}
> +	}
> +
> +	if (phydev->autoneg != AUTONEG_ENABLE) {
> +		val = genphy_c45_read_pma(phydev);
> +		if (val < 0)
> +			return val;
> +	}
> +
> +	if ((phydev->interface == PHY_INTERFACE_MODE_SGMII ||
> +	     phydev->interface == PHY_INTERFACE_MODE_10GKR) && phydev->link) {
> +		/* The PHY automatically switches its serdes interface (and
> +		 * active PHYXS instance) between Cisco SGMII and 10GBase-KR
> +		 * modes according to the speed.  Florian suggests setting
> +		 * phydev->interface to communicate this to the MAC. Only do
> +		 * this if we are already in either SGMII or 10GBase-KR mode.
> +		 */

Hi Russell

Just for my understanding. The MAC should check phydev->interface in
its adjust_link function? Can we document this here please. I wounder
if there is somewhere in the generic code we should also document
this?

> +static struct phy_driver mv3310_drivers[] = {
> +	{
> +		.phy_id		= 0x002b09aa,
> +		.phy_id_mask	= 0xffffffff,

How about adding this ID to include/linux/marvell_phy.h? Or do you
think this is not actually a Marvell ID, but some 3rd party which
Marvell has licensed it from?

	Andrew

  reply	other threads:[~2017-06-01 12:51 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 10:23 [PATCH 0/5] Add phylib support for MV88X3310 10G phy Russell King - ARM Linux
2017-06-01 10:26 ` [PATCH 1/5] net: phy: add 802.3 clause 45 support to phylib Russell King
2017-06-01 12:28   ` Andrew Lunn
2017-06-01 17:15   ` Florian Fainelli
2017-06-02 12:39     ` Russell King - ARM Linux
2017-06-01 10:26 ` [PATCH 2/5] net: phy: hook up clause 45 autonegotiation restart Russell King
2017-06-01 12:23   ` Andrew Lunn
2017-06-01 12:51     ` Russell King - ARM Linux
2017-06-01 13:05       ` Andrew Lunn
2017-06-01 13:09         ` Russell King - ARM Linux
2017-06-01 13:19           ` Andrew Lunn
2017-06-01 15:47             ` Russell King - ARM Linux
2017-06-01 16:24               ` Russell King - ARM Linux
2017-06-01 17:16                 ` Florian Fainelli
2017-06-02 12:43                   ` Russell King - ARM Linux
2017-06-02 13:46                     ` Andrew Lunn
2017-06-02 14:04                       ` Russell King - ARM Linux
2017-06-01 10:26 ` [PATCH 3/5] net: phy: split out 10G genphy support Russell King
2017-06-01 12:29   ` Andrew Lunn
2017-06-01 17:17   ` Florian Fainelli
2017-06-01 10:26 ` [PATCH 4/5] net: phy: add XAUI and 10GBASE-KR PHY connection types Russell King
     [not found]   ` <E1dGNJX-00043v-3M-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org>
2017-06-01 12:30     ` Andrew Lunn
2017-06-01 16:56   ` Florian Fainelli
     [not found]     ` <fb1a81e0-b5b9-80e4-7852-cc65a574b9e9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-06-01 17:32       ` Russell King - ARM Linux
2017-06-01 10:26 ` [PATCH 5/5] net: phy: add Marvell Alaska X 88X3310 10Gigabit PHY support Russell King
2017-06-01 12:51   ` Andrew Lunn [this message]
2017-06-01 13:06     ` Russell King - ARM Linux
2017-06-01 17:28   ` Florian Fainelli
2017-06-01 17:57     ` Russell King - ARM Linux
2017-06-01 16:07 ` [PATCH 0/5] Add phylib support for MV88X3310 10G phy David Miller
     [not found]   ` <20170601.120736.670167741447008364.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2017-06-01 16:54     ` Russell King - ARM Linux
     [not found] ` <20170601102327.GF27796-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
2017-06-05 11:22   ` [PATCH v2 0/6] " Russell King - ARM Linux
2017-06-05 11:22     ` [PATCH 1/6] net: phy: add 802.3 clause 45 support to phylib Russell King
2017-06-05 16:25       ` Florian Fainelli
2017-06-05 11:22     ` [PATCH 2/6] net: phy: avoid genphy_aneg_done() for PHYs without clause 22 support Russell King
2017-06-05 11:58       ` Andrew Lunn
2017-06-05 16:29       ` Florian Fainelli
2017-06-05 11:23     ` [PATCH 3/6] net: phy: hook up clause 45 autonegotiation restart Russell King
2017-06-05 11:59       ` Andrew Lunn
2017-06-05 16:30       ` Florian Fainelli
2017-06-05 11:23     ` [PATCH 4/6] net: phy: split out 10G genphy support Russell King
2017-06-05 11:23     ` [PATCH 5/6] net: phy: add XAUI and 10GBASE-KR PHY connection types Russell King
     [not found]       ` <E1dHq6I-0005XE-VR-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org>
2017-06-05 12:00         ` Andrew Lunn
2017-06-05 16:24       ` Florian Fainelli
2017-06-05 11:23     ` [PATCH 6/6] net: phy: add Marvell Alaska X 88X3310 10Gigabit PHY support Russell King
2017-06-05 18:20       ` Andrew Lunn
2017-06-05 18:21       ` Florian Fainelli
2017-06-05 18:21       ` Andrew Lunn
2017-06-05 22:10         ` Russell King - ARM Linux
     [not found]     ` <20170605112203.GA10680-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
2017-06-05 21:53       ` [PATCH v2 0/6] Add phylib support for MV88X3310 10G phy David Miller

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=20170601125150.GE9282@lunn.ch \
    --to=andrew@lunn$(echo .)ch \
    --cc=f.fainelli@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=rmk+kernel@armlinux$(echo .)org.uk \
    /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