mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Romain Gantois <romain.gantois@bootlin.com>
Cc: 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>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 5/6] net: phy: dp83869: Support SGMII SFP modules
Date: Mon, 1 Jul 2024 19:00:29 +0200	[thread overview]
Message-ID: <f9ed0d60-4883-4ca7-b692-3eedf65ca4dd@lunn.ch> (raw)
In-Reply-To: <20240701-b4-dp83869-sfp-v1-5-a71d6d0ad5f8@bootlin.com>

> +static int dp83869_connect_phy(void *upstream, struct phy_device *phy)
> +{
> +	struct phy_device *phydev = upstream;
> +	struct dp83869_private *dp83869;
> +
> +	dp83869 = phydev->priv;
> +
> +	if (dp83869->mode != DP83869_RGMII_SGMII_BRIDGE)
> +		return 0;
> +
> +	if (!phy->drv) {
> +		dev_warn(&phy->mdio.dev, "No driver bound to SFP module phy!\n");

more instances which could be phydev_{err|warn|info}().

> +		return 0;
> +	}
> +
> +	phy_support_asym_pause(phy);

That is unusual. This is normally used by a MAC driver to indicate it
supports asym pause. It is the MAC which implements pause, but the PHY
negotiates it. So this tells phylib what to advertise to the link
partner. Why would a PHY do this? What if the MAC does not support
asym pause?

> +	linkmode_set_bit(PHY_INTERFACE_MODE_SGMII, phy->host_interfaces);
> +	phy->interface = PHY_INTERFACE_MODE_SGMII;
> +	phy->port = PORT_TP;
> +
> +	phy->speed = SPEED_UNKNOWN;
> +	phy->duplex = DUPLEX_UNKNOWN;
> +	phy->pause = MLO_PAUSE_NONE;
> +	phy->interrupts = PHY_INTERRUPT_DISABLED;
> +	phy->irq = PHY_POLL;
> +	phy->phy_link_change = &dp83869_sfp_phy_change;
> +	phy->state = PHY_READY;

I don't know of any other PHY which messes with the state machine like
this. This needs some explanation.

> +
> +	dp83869->mod_phy = phy;
> +
> +	return 0;
> +}
> +
> +static void dp83869_disconnect_phy(void *upstream)
> +{
> +	struct phy_device *phydev = upstream;
> +	struct dp83869_private *dp83869;
> +
> +	dp83869 = phydev->priv;
> +	dp83869->mod_phy = NULL;
> +}
> +
> +static int dp83869_module_start(void *upstream)
> +{
> +	struct phy_device *phydev = upstream;
> +	struct dp83869_private *dp83869;
> +	struct phy_device *mod_phy;
> +	int ret;
> +
> +	dp83869 = phydev->priv;
> +	mod_phy = dp83869->mod_phy;
> +	if (!mod_phy)
> +		return 0;
> +
> +	ret = phy_init_hw(mod_phy);
> +	if (ret) {
> +		dev_err(&mod_phy->mdio.dev, "Failed to initialize PHY hardware: error %d", ret);
> +		return ret;
> +	}
> +
> +	phy_start(mod_phy);

Something else no other PHY driver does....

	Andrew

  reply	other threads:[~2024-07-01 17:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01  8:51 [PATCH net-next 0/6] net: phy: dp83869: Add support for downstream SFP cages Romain Gantois
2024-07-01  8:51 ` [PATCH net-next 1/6] net: phy: dp83869: Disable autonegotiation in RGMII/1000Base-X mode Romain Gantois
2024-07-01 16:40   ` Andrew Lunn
2024-07-02  8:44     ` Romain Gantois
2024-07-02  9:24       ` Russell King (Oracle)
2024-07-02  9:42         ` Romain Gantois
2024-07-02 10:15           ` Russell King (Oracle)
2024-07-02 13:01             ` Romain Gantois
2024-07-01  8:51 ` [PATCH net-next 2/6] net: phy: dp83869: Perform software restart after configuring op mode Romain Gantois
2024-07-01 16:44   ` Andrew Lunn
2024-07-02  8:45     ` Romain Gantois
2024-07-01  8:51 ` [PATCH net-next 3/6] net: phy: dp83869: Ensure that the FORCE_LINK_GOOD bit is cleared Romain Gantois
2024-07-01  8:51 ` [PATCH net-next 4/6] net: phy: dp83869: Support 1000Base-X and 100Base-FX SFP modules Romain Gantois
2024-07-01 16:49   ` Andrew Lunn
2024-07-01  8:51 ` [PATCH net-next 5/6] net: phy: dp83869: Support SGMII " Romain Gantois
2024-07-01 17:00   ` Andrew Lunn [this message]
2024-07-02  8:11     ` Romain Gantois
2024-07-02 13:21       ` Andrew Lunn
2024-07-02 14:56         ` Maxime Chevallier
2024-07-02 18:13           ` Russell King (Oracle)
2024-07-02 19:55             ` Andrew Lunn
2024-07-02 15:18         ` Russell King (Oracle)
2024-07-01  8:51 ` [PATCH net-next 6/6] net: phy: dp83869: Fix link up reporting in SGMII bridge mode Romain Gantois
2024-07-01 17:09   ` Andrew Lunn
2024-07-02  9:04     ` Romain Gantois
2024-07-02  9:28       ` Russell King (Oracle)

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=f9ed0d60-4883-4ca7-b692-3eedf65ca4dd@lunn.ch \
    --to=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=romain.gantois@bootlin.com \
    --cc=thomas.petazzoni@bootlin.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®