Netdev List
 help / color / mirror / Atom feed
From: "Álvaro G. M." <alvaro.gamez@hazent.com>
To: Romain Gantois <romain.gantois@bootlin.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>
Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	netdev@vger.kernel.org,  linux-kernel@vger.kernel.org,
	alvaro@linenoise.info
Subject: Re: [PATCH net-next v2 0/3] net: phy: dp83869: Support 1000Base-X SFP
Date: Fri, 13 Feb 2026 13:31:17 +0100	[thread overview]
Message-ID: <92f5169580c0292ae666e20d52b891b45e0731ea.camel@hazent.com> (raw)
In-Reply-To: <20251110-sfp-1000basex-v2-0-dd5e8c1f5652@bootlin.com>

On Mon, 10 Nov 2025 10:24:52 +0100
Romain Gantois <romain.gantois@bootlin.com> wrote:
> Hi everyone,
> 
> This is version two of my series which adds support for using the
> DP83869 PHY as a transceiver between an RGMII upper MAC and a
> downstream 1000Base-X SFP module.

Hi Romain,

I am quite interested in this too, as we have a new version of a PCB in
which we replaced a dp83848 (which only works with 100base-tx) with
dp83869 with the intent of using 1000base-sx or similar SFPs.

The are two different SFPs that I was able to use with dp83848 and
would like to use them with the dp83869 as well:

- RJ45 based:
    - Robofiber SFP-5000-RJ45A: 10/100Base-Tx SFP RJ45
    - H!Fiber ASF-GE-T1 1000Base-T SFP RJ-25

Both of these already work with dp83869 with kernel 6.12, provided I
set mode to DP83869_RGMII_100_BASE. If I try to make the 1000Base-T
work at 1Gbps by setting op mode to DP83869_RGMII_1000_BASE it will
still set speed to 100Mbps and will work just fine, but if I try to set
speed to 1000, all data transfer stops.

Personally, I could live with this, but I assume it should be possible
for this SFP to work at 1Gbps.

- Fiber based:
    - CISCO-FINISAR G155B3520KCD which I believe reports bit
      ETHTOOL_LINK_MODE_10000baseSR_Full_BIT
    - AVAGO AFBR-709SMZ which reports as 10gbase-r
    - ATGBICS AFBR-5710ALZ-C 1000BASE-SX

The first two, even if they report as 10Gbase, did work with dp83848 at
100Mbps out of the box, but do not seem to work in any case with
dp83869. The last one, 1000base-sx, is the one that I expected to
work either out of the box or by using this set of patches of yours.
However, none of them do work.

What I did next, as the 10gbase was simply refused, was to apply the
following patch above your series, which is more or less based on one
of your previous patches from 2025. The key here is that I try hard to
fallback to 100Mbps on every instance of non working SFP. So, I need
that if linkmode_empty(sfp_support) because the 10/100 SFPs simply do
not have any bit active to signal that capability, and I also set mode
to RGMII_100_BASE in every case. So, with this patch:

sfp amba_pl:sfp: module AVAGO            AFBR-709SMZ      rev G4.1 sn
AA17053045F      dc 170204  
TI DP83869 axienet-40c00000:01: dp83869_module_insert SFP compatible link mode:
10gbase-r
TI DP83869 axienet-40c00000:01: incompatible PHY-to-SFP module link mode
10gbase-r! Try simply 10/100
Configuring network: xilinx_axienet 40c00000.ethernet eth0: PHY [axienet-
40c00000:01] driver [TI DP83869] (irq=POLL)
xilinx_axienet 40c00000.ethernet eth0: configuring for phy/1000base-x link mode
xilinx_axienet 40c00000.ethernet eth0: Link is Up - 100Mbps/Full - flow control
off

And finally I have my other device answer to ping! So it seems that the
DP83869, as is, won't be able to run at 1Gbps no matter what.

From the datasheet... wouldn't it be necessary to update OP_MODE_DECODE
Register (Offset = 1DFh) [Reset = 0040h] CFG_OPMODE bits 2-0 to set value 1
RGMII to 1000Base-X?

diff --git c/dp83869.c w/dp83869.c
index 31a2d4f..3857577 100644
--- a/drivers/net/phy/dp83869.c
+++ b/drivers/net/phy/dp83869.c
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/phy.h>
+#include <linux/phylink.h>
 #include <linux/sfp.h>
 #include <linux/delay.h>
 #include <linux/bitfield.h>
@@ -894,22 +895,63 @@ static void dp83869_module_remove(void *upstream)
 static int dp83869_module_insert(void *upstream, const struct sfp_eeprom_id
*id)
 {
 	struct phy_device *phydev = upstream;
-	const struct sfp_module_caps *caps;
+	__ETHTOOL_DECLARE_LINK_MODE_MASK(phy_support);
+	__ETHTOOL_DECLARE_LINK_MODE_MASK(sfp_support);
+	DECLARE_PHY_INTERFACE_MASK(interfaces);
 	struct dp83869_private *dp83869;
+	phy_interface_t interface;
 	int ret;
 
-	caps = sfp_get_module_caps(phydev->sfp_bus);
+	linkmode_zero(phy_support);
+	phylink_set(phy_support, 10000baseSR_Full);
+	phylink_set(phy_support, 1000baseT_Full);
+	phylink_set(phy_support, 1000baseX_Full);
+	phylink_set(phy_support, 100baseFX_Full);
+	phylink_set(phy_support, 100baseFX_Half);
 
-	if (!linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
-			       caps->link_modes)) {
-		phydev_err(phydev, "incompatible SFP module inserted\n");
-		return -EINVAL;
+	linkmode_zero(sfp_support);
+	sfp_parse_support(phydev->sfp_bus, id, sfp_support, interfaces);
+
+	sfp_parse_support(phydev->sfp_bus, id, sfp_support, interfaces);
+	linkmode_and(sfp_support, phy_support, sfp_support);
+
+	if (linkmode_empty(sfp_support)) {
+		phydev_err(phydev, "incompatible SFP module inserted, let's
assume 10/100\n");
+
+		linkmode_zero(sfp_support);
+		sfp_parse_support(phydev->sfp_bus, id, sfp_support,
interfaces);
+		phylink_set(sfp_support, 100baseFX_Full);
+		linkmode_and(sfp_support, phy_support, sfp_support);
+
+		if (linkmode_empty(sfp_support)) {
+			phydev_err(phydev, "incompatible SFP module inserted,
10/100 didn't work either\n");
+			return -EINVAL;
+		}
 	}
 
+	interface = sfp_select_interface(phydev->sfp_bus, sfp_support);
+	phydev_info(phydev, "%s SFP compatible link mode: %s\n", __func__,
+		phy_modes(interface));
+
 	dp83869 = phydev->priv;
 
-	dp83869->mode = DP83869_RGMII_1000_BASE;
-	phydev->port = PORT_FIBRE;
+	switch (interface) {
+	case PHY_INTERFACE_MODE_SGMII:
+	case PHY_INTERFACE_MODE_100BASEX:
+		dp83869->mode = DP83869_RGMII_100_BASE;
+		phydev->port = PORT_FIBRE;
+		break;
+	case PHY_INTERFACE_MODE_1000BASEX:
+		dp83869->mode = DP83869_RGMII_1000_BASE;
+		phydev->port = PORT_FIBRE;
+		break;
+	default:
+		phydev_err(phydev, "incompatible PHY-to-SFP module link mode
%s! Try simply 10/100\n",
+			   phy_modes(interface));
+		dp83869->mode = DP83869_RGMII_100_BASE;
+		phydev->port = PORT_FIBRE;
+		break;
+	}
 
 	ret = dp83869_configure_mode(phydev, dp83869);
 	if (ret)


It is absolutely possible that I misconfigured something, so here are
the relevant parts of my DTS. Sadly, as you can see, we don't have GPIO
access to the SFP pins, but at least they are properly pulled to the
value that enables the SFP and the transmitter at all times.

sfp0: sfp {
	compatible = "sff,sfp";
	i2c-bus = <&axi_iic_0>;
};

axi_ethernet_eth: ethernet@40c00000 {
	compatible = "xlnx,axi-ethernet-1.00.a";
	reg = <0x40c00000 0x40000>;
	phy-handle = <&phy0>;
	interrupt-parent = <&microblaze_0_axi_intc>;
	interrupts = <3>;
	xlnx,rxmem = <0x1000>;
	phy-mode = "1000base-x";
	max-speed = <1000>;
	xlnx,txcsum = <0x2>;
	xlnx,rxcsum = <0x2>;
	clock-names = "s_axi_lite_clk", "axis_clk", "ref_clk", "mgt_clk";
	clocks = <&clk_bus_0>, <&clk_bus_0>, <&clk_bus_0>, <&clk_bus_0>;
	axistream-connected = <&axi_ethernet_0_dma>;
	dma-names = "tx_chan0", "rx_chan0";
	mdio {
		#address-cells = <1>;
		#size-cells = <0>;

		phy0: ethernet-phy@0 {
			sfp = <&sfp0>;
			reg = <1>;
		};
	};
};

Thanks

Best regards,

-- 
Alvaro G. M.


      parent reply	other threads:[~2026-02-13 12:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10  9:24 [PATCH net-next v2 0/3] net: phy: dp83869: Support 1000Base-X SFP Romain Gantois
2025-11-10  9:24 ` [PATCH net-next v2 1/3] net: phy: dp83869: Restart PHY when configuring mode Romain Gantois
2025-11-11  1:02   ` Andrew Lunn
2025-11-10  9:24 ` [PATCH net-next v2 2/3] net: phy: dp83869: ensure FORCE_LINK_GOOD is cleared Romain Gantois
2025-11-11  1:03   ` Andrew Lunn
2025-11-10  9:24 ` [PATCH net-next v2 3/3] net: phy: dp83869: Support 1000Base-X SFP Romain Gantois
2025-11-11  1:08   ` Andrew Lunn
2025-11-13  9:27     ` Romain Gantois
2026-02-13 12:31 ` Álvaro G. M. [this message]

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=92f5169580c0292ae666e20d52b891b45e0731ea.camel@hazent.com \
    --to=alvaro.gamez@hazent.com \
    --cc=alvaro@linenoise.info \
    --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=maxime.chevallier@bootlin.com \
    --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