🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25304

[PATCH net-next v6 0/6] net: phy: mediatek: calibration for AN7581/3

#25304
From: Christian Marangi
Date: Tue, 01 Dec 2026 13:42
88 lines
13648 bytes
This small series adds calibration support for Airoha AN7581 and
AN7583 integrated PHYs.

The calibration logic is quite big so I decided to split
the driver from the mediatek one to keep things organized.

Minor change were needed and just additional symbol to use what
is common between mediatek and airoha PHYs.

I followed the naming pattern of mtk by calling the new source
airoha-ge-soc and related config.

The calibration use lots of static table and software calibration
at runtime instead of using efuse to calibrate.

There is one pecularity where some register and calibration needs
to be done on port0 first and then with the related port.

This is O.K. as port0 presence is mandatory for the functionality
of the integrated switch and it's assumed to be always present
on the MDIO bus.

MAINTAINERS is updated to reflect the changed code.

(this was tested from a long time and also verified by Airoha for
correct order of calibration)

Changes v6:
- Fix deadlock with phy_package
- Lock the bus when using the MMD package OPs
- Better clear and handle cross PHY register
- Fix non negative offset in calib table
- Add imply for Airoha SoC DSA driver
- Fix wrong documentation description for function

Changes v5:
- Add review tag
- Add additional helper for phy package
- Use __phy_package helper instead of phydev_p0
- Better use lock and unlock for phy package
- Configure base address for the phy package

Changes v4:
- Fix typo in Kconfig
- Prevent out-of-bounds for zcal_ctrl
- Protect concurrent rext_sw_calib_done
- Validate port 0 presence for calibration
- Correctly set shared local variable
- Use phy_package_init_once for shared tables
- Better handle early exit restore
- Better handle phy_select_page

Changes v3:
- Address comments from sashiko bot
- Apply review and suggested changes from Airoha
- Rebase on top of net-next

Changes v2:
- Split header register patch from cal_cycle part
- Fix missing EXPORT_SYMBOL_GPL

Christian Marangi (6):
  net: phy: mediatek: move MTK GE SoC registers define to dedicated
    header
  net: phy: add additional helper for PHY package
  net: phy: mediatek: split Airoha code to dedicated source
  net: dsa: mt7530: mmio: Impl AIROHA_GE_SOC_PHY for Airoha SoC
  net: phy: mediatek: add calibration logic for AN7581
  net: phy: mediatek: add calibration logic for AN7583

 MAINTAINERS                              |    9 +
 drivers/net/dsa/Kconfig                  |    1 +
 drivers/net/phy/mediatek/Kconfig         |   23 +-
 drivers/net/phy/mediatek/Makefile        |    1 +
 drivers/net/phy/mediatek/airoha-ge-soc.c | 2014 ++++++++++++++++++++++
 drivers/net/phy/mediatek/mtk-ge-soc.c    |  523 +-----
 drivers/net/phy/mediatek/mtk-ge-soc.h    |  374 ++++
 drivers/net/phy/mediatek/mtk-phy-lib.c   |   72 +
 drivers/net/phy/mediatek/mtk.h           |   13 +
 drivers/net/phy/phy_package.c            |   59 +
 drivers/net/phy/phylib.h                 |   78 +
 11 files changed, 2638 insertions(+), 529 deletions(-)
 create mode 100644 drivers/net/phy/mediatek/airoha-ge-soc.c
 create mode 100644 drivers/net/phy/mediatek/mtk-ge-soc.h

-- 
2.55.0
Technical Details
Message-ID: <20261201134415.137116-1-ansuelsmth@gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375122-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375122-linux-kernel-netdev=dewy.ru
From: ansuelsmth@gmail.com (Christian Marangi)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v6 0/6] net: phy: mediatek: calibration for AN7581/3
Date: Tue,  1 Dec 2026 14:42:01 +0100
Organization: Usenet Network
Message-ID: <20261201134415.137116-1-ansuelsmth@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1725710"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:qZEEgnKNic/OX0CaiSoG6HNzBwo= sha256:ZWSo+5+nOpJC2/oAQMBbtDsM98EwQGGdEZVZRcwBRPk=
	sha1:lGPFQ86jHkhTXqsStgqKHrtgYSY= sha256:ZUBviBl7a3g+Rkckt9rCjQQVe5GwBndCMV8ScELofpg=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 333441173C6; Tue,  1 Dec 2026 16:44:58 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id IUY4728EjpTY;
	Tue,  1 Dec 2026 16:44:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375122-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id D03CA117393; Tue,  1 Dec 2026 16:44:42 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 5797E2AFED; Tue,  1 Dec 2026 13:44:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796132680;
	b=FCwLcZHfmL0ZPn/lIk7pjd+LNOFlC6l3d1vjtQXqYBp4w39+R8vfgteSgrcpaxzh0xFp
	 BXtnb0Hd/5DY0f8vs4oTqPjTZFmkEJY7tJNuA2GxlGVmcY3leMoZbqvkKAzixWkndr425
	 X98BUNE4aKbhP01R06QDsfFkSvO9U75uzaOyR6o3MEaMLPBVEj9STnW0rFepm3Ar2VG4+
	 +ITYs5QNLBl8CDhT6ZO58009XKK+PDJsLbv8FY+b3OGiXRwCuaAdx0yBvIP5eQapAHxU1
	 KP+QpeOQGCk4ierZReBSogdd2gh1FyUGInN/mCEr0Bp+X4KWQVkls9lt1eIffcaoPow==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796132680;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:From:To:Subject:Date:Message-ID:X-Mailer:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=Nmu8n20yj/qqwca01MOQSMIYeMYLuGBXqLokeXj7ZUM=;
	b=UN2uu+KJcCcyfSqs8jn6Ecs4V0tMyRZdn3DulTZZiYbIUDyWnauCiKxVIHXqHWnRhLX8
	 uvUYntK/0TkbBDroMdKbGphtcIiJYUSo2fHMMVQkyLRHiZCh+weWYnW6mhXA/IroRzPOf
	 WQUUDAtqhUllKKl9VFgL5tv8tTM3PyyPH+2gWi3A7w4sfEW4/3KQk1IHRltcVG8eZ8L1Y
	 h9GFYt9U1JfmxoeO6oi+I5PkpHy5fRGkPO2Bbju7KAf/ZcRL43ETy4Df2/Q/v3SOqOD2B
	 kirsxG/aBhDpYpwVuHCRZlmBQL7UD+euMgY4YhwHwgCnKwWCd4/HH4IR4iPBlds+i3Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="I//wWFAi";
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 94A21606A331;
	Tue,  1 Dec 2026 13:44:40 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=I//wWFAi
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.45
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796132679;
	b=JnyUKhFdcMsFw18ptzPM23wl40rjSH9/d8VXmlnWC3CUG8OrxtQpj/dOzliN4vY58f1A
	 CPddvSA8khVOrXFnbymtART5AVSoVoPnn8fM71SaJ9xfamNXanRGuMjLRV0JH8p+0MLIC
	 eqB0L4kHkLHJG1/M+z3De+RvlrpYwwJ2x/tJt52EYnYD8fW2yjQxHuBTzJynnnzaEM8YJ
	 USl6LAdeToQzULlKikHM1vSuuiI1D9V9ud6g6HJ0q1E/i7WZW1xslMNmGGlVWFbEaS0Lt
	 PKEio6704hnoKV5MKJGQFESf6ftWnipxT53dHKxSAnzYfqFjS11qzMf1sUMpwT4W76g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796132679;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 From:To:Subject:Date:Message-ID:X-Mailer:MIME-Version:
	 Content-Transfer-Encoding;
	bh=Nmu8n20yj/qqwca01MOQSMIYeMYLuGBXqLokeXj7ZUM=;
	b=ZjJT59x9T+ub7qPMYTpDDdbsxgBgyg3HFqBU8aaZg1tZfHcWRbqUAi9G2SjRlLGqZZ4y
	 MdNz1eeCejkDY6kwHI+j7A8K8oHwpRrSboRKsUJH4pruYg0Qej45bi35eLZJml0uoibvx
	 ke+US44a9VbcSuXcgjhKlwNDUX0TxQNRTVyE+/z4vY98rEatl6HIg1QP/w9HMJ4AVz6pK
	 NMe9fjzuwvilMUhKLgxmRwfX3HoZB/t4751/TP8myVobOsscs1Vm+05D/vs9cA0Mre/oA
	 gfkLrpMaxN9e0AWQvIfosuA4hS++8xxI7c5kx9FDzxX3KC7VlQxXPq0JqMKkPqdWXOw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="I//wWFAi";
	arc=none smtp.remote-ip=209.85.128.45
X-Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BF26606A31A
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 13:44:39 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5BF26606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4a5b2be99a8so91882845e9.2
        for <netdev@vger.kernel.org>; Tue, 01 Dec 2026 05:44:39 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796132678; x=1796737478; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:to
         :from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=Nmu8n20yj/qqwca01MOQSMIYeMYLuGBXqLokeXj7ZUM=;
        b=I//wWFAi967ig+jkxUHW3LoHpPWWX1MUr3rfdaqPEAdIEHFrjwW79M7IcPuQpDGXtK
         ehVAUC8TGINNuckseNXm7Bzs663L3FgrW/qWc+udOisZGkUTbtu8TB4Bt3rFa6TJwd6E
         BhxBeTtUfStHlmXN5gH0CuWkVRR1kF0hzYVOjZRY+ApIGwD6B7vcoehTbwhGHGe+mxaC
         9rtn8e+vYiCR0Fs3ALdRUyy3yAv/UwW20YD+lpedwfkADpMVYWBygX/aNUMhU9qaEGsx
         subNs5MmRo3M05pH1hl9JkIAfFyzx7DA/QqPTued5ulJMCWxht6VCpfVlUB19LisIhg5
         58pQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796132678; x=1796737478;
        h=content-transfer-encoding:mime-version:message-id:date:subject:to
         :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to:content-type;
        bh=Nmu8n20yj/qqwca01MOQSMIYeMYLuGBXqLokeXj7ZUM=;
        b=yiegp7WDAy2B+a04J3to/VGqSsu+0GgHdRVKSRb7PYVRLZsnWcvQzCuARdcX8B5UcF
         GR92Ji8BPNaP3oKt0tE+ye10mZEmQ74vXJ04PDn6JH0ERNqQE9mhg2sJOo3N49eTaVRa
         1AM7HKpWJUx7nnmQSZZxHhdWwaFzQD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5MPArBBWckfZ//GuFVxeiEvksu7vj9OjA299Fd4
	E7g76kdGELWmjBGs+jw==
X-Received: by 2002:a05:600c:1d86:b0:4bb:6a5a:7824 with SMTP id 5b1f17b1804b1-4bb8892099amr783666275e9.30.1796132677455;
        Tue, 01 Dec 2026 05:44:37 -0800 (PST)
X-Received: from Ansuel-XPS24 (93-34-92-103.ip49.fastwebnet.it. [93.34.92.103])
        by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-4ab65cb4341sm70195987f8f.4.2026.12.01.05.44.36
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 01 Dec 2026 05:44:36 -0800 (PST)
X-Mailer: git-send-email 2.55.0
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list