From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sendmail.purelymail.com (sendmail.purelymail.com [34.202.193.197]) (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 D380F3112C0 for ; Sat, 21 Mar 2026 19:44:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=34.202.193.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774122259; cv=none; b=PykQjV6rqBz6/GonxKWcOpxOhrczDVhqbQyftJ8TOsGOwIYRD08kFOOVCJCAKXhbskfy88KK8nR7VSDKpCzrQUwEMy+q00lNhkdyNfwNgRi0sW17iu9tZG0ioKtbBhg6GuS73B//ffRZuDJNH8N1RV9yoBkbCfBCy1oU/aqXBEw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774122259; c=relaxed/simple; bh=UVGTkL9ok5W1QfwaA+6IjrabqWEP58upZp8CyzRNJYA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=klm1Gk5F1y9AS6qeNhywiMzwdcgpWcRqR5VGqX2Hp+F24w5VUMlBJLLnZtlQh4IGhxJzJFl814xW2Yx+3xCmOIdUfycrEloByGAUl2gqY04CzcpyOduygGhfiPYfPNX71W6aMUpoKmNaQzJZ6BDqn8gN7JRycWyRmghQwT/fkiA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=tinyisr.com; spf=pass smtp.mailfrom=tinyisr.com; dkim=pass (2048-bit key) header.d=tinyisr.com header.i=@tinyisr.com header.b=Q05cCOQm; dkim=pass (2048-bit key) header.d=purelymail.com header.i=@purelymail.com header.b=b5GhDdAL; arc=none smtp.client-ip=34.202.193.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=tinyisr.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tinyisr.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tinyisr.com header.i=@tinyisr.com header.b="Q05cCOQm"; dkim=pass (2048-bit key) header.d=purelymail.com header.i=@purelymail.com header.b="b5GhDdAL" Authentication-Results: purelymail.com; auth=pass DKIM-Signature: a=rsa-sha256; b=Q05cCOQmrVGEptUgZLXHxvu0xcECfFx+JonZrCo/bhAIlDPvFgOjN3Fag5++ri3AX8j4o3iPIRTPjoYanIM/5Snyi4SbXp8kekzV2jSrncOhwsgVLob9dU4lLBYdGuPRHkJaDVsaaWxOm8Nr6i5VR4WbaGMFhLT9tmu/jx+WFBwbjnyrFL5Ux1sDm6+1RsmaA2H0XTD0aSNaGhXVxwDfEBSooL4cp9VvONgIDsAuE5lG0oCq+uM88ZWTaN1N18l0PIdX2y+7ZT72Xp7SnYtRTLND0DOVCZpMMREv+1pE0e2C44+qAhJ7ufOD028MlYYxn49ftujb7gnUTmxwfthStg==; s=purelymail3; d=tinyisr.com; v=1; bh=UVGTkL9ok5W1QfwaA+6IjrabqWEP58upZp8CyzRNJYA=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=b5GhDdAL4xJJpT0Mya+4s1I3JjdpmqcDAfZYfMhuclr16I/7Z6EDZEnrPtKH8gIvoCjF/uiwo3CF4eErSpgY/EAriSpSUa/Vz/+UPVkT1PVZL5dWdG48APizIG6vtVQfwQipvhGTWqE8/xkauq6K3mUpeBOq4/yxQImr7C/1NE18VkXT4tvWkf2H++JYXC8+3lN7L+p5zXqwLc41s7IfBoCW+pBjF0qW5HvjWlhqIpWTDXP2h5iyGZiGQMuyjzy63gsZD9IHr9NjSqajICBUtrg5Cth2REdS9vAmeSUckSGkcc83JLrvqVCe9AO4Dv3b6eSx/SkWgeX8V4kHMUSfwQ==; s=purelymail3; d=purelymail.com; v=1; bh=UVGTkL9ok5W1QfwaA+6IjrabqWEP58upZp8CyzRNJYA=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 99681:12517:null:purelymail X-Pm-Original-To: netdev@vger.kernel.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 958892867; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sat, 21 Mar 2026 19:44:15 +0000 (UTC) From: Joris Vaisvila To: netdev@vger.kernel.org Cc: horms@kernel.org, pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, davem@davemloft.net, olteanv@gmail.com, Andrew Lunn , devicetree@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , Joris Vaisvila Subject: [RFC v3 2/4] net: phy: mediatek: add phy driver for MT7628 built-in Fast Ethernet PHYs Date: Sat, 21 Mar 2026 21:43:38 +0200 Message-ID: <20260321194340.2140783-3-joey@tinyisr.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260321194340.2140783-1-joey@tinyisr.com> References: <20260321194340.2140783-1-joey@tinyisr.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail Content-Type: text/plain; charset=UTF-8 The Fast Ethernet PHYs present in the MT7628 SoCs require an undocumented bit to be set before they can establish 100mbps links. This commit adds the Kconfig option MEDIATEK_FE_SOC_PHY and the corresponding driver mtk-fe-soc.c. Signed-off-by: Joris Vaisvila --- drivers/net/phy/mediatek/Kconfig | 10 +++++- drivers/net/phy/mediatek/Makefile | 1 + drivers/net/phy/mediatek/mtk-fe-soc.c | 50 +++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 drivers/net/phy/mediatek/mtk-fe-soc.c diff --git a/drivers/net/phy/mediatek/Kconfig b/drivers/net/phy/mediatek/Kc= onfig index bb7dc876271e..b6a51f38c358 100644 --- a/drivers/net/phy/mediatek/Kconfig +++ b/drivers/net/phy/mediatek/Kconfig @@ -21,8 +21,16 @@ config MEDIATEK_GE_PHY =09 common operations with MediaTek SoC built-in Gigabit =09 Ethernet PHYs. =20 +config MEDIATEK_FE_SOC_PHY +=09tristate "MediaTek SoC Fast Ethernet PHYs" +=09help +=09 Support for MediaTek MT7628 built-in Fast Ethernet PHYs. +=09 This driver only sets an initialization bit required for the PHY +=09 to establish 100 Mbps links. All other PHY operations are handled +=09 by the kernel's generic PHY code. + config MEDIATEK_GE_SOC_PHY -=09tristate "MediaTek SoC Ethernet PHYs" +=09tristate "MediaTek SoC Gigabit Ethernet PHYs" =09depends on ARM64 || COMPILE_TEST =09depends on ARCH_AIROHA || (ARCH_MEDIATEK && NVMEM_MTK_EFUSE) || \ =09=09 COMPILE_TEST diff --git a/drivers/net/phy/mediatek/Makefile b/drivers/net/phy/mediatek/M= akefile index ac57ecc799fc..6f9cacf7f906 100644 --- a/drivers/net/phy/mediatek/Makefile +++ b/drivers/net/phy/mediatek/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_MEDIATEK_2P5GE_PHY)=09+=3D mtk-2p5ge.o +obj-$(CONFIG_MEDIATEK_FE_SOC_PHY)=09+=3D mtk-fe-soc.o obj-$(CONFIG_MEDIATEK_GE_PHY)=09=09+=3D mtk-ge.o obj-$(CONFIG_MEDIATEK_GE_SOC_PHY)=09+=3D mtk-ge-soc.o obj-$(CONFIG_MTK_NET_PHYLIB)=09=09+=3D mtk-phy-lib.o diff --git a/drivers/net/phy/mediatek/mtk-fe-soc.c b/drivers/net/phy/mediat= ek/mtk-fe-soc.c new file mode 100644 index 000000000000..317944411fbe --- /dev/null +++ b/drivers/net/phy/mediatek/mtk-fe-soc.c @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Driver for MT7628 Embedded Switch internal Fast Ethernet PHYs + */ +#include +#include + +#define MTK_FPHY_ID_MT7628=090x03a29410 +#define MTK_EXT_PAGE_ACCESS=090x1f + +static int mt7628_phy_read_page(struct phy_device *phydev) +{ +=09return __phy_read(phydev, MTK_EXT_PAGE_ACCESS); +} + +static int mt7628_phy_write_page(struct phy_device *phydev, int page) +{ +=09return __phy_write(phydev, MTK_EXT_PAGE_ACCESS, page); +} + +static int mt7628_phy_config_init(struct phy_device *phydev) +{ +=09/* +=09 * This undocumented bit is required for the PHYs to be able to +=09 * establish 100mbps links. +=09 */ +=09return phy_write_paged(phydev, 0x8000, 30, BIT(13)); +} + +static struct phy_driver mtk_soc_fe_phy_driver[] =3D { +=09{ +=09=09PHY_ID_MATCH_EXACT(MTK_FPHY_ID_MT7628), +=09=09.name =3D "MediaTek MT7628 PHY", +=09=09.config_init =3D mt7628_phy_config_init, +=09=09.read_page =3D mt7628_phy_read_page, +=09=09.write_page =3D mt7628_phy_write_page, +=09}, +}; + +module_phy_driver(mtk_soc_fe_phy_driver); +static const struct mdio_device_id __maybe_unused mtk_soc_fe_phy_tbl[] =3D= { +=09{ PHY_ID_MATCH_EXACT(MTK_FPHY_ID_MT7628) }, +=09{ } +}; + +MODULE_DESCRIPTION("MediaTek SoC Fast Ethernet PHY driver"); +MODULE_AUTHOR("Joris Vaisvila "); +MODULE_LICENSE("GPL"); + +MODULE_DEVICE_TABLE(mdio, mtk_soc_fe_phy_tbl); --=20 2.53.0