public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Tristram.Ha@microchip.com
Cc: Woojung.Huh@microchip.com, olteanv@gmail.com, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	marex@denx.de, UNGLinuxDriver@microchip.com,
	devicetree@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 2/2] net: dsa: microchip: Add SGMII port support to KSZ9477 switch
Date: Thu, 14 Nov 2024 02:43:58 +0100	[thread overview]
Message-ID: <1fcb11da-e660-497b-a098-c00f94c737f5@lunn.ch> (raw)
In-Reply-To: <DM3PR11MB873696176581059CF682F253EC5A2@DM3PR11MB8736.namprd11.prod.outlook.com>

> When the SFP EEPROM says it does not support 1000Base-T then the SFP bus
> code does not consider the SFP has a PHY and skips creating a MDIO bus
> for it and phylink_sfp_config_optical() is called to create the phylink.

There are many SFPs out there with broken EEPROM contents. Do the SFPs
you have say they are not 1000Base-T but actually are? If so, they are
broken, and need a quirk adding.

Russell King keeps a database of SFP EEPROM contents. Send him the
output of `ethtool -m eth42 raw on hex on` 

> Now back to the discussion of the different modes used by the SGMII
> module.  I think a better term like SerDes can be used to help
> understanding the operation, although I still cannot narrow down the
> precise definitions from looking at the internet.  SGMII mode is
> said to support 10/100/1000Mbit.  This is the default setting, so
> plugging such SFP allows the port to communicate without any register
> programming.  The other mode is SerDes, which is fixed at 1000Mbit.  This
> is typically used by SFP using fiber optics.  This requires changing a
> register to make the port works.  It seems those 1000Base-T SFPs all run
> in SerDes mode, at least from all SFPs I tried.

There is a comment in the code:

/* Probe a SFP for a PHY device if the module supports copper - the PHY
 * normally sits at I2C bus address 0x56, and may either be a clause 22
 * or clause 45 PHY.
 *
 * Clause 22 copper SFP modules normally operate in Cisco SGMII mode with
 * negotiation enabled, but some may be in 1000base-X - which is for the
 * PHY driver to determine.

So the default is SGMII for copper SFPs, but there are a few oddballs
using 1000BaseX. The Marvell PHY driver should figure this out, and
the phylink will tell you want mode to use.


> The issue is then phylink assigns SGMII phy mode to such SFP as its
> EEPROM just says 1000Base-T support and not 1000BASEX phy mode so that
> the DSA driver can program the register correspondingly.  Because of that
> the driver still needs to rely on its own detection to find out which
> mode to use.
>  
> > Have you set pcs.poll? phylink will then poll the PCS every
> > second. You can report PCS status any time.
> 
> I know about PCS polling.  The SFP cage driver can provide link_up and
> link_down indications to the phylink driver.

The SPF cage provides LOS, Loss of Signal. This basically means there
is light coming into the SFP, but not much more. It is not a
trustworthy signal on its own. Phylink combines this with the PCS
status, does the PCS also have link. You need the combination.

> One more issue is if a SFP is not plugged in eventually the SFP driver
> says "please wait, module slow to respond."

Something is wrong with your GPIOs. Phylink thinks there is a module
inserted, when in fact there is not. Add #define DEBUG 1 to the very
top of sfp.c, so you can see the state transitions. I guess there is
something wrong with the MODDEF0 GPIO.

	Andrew


  parent reply	other threads:[~2024-11-14  1:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-09  1:56 [PATCH net-next 0/2] net: dsa: microchip: Add SGMII port support to KSZ9477 switch Tristram.Ha
2024-11-09  1:56 ` [PATCH net-next 1/2] dt-bindings: " Tristram.Ha
2024-11-09 10:43   ` Krzysztof Kozlowski
2024-11-12  2:45     ` Tristram.Ha
2024-11-09  1:56 ` [PATCH net-next 2/2] " Tristram.Ha
2024-11-09 15:13   ` Andrew Lunn
2024-11-12  2:55     ` Tristram.Ha
2024-11-12 13:50       ` Andrew Lunn
2024-11-13  2:12         ` Tristram.Ha
2024-11-13 14:42           ` Vladimir Oltean
2024-11-15  1:53             ` Tristram.Ha
2024-11-14  1:43           ` Andrew Lunn [this message]
2024-11-15  2:00             ` Tristram.Ha
2024-11-15 18:08               ` Andrew Lunn
2024-11-09 15:43   ` Andrew Lunn
2024-11-12  2:58     ` Tristram.Ha
2024-11-10 15:50   ` Vladimir Oltean
2024-11-12  2:43     ` Tristram.Ha
2024-11-29 12:59   ` Maxime Chevallier

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=1fcb11da-e660-497b-a098-c00f94c737f5@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Tristram.Ha@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=robh@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: 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