From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8C1F606A6A9 for ; Tue, 1 Dec 2026 13:44:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=UO9xaNZl; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=e7OBMiRL DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=Nmu8n20yj/qqwca01MOQSMIYeMYLuGBXqLokeXj7ZUM=; b=UO9xaNZliLc8CqqsunufW5RKiw RQVHK1VDd2rc+vRfwc8RrqxfooDs0t7WvG7qf/+JtvPtAmAOv6EoBgTn71WmW4UlYEAgNVZQLVj6c pC3B+XkJoA8DGhwli4NPlxFrw0YjCtSdop51LEqgdISonf6rShw5kFobhUXfjEyS6G9j9HnTHFPL4 3sqLVNWK1TCAMJHF7NOJqDEh7usKQqu0jt0LcQ8gc+vLUXuYRglJfHRXlpvWG2TiV2bheYOSayM+g lwbnJW4wEEnAzo5fqgsr1K/22NFwi5bDDrdv0OqQEk7cAhFS7+/WClQ82crKJX5wnlesVD/WXKNm0 Fx/ro08A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYO9y-00000008IYv-2XSb; Tue, 01 Dec 2026 13:44:42 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYO9v-00000008IXG-3CdY for linux-mediatek@lists.infradead.org; Tue, 01 Dec 2026 13:44:41 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4bb70074ab2so124182665e9.0 for ; Tue, 01 Dec 2026 05:44:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796132678; x=1796737478; darn=lists.infradead.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=e7OBMiRLhVd06BpE9GNTdvP7jg/b29TpVxDg/kgAV61AWVtAapBOGdGcD162v8vrjo bDfQfaIA3VKC+9o7YrM0PyjR+4LIYGsNxhdKvCi6CMioivt3BY1OJQUxfKDujrxaYVqh KrAFNNTbxwvUAstnwnOLJxTHLd+s7AqQfJyYhED0NXd72DZuvI8TY00BB0bcAhsVl8ym l7g8II96a1lqqwNdwU4SWftqZEHTAryowe0/emqNI9xDJ6RDKfkU4SiwMJYxgD5YKGxE 2mX1doCRjffwlcGomlAv7yY0yoLtZdFnD/27ouOvFcmnSRruN+qA3Y3ZXUn68iGTTl6b pR5Q== 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=ee2DAizuHc+xlacg8iQQZbdHHV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coB8g13TzQS3UVdJR QVa2mAgQM3cuhHiiilx5NazU3Qz+ZdmYRtaP1lmmTPp1aX0MyUvBzrxPA6/NG1b7VZUxLudYTqp 0gjmFSV+T9TClU0sGotuhS6aYlbpjoRt8ERHgdAyYbeQjrRUf+76MDEBSSMO3OtN03lo1l0q8Yl rfc9+92cgcbF3ZGaGlw== 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) 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) From: Christian Marangi To: Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Christian Marangi , Daniel Golle , Qingfang Deng , SkyLake Huang , Matthias Brugger , AngeloGioacchino Del Regno , Ahmed Naseef , Joris Vaisvila , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next v6 0/6] net: phy: mediatek: calibration for AN7581/3 Date: Tue, 1 Dec 2026 14:42:01 +0100 Message-ID: <20261201134415.137116-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.55.0 X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_054439_839682_B5DCD856 X-CRM114-Status: GOOD ( 17.43 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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