From nobody Sun Feb 8 19:59:32 2026 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE365202C48; Wed, 14 May 2025 07:50:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747209015; cv=none; b=D/bQe1O8ZdwNCVE3RuPMmOA0lpWViPnRCirzkFje484pwF9X1fZKDqNrSxBWQfDl9XPsY6vzfvDg2XO6w6wjTMKdo3ETokcENVRK6Ecbi4YwYHVA/BWjBMmhSp1Hn3j9c5UcPh9dRY6F6TZrO1p6EUJKHcnIYR8pnz15BSprK9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747209015; c=relaxed/simple; bh=lIkGmGfIjrAZfk2fQgWKZHCVN5DsE3M5QQ3MEXXkqns=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rsVKEHIF+XjP6frdt8VPBd6hKxvarJqHB0Lyw2OPqbf5yIUfxp0kjJQf55ifRt3Vgy0R98dD8ZdprBbQDXWpwhvst2iiZowaKCnZ8XP2o5FMgkzFmp/hrO3CYAAfHHG9ObKgf7nTEarawkNJp73hahhF7EJ63RhQlyBmskXu/0I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=b8fcLF1S; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="b8fcLF1S" Received: by mail.gandi.net (Postfix) with ESMTPSA id 34873439D4; Wed, 14 May 2025 07:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1747209010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HlHHz1L74kiM44iWfYp2Zig9MiHaBt/b0ww3GfKC6fg=; b=b8fcLF1SIPHCc/xreQGBhj1uCKc3B6khD/8Q9r3piIhYX5FM1Kiyc5TwrbAHGt4GqxSiyW 7S3sm7KES4rutCBFcRAlmlWX3yKUGkT8HIGFlcTnxdAY5dkT0jWF0jZXYd0udDy+JpgVAr Tlbfyw5TIaHpee1W5nGEhg+hvV0jIfeOUunCzg6qNwcK7+KrsMD8Sfcvx79X6EUh2rG5X0 pEQt5hfOzUfgiCNSHy50IMZEG4TB/1jJiNtckJwgHcqrc08Q3cHGE6xHzcyXCfa2robjt1 M5pKsPQVNtjEPlW+dDHwhvzXtTSaeuiBJhWwGQ3VXNeInnmw7vi0AtVM8pxTZw== From: Romain Gantois Date: Wed, 14 May 2025 09:49:57 +0200 Subject: [PATCH net-next 1/3] net: phy: dp83869: Restart PHY when configuring mode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250514-dp83869-1000basex-v1-1-1bdb3c9c3d63@bootlin.com> References: <20250514-dp83869-1000basex-v1-0-1bdb3c9c3d63@bootlin.com> In-Reply-To: <20250514-dp83869-1000basex-v1-0-1bdb3c9c3d63@bootlin.com> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Maxime Chevallier , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Romain Gantois X-Mailer: b4 0.14.2 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeftdeigeefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheptfhomhgrihhnucfirghnthhoihhsuceorhhomhgrihhnrdhgrghnthhoihhssegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpeekleeifeetleffueehvedtteekhfffhfetffekgfethfekveduuedtuefgffehgeenucfkphepledtrdekledrudeifedruddvjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeltddrkeelrdduieefrdduvdejpdhhvghloheplgduledvrdduieekrddtrddufegnpdhmrghilhhfrhhomheprhhomhgrihhnrdhgrghnthhoihhssegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopeduvddprhgtphhtthhopegurghvvghmsegurghvvghmlhhofhhtrdhnvghtpdhrtghpthhtohepthhhohhmrghsrdhpvghtrgiiiihonhhisegsohhothhlihhnrdgtohhmpdhrtghpthhtohepnhgvthguvghvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhomhgri hhnrdhgrghnthhoihhssegsohhothhlihhnrdgtohhmpdhrtghpthhtoheprghnughrvgifsehluhhnnhdrtghhpdhrtghpthhtohepkhhusggrsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehprggsvghnihesrhgvughhrghtrdgtohhm X-GND-Sasl: romain.gantois@bootlin.com According to the DP83869 PHY datasheet, a software restart is required at the end of every operational mode configuration. This resets all of the PHY's circuits except the registers in the register file. The DP83869 driver currently does not perform this restart operation, which could theoretically cause issues if the PHY is in an intermediary state when the operational mode is changed. Add this software restart operation to dp83869_configure_mode(). Signed-off-by: Romain Gantois --- drivers/net/phy/dp83869.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c index a62cd838a9eacc9edb0f472470a63079b6b72207..010434c94e01f44ac3c0b7e1474= 68f4f7dca33f4 100644 --- a/drivers/net/phy/dp83869.c +++ b/drivers/net/phy/dp83869.c @@ -798,6 +798,10 @@ static int dp83869_configure_mode(struct phy_device *p= hydev, return -EINVAL; } =20 + ret =3D phy_write(phydev, DP83869_CTRL, DP83869_SW_RESTART); + + usleep_range(10, 20); + return ret; } =20 --=20 2.49.0 From nobody Sun Feb 8 19:59:32 2026 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E78F920468E; Wed, 14 May 2025 07:50:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747209015; cv=none; b=Tr/7Kd1y/Niy6jUlgZyPwxYKl6MmercxCJ2fpNfnQL49mHvtr4BKse9Nqvldctr4vqh7Qqiy0YLOuAEyBUbVzHVFvln2SPne5nhO0PDoF9WvFLOOh51GCtsbl2vVpBQrAQXjIsF4HrwJpjKUUrQlPLU33UEjBdQ/L5vtqhlOTO4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747209015; c=relaxed/simple; bh=rFXq9Eh4AfZtVhcgXPLBBYOO/gxaXC4NwRmGogrHZ+U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=foxOZOAkQwJIuPBn11OqoZ0CQYTtZocNeyeX3/bjtJZlyezbkkgRghy0N/Aoyy22N4NHQ4P4/9RKuSPza88hUP74ragiV4TbvvuGvvpza2tdVd+I3jlTWdWT5P/1JUJNd1mK8D8kP+kOWsskAHy6DEOOxApV1mVKXuZNaGH9E0E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=W1hid06S; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="W1hid06S" Received: by mail.gandi.net (Postfix) with ESMTPSA id C6632439D7; Wed, 14 May 2025 07:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1747209011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lgogWU9QuINysVd/nX037PQoL4m2+xZnuMeWzDoH6L0=; b=W1hid06S0RWutZ6Xq3dM3WZ2OEkF0EsrG0rni5lRV4lJMvE2jjkXhYZBJ2P/xa4ZYA3c4K o3We9QWYMqO3oFe/T4Ni61p/gPBy8P/HhCHNVKR3ikVky9YrvppRgmuVzFDVdFipbvxe2O pQHn5SFTFDtkfzO8zsZyrGmcjCJ2ab2l5hLrmldeL2/b7s0bNyjgPclt5DK2pQL1Ncsota k7SSfTCiOtpj0K1IQPQ6otPrkAZ+ONfLYgz1JwpkYgz3t0/6gcEHrLTxEbh2dco2CGXH55 9CWTB7nijqLpCiIRSeHHUxS8ODs413NTStKH2LLkd0flnQ1dUXYHu+lLdlXgig== From: Romain Gantois Date: Wed, 14 May 2025 09:49:58 +0200 Subject: [PATCH net-next 2/3] net: phy: dp83869: ensure FORCE_LINK_GOOD is cleared Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250514-dp83869-1000basex-v1-2-1bdb3c9c3d63@bootlin.com> References: <20250514-dp83869-1000basex-v1-0-1bdb3c9c3d63@bootlin.com> In-Reply-To: <20250514-dp83869-1000basex-v1-0-1bdb3c9c3d63@bootlin.com> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Maxime Chevallier , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Romain Gantois X-Mailer: b4 0.14.2 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeftdeigeefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheptfhomhgrihhnucfirghnthhoihhsuceorhhomhgrihhnrdhgrghnthhoihhssegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpeekleeifeetleffueehvedtteekhfffhfetffekgfethfekveduuedtuefgffehgeenucfkphepledtrdekledrudeifedruddvjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeltddrkeelrdduieefrdduvdejpdhhvghloheplgduledvrdduieekrddtrddufegnpdhmrghilhhfrhhomheprhhomhgrihhnrdhgrghnthhoihhssegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopeduvddprhgtphhtthhopegurghvvghmsegurghvvghmlhhofhhtrdhnvghtpdhrtghpthhtohepthhhohhmrghsrdhpvghtrgiiiihonhhisegsohhothhlihhnrdgtohhmpdhrtghpthhtohepnhgvthguvghvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhomhgri hhnrdhgrghnthhoihhssegsohhothhlihhnrdgtohhmpdhrtghpthhtoheprghnughrvgifsehluhhnnhdrtghhpdhrtghpthhtohepkhhusggrsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehprggsvghnihesrhgvughhrghtrdgtohhm X-GND-Sasl: romain.gantois@bootlin.com The FORCE_LINK_GOOD bit in the PHY_CONTROL register forces the reported link status to 1 if the selected speed is 1Gbps. According to the DP83869 PHY datasheet, this bit should default to 0 after a hardware reset. However, the opposite has been observed on some DP83869 components. As a consequence, a valid link will be reported in 1000Base-X operational modes, even if the autonegotiation process failed. Make sure that the FORCE_LINK_GOOD bit is cleared during initial configuration. Signed-off-by: Romain Gantois --- drivers/net/phy/dp83869.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c index 010434c94e01f44ac3c0b7e147468f4f7dca33f4..000660aae16ed46166774e7235c= d8a6df94be047 100644 --- a/drivers/net/phy/dp83869.c +++ b/drivers/net/phy/dp83869.c @@ -89,6 +89,7 @@ #define DP83869_STRAP_MIRROR_ENABLED BIT(12) =20 /* PHYCTRL bits */ +#define DP83869_FORCE_LINK_GOOD BIT(10) #define DP83869_RX_FIFO_SHIFT 12 #define DP83869_TX_FIFO_SHIFT 14 =20 @@ -810,6 +811,15 @@ static int dp83869_config_init(struct phy_device *phyd= ev) struct dp83869_private *dp83869 =3D phydev->priv; int ret, val; =20 + /* The FORCE_LINK_GOOD bit in the PHYCTRL register should be + * unset after a hardware reset but it is not. make sure it is + * cleared so that the PHY can function properly. + */ + ret =3D phy_clear_bits(phydev, MII_DP83869_PHYCTRL, + DP83869_FORCE_LINK_GOOD); + if (ret) + return ret; + /* Force speed optimization for the PHY even if it strapped */ ret =3D phy_modify(phydev, DP83869_CFG2, DP83869_DOWNSHIFT_EN, DP83869_DOWNSHIFT_EN); --=20 2.49.0 From nobody Sun Feb 8 19:59:32 2026 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B4062063F0; Wed, 14 May 2025 07:50:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747209015; cv=none; b=Dq+Wb7caF/5tQPDbqFThQ61c6XdDTjqHqT4k0a+JuU3GSLJK+JvSlpt6VpruL2h++iHMb+ghO5tSzUJZ831WJSGpV8q3camEettKvAFjTGmYzbfAZ4dqpaVWHGQj5XdQFAcMiS+qrckBF9nNITktXFlyYUgh44uCMMh2bnmZ6hc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747209015; c=relaxed/simple; bh=/tF8K2NTeCCHaif76f7Ley4J0CpUJfvELhKFRVyp/KY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YzBT84kP6uSW7HuiS1wJkWdpRw+aCnTegtx1+s6XUvP197d/ib2Pu56kU28dK2inVWBuZUsSeihOt6UryPXqWnMwXAPE2EUp+TBadlvmqcV1w925zvXj2K25ggMgdZWJq1VYg3qe6+Xx8PLY+6yOd/ys5txqXERsF8STXXhVSQE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Ke5CDRyt; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Ke5CDRyt" Received: by mail.gandi.net (Postfix) with ESMTPSA id 691B0439D3; Wed, 14 May 2025 07:50:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1747209011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v1aRf1qlofiLBTSf6ULbxEoBgoZVuSsMmJGqVz5ikGs=; b=Ke5CDRyti81LkO2ACUXpk4vagGwlcXLNrl8rN9C5TOLXprgj4YkOj5Ox1mk16qRKEbM1r9 BehkrqDihpbBaXUI5vorvs2d4fkFNtjUcmQzuMeMJVyswTGZd/FFUeXNsIOBCklTHayGEc UtxxyTqjY1UoYbdNoG9dkb2t75ashK7UrwnbZNT8+CLoZpuLpCumjqWxqSyJluVasFhyFQ 0415YcjVJxXNBwodVBbSF8VvwxAV5Zdkyjr4Sz9S44goJUE3UxmVHIukpQF5jx6J6DXsjv NpJvLbVqJQA/Vhng3hU9CAv0K9nIM07lhTVwDUlsp0HncVDusLSE6MRpaDd2Ag== From: Romain Gantois Date: Wed, 14 May 2025 09:49:59 +0200 Subject: [PATCH net-next 3/3] net: phy: dp83869: Support 1000Base-X SFP modules Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250514-dp83869-1000basex-v1-3-1bdb3c9c3d63@bootlin.com> References: <20250514-dp83869-1000basex-v1-0-1bdb3c9c3d63@bootlin.com> In-Reply-To: <20250514-dp83869-1000basex-v1-0-1bdb3c9c3d63@bootlin.com> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Maxime Chevallier , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Romain Gantois X-Mailer: b4 0.14.2 X-GND-State: clean X-GND-Score: -50 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeftdeigeefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenufgrugcufihorhgushculdehtddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeftohhmrghinhcuifgrnhhtohhishcuoehrohhmrghinhdrghgrnhhtohhishessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepkeelieefteelffeuheevtdetkefhfffhteffkefgtefhkeevudeutdeugfffheegnecukfhppeeltddrkeelrdduieefrdduvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledtrdekledrudeifedruddvjedphhgvlhhopegludelvddrudeikedrtddrudefngdpmhgrihhlfhhrohhmpehrohhmrghinhdrghgrnhhtohhishessghoohhtlhhinhdrtghomhdpnhgspghrtghpthhtohepuddvpdhrtghpthhtohepuggrvhgvmhesuggrvhgvmhhlohhfthdrnhgvthdprhgtphhtthhopehthhhomhgrshdrphgvthgriiiiohhnihessghoohhtlhhinhdrtghomhdprhgtphhtthhopehnvghtuggvvhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdro hhrghdprhgtphhtthhopehrohhmrghinhdrghgrnhhtohhishessghoohhtlhhinhdrtghomhdprhgtphhtthhopegrnhgurhgvfieslhhunhhnrdgthhdprhgtphhtthhopehkuhgsrgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepphgrsggvnhhisehrvgguhhgrthdrtghomh X-GND-Sasl: romain.gantois@bootlin.com The DP83869 PHY supports multiple operational modes, including RGMII-to-1000Base-X, which can be used to link an RGMII-capable Ethernet MAC to a downstream fiber SFP module. +-------+ +---------+ +-----------------+ | | RGMII | | 1000Base-X | | | MAC |<-------> | DP83869 |<---------->| fiber SFP module| | | | | | | +-------+ +---------+ +-----------------+ Register the attach_port() callback, to set the supported downstream interface modes for SFP ports and provide the configure_mii() callback, which sets the correct DP83869 operational mode when a compatible SFP module is inserted. Signed-off-by: Romain Gantois --- drivers/net/phy/dp83869.c | 53 +++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 53 insertions(+) diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c index 000660aae16ed46166774e7235cd8a6df94be047..6d43c39ac525714a495327ec5a1= a22b5e653b1cd 100644 --- a/drivers/net/phy/dp83869.c +++ b/drivers/net/phy/dp83869.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include =20 @@ -876,6 +877,57 @@ static int dp83869_config_init(struct phy_device *phyd= ev) return ret; } =20 +static int dp83869_port_configure_serdes(struct phy_port *port, bool enabl= e, + phy_interface_t interface) +{ + struct phy_device *phydev =3D port_phydev(port); + struct dp83869_private *dp83869; + int ret; + + if (!enable) + return 0; + + dp83869 =3D phydev->priv; + + switch (interface) { + case PHY_INTERFACE_MODE_1000BASEX: + dp83869->mode =3D DP83869_RGMII_1000_BASE; + break; + default: + phydev_err(phydev, "Incompatible SFP module inserted\n"); + return -EINVAL; + } + + ret =3D dp83869_configure_mode(phydev, dp83869); + if (ret) + return ret; + + /* Update advertisement */ + if (mutex_trylock(&phydev->lock)) { + ret =3D dp83869_config_aneg(phydev); + mutex_unlock(&phydev->lock); + } + + return ret; +} + +static const struct phy_port_ops dp83869_serdes_port_ops =3D { + .configure_mii =3D dp83869_port_configure_serdes, +}; + +static int dp83869_attach_port(struct phy_device *phydev, + struct phy_port *port) +{ + if (!port->is_serdes) + return 0; + + port->ops =3D &dp83869_serdes_port_ops; + + __set_bit(PHY_INTERFACE_MODE_1000BASEX, port->interfaces); + + return 0; +} + static int dp83869_probe(struct phy_device *phydev) { struct dp83869_private *dp83869; @@ -931,6 +983,7 @@ static int dp83869_phy_reset(struct phy_device *phydev) .set_tunable =3D dp83869_set_tunable, \ .get_wol =3D dp83869_get_wol, \ .set_wol =3D dp83869_set_wol, \ + .attach_port =3D dp83869_attach_port, \ .suspend =3D genphy_suspend, \ .resume =3D genphy_resume, \ } --=20 2.49.0