mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
To: Qingtao Cao <qingtao.cao.au@gmail.com>
Cc: Qingtao Cao <qingtao.cao@digi.com>, Andrew Lunn <andrew@lunn.ch>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v3 1/1] net: phy: marvell: avoid bringing down fibre link when autoneg is bypassed
Date: Thu, 3 Oct 2024 09:42:50 +0200	[thread overview]
Message-ID: <bfd9406c-4786-43b9-850c-f1b76f9a9ec2@intel.com> (raw)
In-Reply-To: <20241003071050.376502-1-qingtao.cao@digi.com>



On 10/3/2024 9:10 AM, Qingtao Cao wrote:
> On 88E151x the SGMII autoneg bypass mode defaults to be enabled. When it is
> activated, the device assumes a link-up status with existing configuration
> in BMCR, avoid bringing down the fibre link in this case
> 
> Test case:
> 1. Two 88E151x connected with SFP, both enable autoneg, link is up with
>     speed 1000M
> 2. Disable autoneg on one device and explicitly set its speed to 1000M
> 3. The fibre link can still up with this change, otherwise not.
> 
> Signed-off-by: Qingtao Cao <qingtao.cao@digi.com>
> ---
>   drivers/net/phy/marvell.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> index 9964bf3dea2f..efc4b2317466 100644
> --- a/drivers/net/phy/marvell.c
> +++ b/drivers/net/phy/marvell.c
> @@ -195,6 +195,10 @@
>   
>   #define MII_88E1510_MSCR_2		0x15
>   
> +#define MII_88E1510_FSCR2		0x1a
> +#define MII_88E1510_FSCR2_BYPASS_ENABLE	BIT(6)
> +#define MII_88E1510_FSCR2_BYPASS_STATUS	BIT(5)
> +
>   #define MII_VCT5_TX_RX_MDI0_COUPLING	0x10
>   #define MII_VCT5_TX_RX_MDI1_COUPLING	0x11
>   #define MII_VCT5_TX_RX_MDI2_COUPLING	0x12
> @@ -1623,11 +1627,21 @@ static void fiber_lpa_mod_linkmode_lpa_t(unsigned long *advertising, u32 lpa)
>   static int marvell_read_status_page_an(struct phy_device *phydev,
>   				       int fiber, int status)
>   {
> +	int fscr2;
>   	int lpa;
>   	int err;
>   
>   	if (!(status & MII_M1011_PHY_STATUS_RESOLVED)) {
>   		phydev->link = 0;
> +		if (fiber) {
> +			fscr2 = phy_read(phydev, MII_88E1510_FSCR2);
> +			if (fscr2 < 0)
> +				return fscr2;
> +			if ((fscr2 & MII_88E1510_FSCR2_BYPASS_ENABLE) &&
> +			    (fscr2 & MII_88E1510_FSCR2_BYPASS_STATUS) &&
> +			    (genphy_read_status_fixed(phydev) == 0))
> +				phydev->link = 1;
> +		}
>   		return 0;
>   	}
>   

LGTM.

Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>

  reply	other threads:[~2024-10-03  7:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03  7:10 Qingtao Cao
2024-10-03  7:42 ` Mateusz Polchlopek [this message]
2024-10-03  9:19 ` Russell King (Oracle)
2024-10-03 12:40 ` 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=bfd9406c-4786-43b9-850c-f1b76f9a9ec2@intel.com \
    --to=mateusz.polchlopek@intel.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=qingtao.cao.au@gmail.com \
    --cc=qingtao.cao@digi.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

all inboxes | Powered by JetHome®