From patchwork Wed Sep 23 20:47:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 3458 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id 960371C2AD3 for ; Wed, 23 Sep 2026 22:47:55 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=baylibre.com; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-26223-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-26223-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 971992FBD5 for ; Wed, 23 Sep 2026 20:47:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5F8E57D224; Wed, 23 Sep 2026 20:47:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="iEMHv6YT" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-wr2-f35.google.com (mail-wr2-f35.google.com [74.125.225.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EAEE3EC6A4 for ; Wed, 23 Sep 2026 20:47:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.99 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790196468; cv=none; b=INy+TANlHPAQVYdjAY53Hr/k7lGSlp9ZJXOxNwJBqZdys2BedGzMKVNUAC+gDLy/IZQ8SDGyGO3iVI08PDcYRJF6sF6hmOofU3RV6aKVm4vn+7ebwZGu7lTfFI0o9sAmmgYD5PxjYID1O6SAwGCLuFycZhllsSzVPIztjzCIt10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790196468; c=relaxed/simple; bh=2Rk7dcj1EIntxo1C/ioN2dfS7ZxOV+D+YaH7GClK4Vk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I2b1ykQqPtzAxXvmIG250nqk+8oGcwuRBRSaJzXr3NxjTCZ/IKNSQKPTHk8ROca0UVaQ4+H9NSqiiWoahYuZxW9D9zMf/pfbi2FG9Cp5tnBXyfE4itqQjyImg3q9o2CVBZOuxhQAcjJ0bLEKK+JRamb1TVBLG/ZtRX0oakfHSlU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=iEMHv6YT; arc=none smtp.client-ip=74.125.225.99 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-wr2-f35.google.com with SMTP id ffacd0b85a97d-4885a1480a2so802967f8f.3 for ; Wed, 23 Sep 2026 13:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790196465; x=1790801265; darn=lists.linux.dev; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=XWoyChkF8PBA93YfN7WK6+qy/EfUiqZ/evixTMMcgfA=; b=iEMHv6YTIyrBHAbheUCE9LAqQa6UvchH6EL6igmoJW+T60BqEW/lwsFAy+p+JkXVmI MokjpohW3GJ0klCa4C+24iGYzyp6AI87ERu8NifVowSew3jecijzk6Wzj64zYOfXH51V eqJuWmsc/UZSKxGffOVMtpjQVwDGOa2aE0Lq/Cl0DGcqmm0WRVpbw1vjFInJva5NTQFR GuuL9ggFTko1iJY8bgQabmu1xhCiCkS3SGD+4H6oScQEDLQgJMJd20ttpFbX+X6PTkjD fICu3nRIPSxHihbKHMByYc48xWr5OqMdl8QEFUzv0F+JaTQWp2Stp5fWLhh9YmHoYPVJ VzQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790196465; x=1790801265; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=XWoyChkF8PBA93YfN7WK6+qy/EfUiqZ/evixTMMcgfA=; b=xmyJ36wRgLzYoBntBhe6KeXt5cKPJhzNlLF8YiZRhW10vDRGPKOrlzMBe3yZNeuhKL 7lbORlu+2nAfcDFK6GGuCzXQKAvYB2o9mbnA4sLXsJ5KXuUqPKLhXjvWMyHchsscv2Gg 2o7WPsxPaQfpP+kESoqmy362WNLR5s36jLtOvqrKcBS7ZFO7SRM5UIb2BotWTPnLndXd FE0Ne0+mWtyY/dlvUXLmEfPQvwSV2XbyIdV+XVNoBF1WqWwxJlteCaX6X+J9Grz9J0Gk VQhLNTfxlqOyTkvRg/9eCCsLgcKd1mccqJFAKZ4qvUJ9FGq+lvhdVMUwRRx8DbRPJuMN JM8w== X-Forwarded-Encrypted: i=1; AKwUvBw+nfb0AnJ2OgtlZDikKRNSsSrQcFUBXznOKzX/q/HyrZFkmYQ099K9yv42YwADfNe6H1JdyDpFTCDadg==@lists.linux.dev X-Gm-Message-State: AFuF++n04r7mXPoAgX+V2nDApAuv2+ihrlwebL6MaCIkzUtvxXPtKFj5 7M2bj6Eph3tsqaa+k2eAV3VZloAydTljAnXbJnhRu5iQB/VTHMbQqoAmdtOqiMz/g7E= X-Gm-Gg: AYBFou3KFIgcGP7rudFbWBo7EnEsYl1c1bNsIfjnEOyOdMb3pdkB23zvaeLaFoCcZDj hwu4q6cSsJKlbITTe3hi1fE535owlFP4zIcGLP9n7g6axCGMmdNOeDx1lYRXBrMMgZ+fxgguhPm gGuR2SN/PoQX+DKrTrTGHpbTP0Ixz+0Xg4+rfv2S2XpM3pBGOKn+KGJ9ydYbZKq+ZFpUzpMm+/V PHhCxB9uLc5RV7Yb+2Y00p5xOS5MNV5FJF+tSHLD1kjSF5pP1JMvv/8Ri5RTljGGDx82zCgexHq dVi2s0h3MdT3E89CeHZKPZ/BBotrcJcl2s3ndZI5Et4568UtkKQn/5ZnxJ7E2LRjTmEYV5xeSmW iBGwqHoHxWS78ch1/4kwkC3lDwAH3C5W3bL3XLAlpDQYlDA5C+FpghE/HTisycjwLPMDR8/jihq 0hhb5M5GjRjul0OuFCn3ILiIbLUWKUOad5V28R8tIcY5GH+hob7LKHfKme9K5tJuQ0odjZZSo7b lzN/onxmJDU0giggQ== X-Received: by 2002:a05:6000:25c2:b0:487:2354:d9d5 with SMTP id ffacd0b85a97d-488717240c7mr464443f8f.55.1790196464768; Wed, 23 Sep 2026 13:47:44 -0700 (PDT) Received: from localhost (82-67-6-57.subs.proxad.net. [82.67.6.57]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4886876c500sm9316780f8f.19.2026.09.23.13.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2026 13:47:43 -0700 (PDT) From: Jerome Brunet Date: Wed, 23 Sep 2026 22:47:31 +0200 Subject: [PATCH net-next v3 1/5] dt-bindings: net: sun8i-emac: Add A733 GMAC210 compatible Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20260923-allwinner-a733-gmac-support-v3-1-15735155a789@baylibre.com> References: <20260923-allwinner-a733-gmac-support-v3-0-15735155a789@baylibre.com> In-Reply-To: <20260923-allwinner-a733-gmac-support-v3-0-15735155a789@baylibre.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Richard Cochran , Maxime Ripard , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Maxime Chevallier Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Andre Przywara , Jerome Brunet X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6760; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=2Rk7dcj1EIntxo1C/ioN2dfS7ZxOV+D+YaH7GClK4Vk=; b=owGbwMvMwCW2VtK+WnvWU3HG02pJDFlbrN5qaUf77BN3bJwfJC++VkBvYaWMbYWR1afZ6mJr4 ja++vSso4SFQYyLQVZMkaWGu1r8naTWl1nTdW7DzGFlAhnCwMUpABPZupHhxz517jN7T5x3alB1 N9/pM2vPwZOyh00kIpz4098WTOzczMgwY17a0wPyxufk71jW3GtatmaK+xmGP3+FGRsu27j4yvX xAwA= X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= The A733 GMAC210 is a DesignWare MAC 5.20 close to the A523 GMAC200, with the following differences: * The glue configuration registers are a dedicated MMIO region of the controller instead of a syscon register, so a second reg entry replaces the syscon phandle. * The DMA channels and the LPI event have their own interrupt lines. * A PTP reference clock and an AHB reset are needed. * Unlike the A523, the controller does not appear to belong to a power domain. * The TX clock delay field is 5 bits wide and both TX and RX delays use a 180ps step, allowing up to 5580ps. Add the new compatible and describe those differences. Declare the internal delay properties at the top level and keep their limits per compatible. Reviewed-by: Rob Herring (Arm) Signed-off-by: Jerome Brunet --- .../bindings/net/allwinner,sun8i-a83t-emac.yaml | 142 ++++++++++++++++++--- 1 file changed, 126 insertions(+), 16 deletions(-) diff --git a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml index 323a669fa982..a4e0d9b760fe 100644 --- a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml +++ b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml @@ -22,6 +22,7 @@ select: - allwinner,sun8i-v3s-emac - allwinner,sun50i-a64-emac - allwinner,sun55i-a523-gmac200 + - allwinner,sun60i-a733-gmac210 required: - compatible @@ -44,25 +45,38 @@ properties: - items: - const: allwinner,sun55i-a523-gmac200 - const: snps,dwmac-4.20a + - items: + - const: allwinner,sun60i-a733-gmac210 + - const: snps,dwmac-5.20 reg: - maxItems: 1 + minItems: 1 + items: + - description: MAC controller registers + - description: Glue configuration registers interrupts: - maxItems: 1 + minItems: 1 + maxItems: 4 interrupt-names: - const: macirq + minItems: 1 + items: + - const: macirq + - const: eth_lpi + - const: tx-queue-0 + - const: rx-queue-0 clocks: minItems: 1 - maxItems: 2 + maxItems: 3 clock-names: minItems: 1 items: - const: stmmaceth - const: mbus + - const: ptp_ref phy-supply: description: PHY regulator @@ -76,6 +90,18 @@ properties: Phandle to the device containing the EMAC or GMAC clock register + tx-internal-delay-ps: + default: 0 + minimum: 0 + description: + Internal RGMII PHY TX clock delay chain value in ps. + + rx-internal-delay-ps: + default: 0 + minimum: 0 + description: + Internal RGMII PHY RX clock delay chain value in ps. + required: - compatible - reg @@ -87,7 +113,6 @@ required: - reset-names - phy-handle - phy-mode - - syscon allOf: - $ref: snps,dwmac.yaml# @@ -215,6 +240,34 @@ allOf: - mdio-parent-bus - mdio@1 + - if: + properties: + compatible: + contains: + enum: + - allwinner,sun8i-a83t-emac + - allwinner,sun8i-h3-emac + - allwinner,sun8i-r40-gmac + - allwinner,sun8i-v3s-emac + - allwinner,sun50i-a64-emac + then: + properties: + reg: + maxItems: 1 + interrupts: + maxItems: 1 + interrupt-names: + maxItems: 1 + clocks: + maxItems: 1 + clock-names: + maxItems: 1 + power-domains: false + tx-internal-delay-ps: false + rx-internal-delay-ps: false + required: + - syscon + - if: properties: compatible: @@ -222,32 +275,60 @@ allOf: const: allwinner,sun55i-a523-gmac200 then: properties: + reg: + maxItems: 1 + interrupts: + maxItems: 1 + interrupt-names: + maxItems: 1 clocks: minItems: 2 + maxItems: 2 clock-names: minItems: 2 + maxItems: 2 + resets: + maxItems: 1 + reset-names: + maxItems: 1 tx-internal-delay-ps: - default: 0 - minimum: 0 maximum: 700 multipleOf: 100 - description: - External RGMII PHY TX clock delay chain value in ps. rx-internal-delay-ps: - default: 0 - minimum: 0 maximum: 3100 multipleOf: 100 - description: - External RGMII PHY TX clock delay chain value in ps. required: - power-domains - else: + - syscon + + - if: properties: + compatible: + contains: + const: allwinner,sun60i-a733-gmac210 + then: + properties: + reg: + minItems: 2 + interrupts: + minItems: 4 + interrupt-names: + minItems: 4 clocks: - maxItems: 1 + minItems: 3 clock-names: - maxItems: 1 + minItems: 3 + resets: + minItems: 2 + reset-names: + minItems: 2 + tx-internal-delay-ps: + maximum: 5580 + multipleOf: 180 + rx-internal-delay-ps: + maximum: 5580 + multipleOf: 180 + syscon: false power-domains: false unevaluatedProperties: false @@ -412,4 +493,33 @@ examples: }; }; }; + + - | + ethernet@4510000 { + compatible = "allwinner,sun60i-a733-gmac210", + "snps,dwmac-5.20"; + reg = <0x04510000 0x8000>, + <0x04518000 0x1000>; + clocks = <&ccu 58>, <&ccu 59>, <&ccu 60>; + clock-names = "stmmaceth", "mbus", "ptp_ref"; + resets = <&ccu 30>, <&ccu 31>; + reset-names = "stmmaceth", "ahb"; + interrupts = <0 175 4>, <0 179 4>, <0 176 4>, <0 177 4>; + interrupt-names = "macirq", "eth_lpi", "tx-queue-0", "rx-queue-0"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins>; + phy-handle = <&ext_rgmii_phy_2>; + phy-mode = "rgmii-id"; + snps,fixed-burst; + + mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>; + + ext_rgmii_phy_2: ethernet-phy@1 { + reg = <1>; + }; + }; + }; ... From patchwork Wed Sep 23 20:47:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 3460 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id EC6F41C2AD4 for ; Wed, 23 Sep 2026 22:48:23 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=baylibre.com; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-26224-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-26224-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 19A1E312B4 for ; Wed, 23 Sep 2026 20:47:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DF4557EDAE; Wed, 23 Sep 2026 20:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="BCn1UzL+" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-wm2-f12.google.com (mail-wm2-f12.google.com [74.125.225.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C420A57C706 for ; Wed, 23 Sep 2026 20:47:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.140 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790196470; cv=none; b=csB6o7HsfbNftpRHwJ+Hwv9uGwX8COI5t3XGWBA5hAhnJ1Ex7mmFkKD7bZfHpfm9tL3WvH8EO1IwSSWwt5iWFGuTBez1/SyRwXi2EVcjPErCLx1C8ZglBTgHwr8SjGptxp0ixqCtRJ559mMbt15VP0MqZPV2gcHe2+DAlrCjVxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790196470; c=relaxed/simple; bh=DYM49ne6atEAPBbwp7MW6XIu2N107jKi+6HoBXrWSjs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Zt8xtyISnWxAtslS7wF40aBPgaYnjqvvjXTh3dmva0OBu8VRQAH8n40z2z3fnEFJ3DLolbt9LesTEKqv38wznclLsMxs9G9Kq0BLAT5GcDOzCIcX6nuf/sAfYIcnInWbfaRLRm6qnRXD7ESfoNf1lvxu65TTzEgNBVhvovj0lAg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=BCn1UzL+; arc=none smtp.client-ip=74.125.225.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-wm2-f12.google.com with SMTP id 5b1f17b1804b1-49b912df756so9976805e9.3 for ; Wed, 23 Sep 2026 13:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790196466; x=1790801266; darn=lists.linux.dev; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Q38gPulPuKur3IEZF2LFNkQp+BQq6YW8/OlTIlhL7Jo=; b=BCn1UzL+coTnpzSTi8AbDApnuNcP2UKBmMOuWpnwZSFnOQN+2W8zkqTlRINxVddMFz mPklnW2mOQWG8ilqjakPkkBEVc6cej+cg12P1D3cE9hdUuIkEhpvzx6tXEH7pWhpXYZ6 lxcaycEQITcPrxpyBuEZnOxF6rQSas4VKTVeF3mH3vCtHo31tEEK4C35JdEDERt9VTOs 5WV+7Td46MEIZr9Z7HCW7IXOQ7FGxc81k8c/7A3SOktreHMdDOH8nBT8iEteP+mlfPrq opRpeaPKKL7NkG7XBzyrpd5wr3pEbtdvHkdizHefEhyR76zQKEilAWRNljC6oj39v7Tf hdzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790196466; x=1790801266; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Q38gPulPuKur3IEZF2LFNkQp+BQq6YW8/OlTIlhL7Jo=; b=IfdFDR+8r05qD6Rh3yGg1il5u2DhztCrVjxFHCdl0QeKGQpTA7DM7ZXZT3f4wSvoSj MxGWLK4awVZ6NzdSJB/FcO00nN5PsH/qHDzHgNrZytHIbKri/6Yx2vRvbSjl6sycUbvU YxykX/FHn/EasDf0HyQOZIWWvMsWrcRy7u5y6qAfB11obcHhDzDOhidlZN9DxmGZR9+A NBc+zozhecZpPR/8bMElmXwK4HSDB+2MKUkcukWmKetfHL6SmHc56nCkSiI2Wk1wENHm 1M1tf2dmK8xeJcZ/ZFmOf6umNmLx2GMWpe50sa4yTiJK6k6CIXi+t5VJaF7khommlCFF 2aDQ== X-Forwarded-Encrypted: i=1; AKwUvBwSMi8HATmIvo9R5TzEOiV2ceoILKBFvHqCqfcUuA41V+OOZp+uE9oEpo2gG8PIPXw/fL9qZ7goJfEiyQ==@lists.linux.dev X-Gm-Message-State: AFuF++k4kqgb1Wky0m9Uu5d0x5Ilyq6fJMBf6YtpJyfZAjaTv/PWIQYS gYXtRFk+RylHFXdXqFB0sR3XIsbJJwbusWBaoBmNdHbtsWbXWp9fdSDsF6OKqiGSgGc= X-Gm-Gg: AYBFou1YU6hvaEGrkeaXILrZPUrOmAGDnJnR0tnHpTiCz0edMltZlZJXyMk85gtRUYb Vxf3pFFRk5LrOD1Af//RWQV78galul1isuGkmOZ5UsJNmdRVNo20jQBYfgSrNrsS0zITTYRSxm1 Udozky+XpDRTWOEg5jvC/kspLOll0hhKjpuA41Oh/E/NGdBHE1rhtnc9yJTegGmH/Bf0WalmD4U Ngb59rjUjMdhP5uXbGmQSGkALSVa0CS2/fh46M22sYZ6nKXt4SM/vNDhzRrpO4C7KKYQN+OOVO9 YD8p86rZVrvTAclpjRBbOu73OqNTs7kV3SddVbm/lj9X/Ssg7IfFdwiQH2/bvZjd8VrzmmfVgcA SUp45EBbsANXe87yC5VV6alrIT5h3AaGKI+mSBRWFasYt8xhpmjyHVD6ftoyLHCZ5+IOxqlx75L nuJ112GHB0iOlrwvKyKXWtQf55Tm8y9tbduizV82wHg4mj6nj52Fj4ToG82u3TRGO8irXJn6cpA NtWzzbr/VeNWBJM7g== X-Received: by 2002:a05:600c:1c0b:b0:49c:fc6e:8cb4 with SMTP id 5b1f17b1804b1-49fe66dfe1amr7799915e9.24.1790196465888; Wed, 23 Sep 2026 13:47:45 -0700 (PDT) Received: from localhost (82-67-6-57.subs.proxad.net. [82.67.6.57]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fe5df44f9sm11367675e9.11.2026.09.23.13.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2026 13:47:45 -0700 (PDT) From: Jerome Brunet Date: Wed, 23 Sep 2026 22:47:32 +0200 Subject: [PATCH net-next v3 2/5] net: stmmac: sun55i: Add per-compatible match data Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20260923-allwinner-a733-gmac-support-v3-2-15735155a789@baylibre.com> References: <20260923-allwinner-a733-gmac-support-v3-0-15735155a789@baylibre.com> In-Reply-To: <20260923-allwinner-a733-gmac-support-v3-0-15735155a789@baylibre.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Richard Cochran , Maxime Ripard , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Maxime Chevallier Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Andre Przywara , Jerome Brunet X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4588; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=DYM49ne6atEAPBbwp7MW6XIu2N107jKi+6HoBXrWSjs=; b=owGbwMvMwCW2VtK+WnvWU3HG02pJDFlbrN66bpWrmPz5JntSyopU3pdTNryr12g0buPx2RphV zNNfNP2jlIWBjEuBlkxRZYa7mrxd5JaX2ZN17kNM4eVCWQIAxenAEyEM5eRYf7qmbuZ5Q3skvb5 ZNtkmHIU7X2ubZlgtU9wQ6y2xfYHVxn+J69n1tIWZfwm0hWTqKwxVf0Y28P2zvazHA1199pWmxl wAgA= X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [3.34 / 15.00]; RBL_SENDERSCORE(2.00)[172.105.105.114:from]; SUSPICIOUS_RECIPS(1.50)[]; MAILLIST(-0.15)[generic]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; PRECEDENCE_BULK(0.00)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; TAGGED_RCPT(0.00)[netdev,dt]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWELVE(0.00)[25]; DMARC_NA(0.00)[baylibre.com]; FORGED_SENDER_MAILLIST(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[tor.lore.kernel.org:rdns,tor.lore.kernel.org:helo,baylibre.com:email]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG]; R_SPF_ALLOW(0.00)[+ip4:172.105.105.114]; FREEMAIL_TO(0.00)[lunn.ch,davemloft.net,google.com,kernel.org,redhat.com,gmail.com,sholland.org,foss.st.com,pengutronix.de,bootlin.com]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[74.125.225.140:received,82.67.6.57:received,100.90.174.1:received]; FROM_NEQ_ENVFROM(0.00)[jbrunet@baylibre.com,linux-sunxi@lists.linux.dev]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-26224-noreply=patchwork.local]; MID_RHS_MATCH_FROM(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[172.105.105.114:from] X-Rspamd-Queue-Id: EC6F41C2AD4 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= The A733 GMAC210 glue registers are in a dedicated MMIO region of the controller rather than in a syscon, at a different offset. Add per-compatible match data holding the glue resource init callback, the stmmac flags and the glue register offset to prepare the support for the A733. Signed-off-by: Jerome Brunet --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c | 68 +++++++++++++++++----- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c index 862df173d963..c4df53285007 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -23,8 +24,6 @@ #include "stmmac.h" #include "stmmac_platform.h" -#define SYSCON_REG 0x34 - /* RMII specific bits */ #define SYSCON_RMII_EN BIT(13) /* 1: enable RMII (overrides EPIT) */ /* Generic system control EMAC_CLK bits */ @@ -37,18 +36,40 @@ #define SYSCON_ETCS_EXT_GMII 0x1 #define SYSCON_ETCS_INT_GMII 0x2 -static int sun55i_gmac200_set_syscon(struct device *dev, - struct plat_stmmacenet_data *plat) +struct sun55i_gmac; + +struct sun55i_gmac_data { + int (*init_resources)(struct platform_device *pdev, + struct sun55i_gmac *gmac); + unsigned int flags; + u32 offset; +}; + +struct sun55i_gmac { + const struct sun55i_gmac_data *data; + struct regmap *regmap; +}; + +static int sun55i_gmac200_init_resources(struct platform_device *pdev, + struct sun55i_gmac *gmac) +{ + gmac->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, + "syscon"); + if (IS_ERR(gmac->regmap)) + return dev_err_probe(&pdev->dev, PTR_ERR(gmac->regmap), + "Unable to map syscon\n"); + + return 0; +} + +static int sun55i_gmac200_setup(struct device *dev, + struct plat_stmmacenet_data *plat, + const struct sun55i_gmac *gmac) { struct device_node *node = dev->of_node; - struct regmap *regmap; u32 val, reg = 0; int ret; - regmap = syscon_regmap_lookup_by_phandle(node, "syscon"); - if (IS_ERR(regmap)) - return dev_err_probe(dev, PTR_ERR(regmap), "Unable to map syscon\n"); - if (!of_property_read_u32(node, "tx-internal-delay-ps", &val)) { if (val % 100) return dev_err_probe(dev, -EINVAL, @@ -95,7 +116,7 @@ static int sun55i_gmac200_set_syscon(struct device *dev, phy_modes(plat->phy_interface)); } - ret = regmap_write(regmap, SYSCON_REG, reg); + ret = regmap_write(gmac->regmap, gmac->data->offset, reg); if (ret < 0) return dev_err_probe(dev, ret, "Failed to write to syscon\n"); @@ -107,22 +128,34 @@ static int sun55i_gmac200_probe(struct platform_device *pdev) struct plat_stmmacenet_data *plat_dat; struct stmmac_resources stmmac_res; struct device *dev = &pdev->dev; + struct sun55i_gmac *gmac; struct clk *clk; int ret; + gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL); + if (!gmac) + return -ENOMEM; + + gmac->data = device_get_match_data(dev); + if (!gmac->data) + return -EINVAL; + ret = stmmac_get_platform_resources(pdev, &stmmac_res); if (ret) return ret; + ret = gmac->data->init_resources(pdev, gmac); + if (ret) + return ret; + plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); - /* BSP disables it */ - plat_dat->flags |= STMMAC_FLAG_SPH_DISABLE; + plat_dat->flags |= gmac->data->flags; plat_dat->host_dma_width = 32; - ret = sun55i_gmac200_set_syscon(dev, plat_dat); + ret = sun55i_gmac200_setup(dev, plat_dat, gmac); if (ret) return ret; @@ -138,8 +171,15 @@ static int sun55i_gmac200_probe(struct platform_device *pdev) return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res); } +static const struct sun55i_gmac_data sun55i_a523_gmac200_data = { + .init_resources = sun55i_gmac200_init_resources, + .flags = STMMAC_FLAG_SPH_DISABLE, + .offset = 0x34, +}; + static const struct of_device_id sun55i_gmac200_match[] = { - { .compatible = "allwinner,sun55i-a523-gmac200" }, + { .compatible = "allwinner,sun55i-a523-gmac200", + .data = &sun55i_a523_gmac200_data }, { } }; MODULE_DEVICE_TABLE(of, sun55i_gmac200_match); From patchwork Wed Sep 23 20:47:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 3461 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id 2B1151C2AD3 for ; Wed, 23 Sep 2026 22:48:49 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=baylibre.com; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-26225-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-26225-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 09FF331E9D for ; Wed, 23 Sep 2026 20:48:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F0B057F72F; Wed, 23 Sep 2026 20:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="j5tGXJA5" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-wr2-f35.google.com (mail-wr2-f35.google.com [74.125.225.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAA8557D235 for ; Wed, 23 Sep 2026 20:47:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.99 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790196471; cv=none; b=imFO1V/DT49sDIDTx/dIrsfNmbnC8mXj1ht+rNz0lrvp0WWN2p58YmTnGXaeEFm+v5FSdBo7/3RvWDs3neZjG1mCj6iz44Z+ioCbQQYiDoxfy72CADR7sNxbRkVE6g7KKFBsDujmp4dTMnRtOfTDVh4Zq+qf7tJwwickrd/Mxow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790196471; c=relaxed/simple; bh=u9upVCC3m/gwC2XGPIk9ZtnVEycENGqh8TgoKKLgrfg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FXGNMhJY/NktAJajIP51ha65i4HHFidQYaYRpHfMUXsS4eQP+JHqpUOgkPlAKG8QzvTGpDYeJ5pqfRdQk7PVaFfdola752yRFLM3gKxzrFAr6mfY7A3AAyhtIBzWndNtLVlEhta3rqeIo+/fcS5fxGvQtvYet6gpHd+VAa+y2jE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=j5tGXJA5; arc=none smtp.client-ip=74.125.225.99 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-wr2-f35.google.com with SMTP id ffacd0b85a97d-4885a1480a2so803037f8f.3 for ; Wed, 23 Sep 2026 13:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790196467; x=1790801267; darn=lists.linux.dev; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/NLzzVKxNDn2ENtNLz5RF0HuOFGSUxWDx/tiLwjYhuM=; b=j5tGXJA5osei7fOUIqVLKLxkmniwgbFbMrK8Z2+Ydzt0XgZaHfezlpqkcM58sOV8r0 jFge4Nv/CF9M5WguoPsYiRy0kAbK0VB4T5uG2+8EHFOLUFXOPpZYaaK+CT4gn9bOEsaJ wqX+nd/jCk9/ZglY4Eux4A0tDm6tnwE8FECVuzwPljjmzVp7n4bTTWvRy0U1PIrNc60G kPhZ7a9XRicR5C74PkkNxGFEjXtEK2vGbgv6zwNFQ/4yg8N/BkywXQIqxMnsdnF6L2eg natI19c/wPOM4thUPD2anBfxnsuohPHBupdtEIMMjaXi65PRG+oeoNBKFtnWRtMrUzty qibQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790196467; x=1790801267; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=/NLzzVKxNDn2ENtNLz5RF0HuOFGSUxWDx/tiLwjYhuM=; b=d6YWyvqlyrocb/1DdOk/0z6cerrLTiip0jouRivzbApcJWpTDJJEnP/K/F/7RZrOhL VIDxv2+ddm7jSot7q+KWgTK5wtaC9XmdH5aLeGq0blcUJLQ3Th0p+AbjERx2J6PuOa+W +QKi1nTwIgUVmkjNxLuK2T/M4AA0/TAc8HsrbejBSbBF91bR2SdeT+04+Op5WsnuHQ3z hvJrXxYdChC21HqhNxZKF0T+gOR/adMfLGC5XcpK94NDAyeOogvrkZOjbDQ9pzuI3eGx aYbCZV8E/sWHBpMYLJO+cuNek+i9F5rbQE7rn6gX4Kutj9k2RNOhQA3OI8wvUcdP09l3 0eeA== X-Forwarded-Encrypted: i=1; AKwUvByx/Q9tqvM53xnVL6LDDOcK3X7GoY8bB4FN1OOubTXILd6IWtEX9zUqLXCI2oYYaT+WKTTqoS35pm2/Gg==@lists.linux.dev X-Gm-Message-State: AFuF++nENu9MSQtacC00hJiQ+7wWFcdZFLzltGJxSPq5ixYarmIGZEI2 CZriXhvc57HEskmDQgcs6YkGpF/Yguk8LyWXvaTOK4YLHMiuG8G+/akY2Z57z8Ulf0k= X-Gm-Gg: AYBFou1xpuQMPMmoOArXHZ4Zhwu7rQnKwBYBNpb7rcCjfuOKcZjzjVJMtxqaKFoR7j5 oO7TLctk1+tHfGIWz1wXKQL8P3t/rB+t+p4rdDIKD/H4jv/HztAIJ2hJ81L0IlBqsMfq2znLBu5 j66ZnkANl9RDOIYX5vVhN0o4mK0gIjWuTg13FLK5/xrkWHrzdHVFHbtw1LPAMCxJMPd9+8JCx2j 0a5ZFwdR1YYaYl+4Do+t6VOMGoFNtKSyAtx9bUXRq+qJdh86OAZcipy+E/Oxr8wO6sXdIsc/Fp2 w6VZgnU2r1wkf0WyldKjNCLYgboBzrQwS0mqFMHWg5rjG80EDYvmcQz3XxfvXIfzIQITpsOTrI5 YZ+UQQndS6OROrDOlo7Ok1ruvTVHzc6Bj3JkmGXJIuFai7z7H0MDweMext6+haBfahnTZJIPxyj 0/kdsIfsNhOFfPPeq32CbBrmhKjmSyP3xyxh9FymaZRKOM/nT71ABHjRXhKFjixk8xyycluPtsM kdC3wJbcunr+KDfvg== X-Received: by 2002:a05:6000:71a:b0:487:40d:af29 with SMTP id ffacd0b85a97d-488716f76edmr444910f8f.36.1790196467054; Wed, 23 Sep 2026 13:47:47 -0700 (PDT) Received: from localhost (82-67-6-57.subs.proxad.net. [82.67.6.57]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48868889337sm9555748f8f.34.2026.09.23.13.47.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2026 13:47:46 -0700 (PDT) From: Jerome Brunet Date: Wed, 23 Sep 2026 22:47:33 +0200 Subject: [PATCH net-next v3 3/5] net: stmmac: sun55i: Make the delay step configurable Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20260923-allwinner-a733-gmac-support-v3-3-15735155a789@baylibre.com> References: <20260923-allwinner-a733-gmac-support-v3-0-15735155a789@baylibre.com> In-Reply-To: <20260923-allwinner-a733-gmac-support-v3-0-15735155a789@baylibre.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Richard Cochran , Maxime Ripard , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Maxime Chevallier Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Andre Przywara , Jerome Brunet X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3766; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=u9upVCC3m/gwC2XGPIk9ZtnVEycENGqh8TgoKKLgrfg=; b=owGbwMvMwCW2VtK+WnvWU3HG02pJDFlbrN5++fKN4ddvzswl7GeD9uxYOzue282oeJfBhyx2d Xbd7V47OkpZGMS4GGTFFFlquKvF30lqfZk1Xec2zBxWJpAhDFycAjCRaD1GhmnNNr1V5r77khQ4 HbX25/9bvu3Dzwuyn7OsgrnebXjtspyRYdbv72zn5HrC7edE8K44+fH1tYCm98+630TxzXNqrpr /ghEA X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [-2.16 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[172.105.105.114:from]; SUSPICIOUS_RECIPS(1.50)[]; MAILLIST(-0.15)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; PRECEDENCE_BULK(0.00)[]; TAGGED_RCPT(0.00)[netdev,dt]; DMARC_NA(0.00)[baylibre.com]; FROM_HAS_DN(0.00)[]; FORGED_SENDER_MAILLIST(0.00)[]; RCPT_COUNT_TWELVE(0.00)[25]; DBL_BLOCKED_OPENRESOLVER(0.00)[baylibre.com:email,tor.lore.kernel.org:rdns,tor.lore.kernel.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jbrunet@baylibre.com,linux-sunxi@lists.linux.dev]; R_SPF_ALLOW(0.00)[+ip4:172.105.105.114]; FREEMAIL_TO(0.00)[lunn.ch,davemloft.net,google.com,kernel.org,redhat.com,gmail.com,sholland.org,foss.st.com,pengutronix.de,bootlin.com]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[100.90.174.1:received,74.125.225.99:received,82.67.6.57:received]; RCVD_COUNT_FIVE(0.00)[6]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-26225-noreply=patchwork.local]; MID_RHS_MATCH_FROM(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[172.105.105.114:from] X-Rspamd-Queue-Id: 2B1151C2AD3 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= The driver assumes a 100ps step for both TX and RX clock delays, which does not match the A733 GMAC210. Move the TX and RX delay steps to the match data and factor the delay validation into a helper. The A523 keeps the 100ps step to preserve the DT ABI, although the vendor reports actual steps of 180ps for TX and 530ps for RX. Signed-off-by: Jerome Brunet --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c | 58 +++++++++++++++------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c index c4df53285007..e759311f40fc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c @@ -42,6 +42,8 @@ struct sun55i_gmac_data { int (*init_resources)(struct platform_device *pdev, struct sun55i_gmac *gmac); unsigned int flags; + u32 txdly_step_ps; + u32 rxdly_step_ps; u32 offset; }; @@ -62,38 +64,47 @@ static int sun55i_gmac200_init_resources(struct platform_device *pdev, return 0; } +static int sun55i_gmac200_validate_delay(struct device *dev, const char *dir, + u32 *val, u32 step, u32 max) +{ + if (*val % step) + return dev_err_probe(dev, -EINVAL, + "%s-delay must be a multiple of %ups\n", dir, step); + max *= step; + if (*val > max) + return dev_err_probe(dev, -EINVAL, + "%s clock delay exceeds maximum (%ups > %ups)\n", + dir, *val, max); + *val /= step; + dev_dbg(dev, "set %s-delay to %x\n", dir, *val); + + return 0; +} + static int sun55i_gmac200_setup(struct device *dev, struct plat_stmmacenet_data *plat, const struct sun55i_gmac *gmac) { struct device_node *node = dev->of_node; - u32 val, reg = 0; + u32 val, step, max, reg = 0; int ret; if (!of_property_read_u32(node, "tx-internal-delay-ps", &val)) { - if (val % 100) - return dev_err_probe(dev, -EINVAL, - "tx-delay must be a multiple of 100ps\n"); - val /= 100; - dev_dbg(dev, "set tx-delay to %x\n", val); - if (!FIELD_FIT(SYSCON_ETXDC_MASK, val)) - return dev_err_probe(dev, -EINVAL, - "TX clock delay exceeds maximum (%u00ps > %lu00ps)\n", - val, FIELD_MAX(SYSCON_ETXDC_MASK)); + step = gmac->data->txdly_step_ps; + max = FIELD_MAX(SYSCON_ETXDC_MASK); + ret = sun55i_gmac200_validate_delay(dev, "tx", &val, step, max); + if (ret) + return ret; reg |= FIELD_PREP(SYSCON_ETXDC_MASK, val); } if (!of_property_read_u32(node, "rx-internal-delay-ps", &val)) { - if (val % 100) - return dev_err_probe(dev, -EINVAL, - "rx-delay must be a multiple of 100ps\n"); - val /= 100; - dev_dbg(dev, "set rx-delay to %x\n", val); - if (!FIELD_FIT(SYSCON_ERXDC_MASK, val)) - return dev_err_probe(dev, -EINVAL, - "RX clock delay exceeds maximum (%u00ps > %lu00ps)\n", - val, FIELD_MAX(SYSCON_ERXDC_MASK)); + step = gmac->data->rxdly_step_ps; + max = FIELD_MAX(SYSCON_ERXDC_MASK); + ret = sun55i_gmac200_validate_delay(dev, "rx", &val, step, max); + if (ret) + return ret; reg |= FIELD_PREP(SYSCON_ERXDC_MASK, val); } @@ -175,6 +186,15 @@ static const struct sun55i_gmac_data sun55i_a523_gmac200_data = { .init_resources = sun55i_gmac200_init_resources, .flags = STMMAC_FLAG_SPH_DISABLE, .offset = 0x34, + /* + * The actual delay steps reported by the manufacturer are: + * - Tx: 180ps + * - Rx: 530ps + * + * Correcting them would break the DT ABI of the published DTs. + */ + .txdly_step_ps = 100, + .rxdly_step_ps = 100, }; static const struct of_device_id sun55i_gmac200_match[] = { From patchwork Wed Sep 23 20:47:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 3462 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id 2CC0C1C2AD3 for ; Wed, 23 Sep 2026 22:49:24 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=baylibre.com; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-26226-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-26226-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 5EAC033775 for ; Wed, 23 Sep 2026 20:48:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F5D457F74C; Wed, 23 Sep 2026 20:47:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="parpDmj1" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-wr2-f12.google.com (mail-wr2-f12.google.com [74.125.225.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D6D457EDA4 for ; Wed, 23 Sep 2026 20:47:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.76 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790196473; cv=none; b=Wy/UYbOQvM1nqpcJpMA8rXd0GAfFgwN+AUXh3uOWfJ2KcnGfLQik9UegYae68RSYNS/F3iRf4pCLGiOOk0Kz17RnohfmttnMScs6TX7H7l5iE9+RVlgfCD33acSdyo0TrMMuEeaXe/bGRcbRzAXBByp18PMagBneTmToyo0GKSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790196473; c=relaxed/simple; bh=B+n/07rbShxe+UCgpvoXo+3mb6MPP+M9H3khzu3hpGI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=krFnVtRTdNebmJPVH2xiew3E/8x4etG+0dnhAFyN3801376omBi73gWmrFJOOl52BL5GcGfAz936+t59CFUheZyilYzSVJcZRK0RbKs3CcVjtjH7Jy3LsjFrvEroFPx+9YGnXI9qZ4Hm0+zS7HaadcjBeleKadYS07o/9vIUYIs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=parpDmj1; arc=none smtp.client-ip=74.125.225.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-wr2-f12.google.com with SMTP id ffacd0b85a97d-482f6350f89so1001979f8f.3 for ; Wed, 23 Sep 2026 13:47:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790196468; x=1790801268; darn=lists.linux.dev; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Uae9hpUYrYglCWSSadpE9LyEi0ppwlaugCpZRYr3ziI=; b=parpDmj1mZUy0BxCelyl2EWrFLIPVyI1OMXqTQ/fPIpLb15ZXtaiGlSLZ/dgphK9IP /HSbYHKj8IjKmNrkpEXZ4D8GpHdr+Kul3xsy70wutEdgVhcvJOW0mhRo7Q9WTckScxz5 gLEXRdlF6KwVOnEi930Umcp3AeL/6f4NsUv5UGe78ay3f81c+g92T2T+ZQrX4ESJYYNI kTReEQ8ZVr2BhB3IFLssmimwN3UK3yx12WtCc38IEtApT/BNA76uArJTH4iCfH9FhpB5 x3/FZsQiKEP0ObJPq/btgCV/NPSonI8YzgpQKEiiuKN7rOv/H9bw5h/59Xyt5J5Y1BV/ qMrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790196468; x=1790801268; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Uae9hpUYrYglCWSSadpE9LyEi0ppwlaugCpZRYr3ziI=; b=NXOWT6Hfvn/6nFHdwynhRWORG0W3cOVYtzRpBuKUvlJ3Q4XYyc/3yx1FouqXQ2fEmf CwiBercIC/9ltLDHk4WNHMBxPR6ZiZGOzPlX/eHpQOB67TEK4Cy4dUOUnYWGBKLKDSFb 8Hay8/yIE3GUuXihwf9AaBkwejFC4GaLBZjKi3ZnYJMyd0FxW7/9+9CRbZlYbEgkWVJ9 22zJ0cEGdhAXOmpXXRMrfjqJhrFCCm8dffhx20xQ+Rjb5RPnH+dGBcF01xxC0pXDDxVX CKzIh3RzEcAIKOf8pdSHFX4DFdJ6hAaJDvvrKrb4m9hjItYskgPzO2y7Wtv6KgGW2MBV gnIg== X-Forwarded-Encrypted: i=1; AKwUvByG91nAtyebytNPgap8a+yVYlabfgIXuN886yBqVSFAyvpAgSBPUb7Z68SS2XUaOeUYTii+uMdcCL/x/Q==@lists.linux.dev X-Gm-Message-State: AFuF++lK7tlTRCHmQj60/Mb6S7xu6Cnh1XB/lV7aKwDS/R/STb6bbdB7 Q51uMIYlxdbe4IXAxMGem8kRxyodwHI9atrZnNeyUa77zSc9/+kQlZABoPGIXp87xnI= X-Gm-Gg: AYBFou2PvK02TXS5Iu86cB1pr3LOj1modBoCnd25bqJ17PA2VLcAuORppVxJeVp0hQu Z5hWsjp51QgGTs18wBPJIIEeO+u0ChIzqoc9mjj24f4eWryofkpd74T91bE8CiE/nmaMov7R0oe EfKDf/HqlL8EVlDM+vYsc18/QPdxUTdAY9IFPzRoq3nrOYxZIiVCCW3OMgbUGQwbrwvEHCIemk/ XfWDuBFZnyv+aYyOthnsWeatHPgBL7XT5lOCAEjXz13HXAxX9W1f5woDxUSh2ipgeO2O/V244K1 u9RnRHFhiX9zPwQf8PPqNojZSjDjr1DswRbFcsCASpFxyHNL4Wzgy5L3of5pffBg9WiDUax4Pn1 RgT7kF/wcMnAFiErHrcfavYCtCHu5OeYdff1syIxWnUSYFVXWdZ9Glv/ecju9tjrntIyqeQ3Y0s sUzjnBoqqsE4g6Ox1dPIEPweDCYDwrkNK8+BLiRNrS2mwzXzeie2idie54VyfT6Kkm7mf/VbDZw rWyrKbzSbhLC3Q6iyUZkfCtXLsB X-Received: by 2002:a05:6000:617:b0:486:f46d:bb02 with SMTP id ffacd0b85a97d-4887197b60emr438659f8f.57.1790196468392; Wed, 23 Sep 2026 13:47:48 -0700 (PDT) Received: from localhost (82-67-6-57.subs.proxad.net. [82.67.6.57]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-488688893a0sm9653251f8f.32.2026.09.23.13.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2026 13:47:47 -0700 (PDT) From: Jerome Brunet Date: Wed, 23 Sep 2026 22:47:34 +0200 Subject: [PATCH net-next v3 4/5] net: stmmac: sun55i: Support TX delay extension bits Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20260923-allwinner-a733-gmac-support-v3-4-15735155a789@baylibre.com> References: <20260923-allwinner-a733-gmac-support-v3-0-15735155a789@baylibre.com> In-Reply-To: <20260923-allwinner-a733-gmac-support-v3-0-15735155a789@baylibre.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Richard Cochran , Maxime Ripard , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Maxime Chevallier Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Andre Przywara , Jerome Brunet X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1789; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=B+n/07rbShxe+UCgpvoXo+3mb6MPP+M9H3khzu3hpGI=; b=owGbwMvMwCW2VtK+WnvWU3HG02pJDFlbrN6aX1BpNohN+nGv6lzKq6dxK0vWL1vyT8Xpckfx5 h8t31Imd5SyMIhxMciKKbLUcFeLv5PU+jJrus5tmDmsTCBDGLg4BWAiUxYzMizurl7xTPXxju68 fVyKXxfOCvqpquYo5qGe6ZfZve+E8X6Gf6r7XI+uWFA929e1/vyEne/vXV83L8NuGev7YM8Wfde 5XSwA X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [3.34 / 15.00]; RBL_SENDERSCORE(2.00)[172.105.105.114:from]; SUSPICIOUS_RECIPS(1.50)[]; MAILLIST(-0.15)[generic]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; PRECEDENCE_BULK(0.00)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; TAGGED_RCPT(0.00)[netdev,dt]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWELVE(0.00)[25]; DMARC_NA(0.00)[baylibre.com]; FORGED_SENDER_MAILLIST(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[tor.lore.kernel.org:rdns,tor.lore.kernel.org:helo,baylibre.com:email]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG]; R_SPF_ALLOW(0.00)[+ip4:172.105.105.114]; FREEMAIL_TO(0.00)[lunn.ch,davemloft.net,google.com,kernel.org,redhat.com,gmail.com,sholland.org,foss.st.com,pengutronix.de,bootlin.com]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[82.67.6.57:received,74.125.225.76:received,100.90.174.1:received]; FROM_NEQ_ENVFROM(0.00)[jbrunet@baylibre.com,linux-sunxi@lists.linux.dev]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-26226-noreply=patchwork.local]; MID_RHS_MATCH_FROM(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[172.105.105.114:from] X-Rspamd-Queue-Id: 2CC0C1C2AD3 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= On the A733 GMAC210, the TX clock delay is 5 bits wide: the 3 low bits are in the ETXDC field and the 2 high bits in a separate field. Add an optional mask for the high bits to the match data and set it when necessary. Signed-off-by: Jerome Brunet --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c index e759311f40fc..49abbb248b61 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c @@ -42,6 +42,7 @@ struct sun55i_gmac_data { int (*init_resources)(struct platform_device *pdev, struct sun55i_gmac *gmac); unsigned int flags; + u32 etxdc_ext_mask; u32 txdly_step_ps; u32 rxdly_step_ps; u32 offset; @@ -86,17 +87,21 @@ static int sun55i_gmac200_setup(struct device *dev, const struct sun55i_gmac *gmac) { struct device_node *node = dev->of_node; - u32 val, step, max, reg = 0; + u32 val, step, max, low_bits, reg = 0; int ret; if (!of_property_read_u32(node, "tx-internal-delay-ps", &val)) { + low_bits = hweight32(SYSCON_ETXDC_MASK); step = gmac->data->txdly_step_ps; - max = FIELD_MAX(SYSCON_ETXDC_MASK); + max = (1U << (low_bits + hweight32(gmac->data->etxdc_ext_mask))) - 1; ret = sun55i_gmac200_validate_delay(dev, "tx", &val, step, max); if (ret) return ret; reg |= FIELD_PREP(SYSCON_ETXDC_MASK, val); + if (gmac->data->etxdc_ext_mask) + reg |= field_prep(gmac->data->etxdc_ext_mask, + val >> low_bits); } if (!of_property_read_u32(node, "rx-internal-delay-ps", &val)) { From patchwork Wed Sep 23 20:47:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 3459 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mxe881.netcup.net (Postfix) with ESMTPS id 2A9231C2AD5 for ; Wed, 23 Sep 2026 22:48:33 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=baylibre.com; spf=pass (sender IP is 172.232.135.74) smtp.mailfrom=linux-sunxi+bounces-26227-noreply=patchwork.local@lists.linux.dev smtp.helo=sto.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.232.135.74 as permitted sender) client-ip=172.232.135.74; envelope-from=linux-sunxi+bounces-26227-noreply=patchwork.local@lists.linux.dev; helo=sto.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sto.lore.kernel.org (Postfix) with ESMTP id 9CD1E60B911 for ; Wed, 23 Sep 2026 20:48:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9CDF57ED9B; Wed, 23 Sep 2026 20:47:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="FFHDzAUQ" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-wm2-f13.google.com (mail-wm2-f13.google.com [74.125.225.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 613C657EDBC for ; Wed, 23 Sep 2026 20:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790196475; cv=none; b=oiQ0oFyPeZOxSQEhaSmw2HtV4S0XB8M4H4/PTPRPKpNzqXU5W2O17nZxw5UhgasZczT7aCu6mCfQLIIs5JcntAzQvqggDLprdZW5Zv6oPdaS7leLmRb5a9QCympiqbom92rTqc8wlqrRdD8wWBnRZUZG7k+9cm5gKJLyyJ0CnP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790196475; c=relaxed/simple; bh=sjLoecwDQJXaWVmzvGOQ+F7IRuyAd48CcawjSycmYoQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E+ke4rH8pJTEZBvheEEhf0pTwBeBA6/bMVZU1M5dfajYRi+LwjLrrn8Oa6ZUQb8DSWZni2oCqR6JLmU//A2ns/NOJNhZ09F3Ttruc4cFXNTj9LJglp47bkxEhwqFTyM+GspLY4Vm0LLp5rVD7KtB5JdgKf47JHf/nFJu/WixeGE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=FFHDzAUQ; arc=none smtp.client-ip=74.125.225.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-wm2-f13.google.com with SMTP id 5b1f17b1804b1-49e7bcb94d3so9521495e9.2 for ; Wed, 23 Sep 2026 13:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790196469; x=1790801269; darn=lists.linux.dev; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=kHpHp+F5tI4LZnE8xFoLfG2BiWUFVvoyvHapbJH+e74=; b=FFHDzAUQ3lhpDSbCQmGBWvZjZOxndyfEkd/a9e8+YQ05lur0Z8bpuik3gVPzzXSUbH VnsAgO+2THi9REJQYvh10Kfdc6cQh5O0TO+XifJ/oQKRi2BDZPbtFvueM3X/JEHFXpwq 04Vj7E2oaErZby/X/w+PXv2Upkl/qgNNEIGEApajYTipbJewBBTvxxyMCVgJ9i68LAjw p1Vt4J4nqK+O9AbJFH/BWmWUVph+ARFcuevmBIGFv6Eh1ojdI9nSFOuSfs5shupC+JrB Gjq16QmLLiXOxxOxRwttKcMDY/PgZSFsh8I019b8+jqYabrtpFi7TwxKjnt4LlnOfloW AVvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790196469; x=1790801269; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=kHpHp+F5tI4LZnE8xFoLfG2BiWUFVvoyvHapbJH+e74=; b=M2F81Ae7mGRQWleN2OxBItsFC3bWrgVnw2aZCPDKYpzxRMV14YbRDrDgq8bhg4PVUF UCOPRA1XJ/y6CD5G6LvBeTqrNlR9X6+vY0UCArWy/ODZKzUv33OLMP2MH7rHyY7/JtRA 3k9iRuaD8uMNPkbAa/8PrPBOBF+iA3AF+KtETrp1JOhXFuGPYe7iicTzWF6+M0fdQOFR jHyajDqKwFaN2fduBwsft7YDEwnl0MloN/x/HBVwfT48veTXCUMdC28EVism1PbMJSyj bsnHqoUWxYS8UIkX5KTRExND1myPfhZw9cIim7snKGT8q9/L2se0BrlQYoolJsqk/h49 yOIw== X-Forwarded-Encrypted: i=1; AKwUvBzFXn3bUWXBztsUaz8aEXdT/S7oS49P/CyQJg1SLAh8kL3JXom2/BO15yR6BSWKMSmhCfiZTdZr8oAjdA==@lists.linux.dev X-Gm-Message-State: AFuF++miLGiw+4jZu8JFRTuc+uHb+ASI1sAxCaa47Jq9i/OTSZqF4WDO kbViQ8jJFuZIWFnyj2Uo12CYZpPCwnZX+epH1aUFFu1TezS59YLQ2nVNIlC/KZgvLcs= X-Gm-Gg: AYBFou34PwYU2IEFfZZy5/HQ1KN3yBZ2ztpvO+8cUHsreKEMeUoJfnh+NTmKocrhynf Gf7jEoT+CELddZ4X5V1ERHdH5Zlj+Xo2IshkvlqBDeVv3/NzAxMa4/2TfcTjAxBt4djsdhEScrp 7cjgmXWW5TD5RD2VVn3xMrSd36m9fSWRWbPr2YHfQM/mH5H+8D/1rdPQ9HOfB45oY9gAbcnhb9j vkqnpA2AHx0wgkOWAP4CdCXHMF4mu0YMWFluAPCcVs8jTfuE26tbybHiARxrF13hE6Q1qJY9HsX Fq2oiuoqrpr2v1Na9ZWXBcJzmjP05OqLpIuN29Hlbx4//F5rv4s4N40bNPU9LIvJFx4AiTWqb6k yiHMlhMFSVo6aybYrLSBote0tXnnvX9CN7IXwAhkoCjl2kySAMuD5uED+Muw7pCVLSeVQkeQhSp ixa/EAixnePIao2DqCpvGFwfh3rI8ROoVsvj05g+u+Brz86YkQOV8eQXpX30fTn28jTVInOFzV8 uWsujgAZu7Aijhe7Q== X-Received: by 2002:a05:600c:1989:b0:49d:16df:8521 with SMTP id 5b1f17b1804b1-49fe66ab9d1mr6607445e9.4.1790196469631; Wed, 23 Sep 2026 13:47:49 -0700 (PDT) Received: from localhost (82-67-6-57.subs.proxad.net. [82.67.6.57]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fe5b44db6sm14839105e9.0.2026.09.23.13.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2026 13:47:49 -0700 (PDT) From: Jerome Brunet Date: Wed, 23 Sep 2026 22:47:35 +0200 Subject: [PATCH net-next v3 5/5] net: stmmac: sun55i: Add support for Allwinner A733 GMAC210 Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20260923-allwinner-a733-gmac-support-v3-5-15735155a789@baylibre.com> References: <20260923-allwinner-a733-gmac-support-v3-0-15735155a789@baylibre.com> In-Reply-To: <20260923-allwinner-a733-gmac-support-v3-0-15735155a789@baylibre.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Richard Cochran , Maxime Ripard , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Maxime Chevallier Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Andre Przywara , Jerome Brunet X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4132; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=sjLoecwDQJXaWVmzvGOQ+F7IRuyAd48CcawjSycmYoQ=; b=owGbwMvMwCW2VtK+WnvWU3HG02pJDFlbrN669B39qPeAbW7OgdsplxQT71j87Zx16uqMiimtn Lp1lh6lHaUsDGJcDLJiiiw13NXi7yS1vsyarnMbZg4rE8gQBi5OAZiIihkjwyb31d8uyoQbH75s 9sfsjf4n69Uei5jkzL5psmk98r3+tIrhv7f6q8R7G+4cYbbpqebm5Ntqsd2bf3uH2dmQ2SHdm9s c+AA= X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= The A733 GMAC210 is a DesignWare MAC 5.20 using an Allwinner glue close to the A523 GMAC200 already supported by this driver, with the following differences to handle: * The glue configuration registers are a dedicated MMIO region of the controller instead of a syscon register. This region is in the AHB reset domain, so the glue driver releases the shared AHB reset before writing the configuration. * The TX clock delay value is 5 bits wide, split over 2 register fields. Both TX and RX delays use a 180ps step. * The DMA channels have their own interrupt lines, so the per-DMA-channel interrupt mode is enabled, as the vendor SDK does. * TX LPI clock gating is supported, as the vendor SDK indicates. Follow the PHY capability with STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP rather than forcing it on with the deprecated 'snps,en-tx-lpi-clockgating' DT property. Signed-off-by: Jerome Brunet --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c | 53 +++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c index 49abbb248b61..675b83cd52c8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "stmmac.h" @@ -65,6 +66,41 @@ static int sun55i_gmac200_init_resources(struct platform_device *pdev, return 0; } +static const struct regmap_config sun60i_a733_regmap_cfg = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + +static int sun60i_gmac210_init_resources(struct platform_device *pdev, + struct sun55i_gmac *gmac) +{ + struct device *dev = &pdev->dev; + struct reset_control *ahb_reset; + void __iomem *base; + + /* + * Get the configuration region out of reset before changing it. + * stmmac core holds the same shared reset but only deasserts it later. + */ + ahb_reset = devm_reset_control_get_shared_deasserted(dev, "ahb"); + if (IS_ERR(ahb_reset)) + return dev_err_probe(dev, PTR_ERR(ahb_reset), + "Failed to get ahb reset\n"); + + base = devm_platform_ioremap_resource(pdev, 1); + if (IS_ERR(base)) + return dev_err_probe(dev, PTR_ERR(base), + "Unable to get config memory region\n"); + + gmac->regmap = devm_regmap_init_mmio(dev, base, &sun60i_a733_regmap_cfg); + if (IS_ERR(gmac->regmap)) + return dev_err_probe(dev, PTR_ERR(gmac->regmap), + "Unable to get regmap for config memory region\n"); + + return 0; +} + static int sun55i_gmac200_validate_delay(struct device *dev, const char *dir, u32 *val, u32 step, u32 max) { @@ -132,9 +168,11 @@ static int sun55i_gmac200_setup(struct device *dev, phy_modes(plat->phy_interface)); } + /* The dwmac will sample this when stmmaceth reset is deasserted */ ret = regmap_write(gmac->regmap, gmac->data->offset, reg); if (ret < 0) - return dev_err_probe(dev, ret, "Failed to write to syscon\n"); + return dev_err_probe(dev, ret, + "Failed to write glue configuration\n"); return 0; } @@ -202,9 +240,22 @@ static const struct sun55i_gmac_data sun55i_a523_gmac200_data = { .rxdly_step_ps = 100, }; +static const struct sun55i_gmac_data sun60i_a733_gmac210_data = { + .init_resources = sun60i_gmac210_init_resources, + .flags = (STMMAC_FLAG_SPH_DISABLE | + STMMAC_FLAG_MULTI_MSI_EN | + STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP), + .offset = 0x0, + .etxdc_ext_mask = GENMASK(17, 16), + .txdly_step_ps = 180, + .rxdly_step_ps = 180, +}; + static const struct of_device_id sun55i_gmac200_match[] = { { .compatible = "allwinner,sun55i-a523-gmac200", .data = &sun55i_a523_gmac200_data }, + { .compatible = "allwinner,sun60i-a733-gmac210", + .data = &sun60i_a733_gmac210_data }, { } }; MODULE_DEVICE_TABLE(of, sun55i_gmac200_match);