From patchwork Fri Oct 25 01:09:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13849901 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BED77D10399 for ; Fri, 25 Oct 2024 01:18:54 +0000 (UTC) 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:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zgTXpRaa0CS94DWebND0XpyXT65bwzGX/MVLfeTayUc=; b=ay3i4o4rGm3z0VFmxzXvi8r6R4 gpFjINGEjR/KvQNiRAvK3/JNAh1OESN5DUYc00TiU8G0cEBT+twINaldf43g+y5z9KQA5i213ZaHd W9rCU2IJyqaai8Ld6GUyrJNlhvxIkrBBZf6pO4sp5X4WwAPgFcSyNAz2w/H64CthgDm8ZqPtIsqR2 SjCv9OVqckmTjd7a6iZhfbWN3Ft3F0GpQxog2Kfll5qcqg+i9AsCYFHVhYNnLxOd4hvWiMcJc8xRG dAJGRWLIIu3CVHUojYeVonyd/Qk5T+eS93GruU8kXR8PxWli6wu8b9W2keiTY878IMEzA/LqkFkN+ pRNrPtvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t48yQ-000000029ka-1x02; Fri, 25 Oct 2024 01:18:42 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t48qS-000000028RN-3Aij; Fri, 25 Oct 2024 01:10:29 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-20ca388d242so12617555ad.2; Thu, 24 Oct 2024 18:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729818627; x=1730423427; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zgTXpRaa0CS94DWebND0XpyXT65bwzGX/MVLfeTayUc=; b=eq+KVNYZfaiNcskG6+ooQvkQN6xrE6laAz+FaUNCEzIKLSPfFR4QcyUv5waYwPRAwJ xKR2cOf8uDCQhKmvzycazrck08Qr2d6lHcbhVZUUjH9SvX0wID1pBOyvk7wsiHUW6v/F fv8RGOJr+bAoV5hSr1OVPWlWQ/+5Fc/0tbVMTpXuNOmVjdheqVpi2eWWwJuPFpDYHJRR Rx9Y8mQ70GbK7d1UyPWB6yDYqFgb6aKEqRxLZuFkDvIsmptD9nqjfvDxgL9AZeNviH/q /uNuZl7+lWXjUK4q4v1pAh4+XwSP/x9Yb9ecIlda7bwFf5lefd6/JlKWQ/ZnDoREDsJ1 3Yrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729818627; x=1730423427; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zgTXpRaa0CS94DWebND0XpyXT65bwzGX/MVLfeTayUc=; b=Gs6XRYoX92/NqPzqZhF4F090U0zGT7nmo2uL0qNgaSMfUSjy9fO7V8iCd+BKxt0SCe MHeGI2qgJOxzP+EERkyP0nP0+US5gpgBgbPF7MyMnFLjKeHUBcx28XWphv3fYjXYQy3O ENlDb3KG0T56DDzCaZisFqan+bek0kkTc32fG8FPgseyad762VqIZvryar3RQbiQZ80M rV9979aThLWQR+MiKAoVsXuTDfkDX9Tr2Od27WDXtUx/lt/3gDtDIfK7d17/Njk8uR39 2d9vv4R35CR5N3NFKQ4uEO/zlFg2qE7XHtqhN3NP0xqwTvrHbToTQFEsxlXn44ATSGa0 D0Dw== X-Forwarded-Encrypted: i=1; AJvYcCWxi0BFqCo3rMhhB3R+PBsioDq0rHgrH48GxmBCPhvq7Mz+nFT6bWIXtVjjl4fEWaUEnAGDgCZv35mFlUVJUeVB@lists.infradead.org, AJvYcCXJzI0J+nqCxSNL3Knz0leVmiYNMY3a0ikxgoKhTOapYR2278tJTCKsEBg0xZvKh8rmjOAqXzgfZ/TUZUc=@lists.infradead.org X-Gm-Message-State: AOJu0YwcKluFBuphC2xJ75AflD8zSqoNXjNmQpFMqpP1BT9MqIMIsFc6 JTaiq3qwR/mYuQuStxpN7hqVTigCpmLBAo8aIbyeDLotvggT8vrc X-Google-Smtp-Source: AGHT+IFuYgb27DRjo53S1PNy4oCfKnzd8OhJaIYDcpXqGHoe0olM8cbsYPvMtmxuGJEtJGwjOabQfw== X-Received: by 2002:a17:903:22c9:b0:20c:b090:c87 with SMTP id d9443c01a7336-20fa9e5e485mr115146405ad.29.1729818627304; Thu, 24 Oct 2024 18:10:27 -0700 (PDT) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-210bc08676csm557015ad.304.2024.10.24.18.10.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 18:10:26 -0700 (PDT) From: Inochi Amaoto To: Chen Wang , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Inochi Amaoto , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Richard Cochran , Paul Walmsley , Palmer Dabbelt , Albert Ou , Giuseppe Cavallaro Cc: Yixun Lan , Longbin Li , Inochi Amaoto , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org Subject: [PATCH v2 1/4] dt-bindings: net: snps,dwmac: Add dwmac-5.30a version Date: Fri, 25 Oct 2024 09:09:57 +0800 Message-ID: <20241025011000.244350-2-inochiama@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241025011000.244350-1-inochiama@gmail.com> References: <20241025011000.244350-1-inochiama@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241024_181028_817149_8F76DE8C X-CRM114-Status: UNSURE ( 8.33 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add compatible string for dwmac-5.30a IP. Signed-off-by: Inochi Amaoto --- Documentation/devicetree/bindings/net/snps,dwmac.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index 4e2ba1bf788c..3c4007cb65f8 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -31,6 +31,7 @@ select: - snps,dwmac-4.20a - snps,dwmac-5.10a - snps,dwmac-5.20 + - snps,dwmac-5.30a - snps,dwxgmac - snps,dwxgmac-2.10 @@ -95,6 +96,7 @@ properties: - snps,dwmac-4.20a - snps,dwmac-5.10a - snps,dwmac-5.20 + - snps,dwmac-5.30a - snps,dwxgmac - snps,dwxgmac-2.10 - starfive,jh7100-dwmac @@ -627,6 +629,7 @@ allOf: - snps,dwmac-4.20a - snps,dwmac-5.10a - snps,dwmac-5.20 + - snps,dwmac-5.30a - snps,dwxgmac - snps,dwxgmac-2.10 - st,spear600-gmac From patchwork Fri Oct 25 01:09:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13849902 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA6B2D10399 for ; Fri, 25 Oct 2024 01:20:26 +0000 (UTC) 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:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HjsxbPPZPhrPsk8Kv9v/JHWFfPAbNR5NFf7Fw2jHbOc=; b=ZZ9TU/sanszS3V/FWGAD7hiZAo QgEcckoLGambvQ4TfM52wlOd//GjxGJCpmxS8gydRkFwAaholwHQ+vDWw5PgYhszQ/90yPPAAUaCn np3LQv0nT8tFjHbB3koTwyQKlIxRypHDU1GVxMb2pjk+7v0DvlYclpn2E+TJPSq5nKa9GqM7wXd/t k9Ryb/W1HfDu8diAMrs6l6FInkg7TNeflUrAW97u/R85uhV3HvXDT1/F+qt8OkIGc8f4UJdgB4OXt Z0845vw3+DC4o36AM8Mr9DBZtjcKaF5ZpJEUBcnlGhF3cFOMLNSoSYx63lLZHBVbOrnHJsVbN+xQf 7N2VdFvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t48zx-000000029yl-0gnV; Fri, 25 Oct 2024 01:20:17 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t48qU-000000028Rk-4B9z; Fri, 25 Oct 2024 01:10:32 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-20caccadbeeso14740715ad.2; Thu, 24 Oct 2024 18:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729818629; x=1730423429; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HjsxbPPZPhrPsk8Kv9v/JHWFfPAbNR5NFf7Fw2jHbOc=; b=lfevJB3S2bKcDDmVqI/ShoUWpLZj/4rhDndfyby08ZbNg7BVrSryEGW3Zrs6yhoJGy K//cikpEOf6o++xEApXERNvso/KZvZQhvyjJ1T08FKG+NLxJ6MOuRVwTRwzQw76sJm/N suu9mmo4sltm23lfmmDhXdIrAV/58EzCFp7AnYSFR5u7rO+8uDaKOlTMz7JmTDk2WIdN oYO/9Epi43JZ0RkfjqHh4+QOWFSkqT3EBGgJn9K6mo7+VwvXN/QXPva1MDsoEh84QIL3 Jp3tanmG0ZSq2qQg8Dmb99YXrFGhU2Cf2vm/vF3dJjDhkrIVO2bMefYxeZazE3j7EB9i I3kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729818629; x=1730423429; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HjsxbPPZPhrPsk8Kv9v/JHWFfPAbNR5NFf7Fw2jHbOc=; b=lhjvR+yRd171UJiCFPImpxP588oAXu6QwDvcc6IID71qr96dXEXnZ/lp12wOZnFkl1 BYss3fxFmQsifkFcmCS5r/SI5dt41pZfIQC3YSRn7ru+q4GAdlgpK1aiOG4kslacWDs8 88G/1rxYlJCASpwwxlQD0uKtoKQlRjXz1aKg6SY+OIDmpjfi34Bgkjwbq0h95BPT7NoX TPVyEMbFc1u+RBRheY+GUsGnjjAQPCXca97l/eO+C5EuxRw0mCA47PV4LBJPIrmgUAyL Bx5ZPXU75zqBlyXAl1PGxmW1606g7iHbx39WLkz4crrbjcKDzr64wZtvgITrikjC86Jq W4Ig== X-Forwarded-Encrypted: i=1; AJvYcCUu1K5wZerC/+JKdbl6RkRBMVx8YF4ZYLPy0XQR99TNsFQ4n8Gd6ztIFYpOnEC3P9HlaslbFP4fb1DLBRw=@lists.infradead.org, AJvYcCWIMIg0syLTZfn295V3UQiWyQBpVQ/AfseAXJi5bHMtcKAXXmSX42E9V5/Ha06QTrcXPpZYw+j7m/5pb3s11MlL@lists.infradead.org X-Gm-Message-State: AOJu0YzFUE7lOO0KHaYjNoFDXC481nsutSOpUn/qP/ge7aA6yCAD0jHa /vYKeJXo2wFPAAm7BwYqolInUHIq6Py5DzThedEgqKtMD5t4a57S X-Google-Smtp-Source: AGHT+IEHoc6nWkrNG5/p9qR6jUUXfLELQg+uXNgVWwe925mwCigDiK3oPKX/W5C+XTBSotaJSY3yxw== X-Received: by 2002:a17:902:cec6:b0:20c:b483:cce2 with SMTP id d9443c01a7336-20fab2e0fe7mr75143555ad.60.1729818629525; Thu, 24 Oct 2024 18:10:29 -0700 (PDT) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-210bc02f6f1sm577455ad.226.2024.10.24.18.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 18:10:29 -0700 (PDT) From: Inochi Amaoto To: Chen Wang , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Inochi Amaoto , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Richard Cochran , Paul Walmsley , Palmer Dabbelt , Albert Ou , Giuseppe Cavallaro Cc: Yixun Lan , Longbin Li , Inochi Amaoto , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org Subject: [PATCH v2 2/4] dt-bindings: net: Add support for Sophgo SG2044 dwmac Date: Fri, 25 Oct 2024 09:09:58 +0800 Message-ID: <20241025011000.244350-3-inochiama@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241025011000.244350-1-inochiama@gmail.com> References: <20241025011000.244350-1-inochiama@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241024_181031_059165_57C58F87 X-CRM114-Status: GOOD ( 14.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The GMAC IP on SG2044 is almost a standard Synopsys DesignWare MAC with some extra clock. Add necessary compatible string for this device. Signed-off-by: Inochi Amaoto --- .../devicetree/bindings/net/snps,dwmac.yaml | 1 + .../bindings/net/sophgo,sg2044-dwmac.yaml | 124 ++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/sophgo,sg2044-dwmac.yaml diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index 3c4007cb65f8..69f6bb36970b 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -99,6 +99,7 @@ properties: - snps,dwmac-5.30a - snps,dwxgmac - snps,dwxgmac-2.10 + - sophgo,sg2044-dwmac - starfive,jh7100-dwmac - starfive,jh7110-dwmac diff --git a/Documentation/devicetree/bindings/net/sophgo,sg2044-dwmac.yaml b/Documentation/devicetree/bindings/net/sophgo,sg2044-dwmac.yaml new file mode 100644 index 000000000000..b7e4216ea45a --- /dev/null +++ b/Documentation/devicetree/bindings/net/sophgo,sg2044-dwmac.yaml @@ -0,0 +1,124 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/sophgo,sg2044-dwmac.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sophgo SG2044 DWMAC glue layer + +maintainers: + - Inochi Amaoto + +select: + properties: + compatible: + contains: + enum: + - sophgo,sg2044-dwmac + required: + - compatible + +properties: + compatible: + items: + - const: sophgo,sg2044-dwmac + - const: snps,dwmac-5.30a + + reg: + maxItems: 1 + + clocks: + items: + - description: GMAC main clock + - description: PTP clock + - description: TX clock + + clock-names: + items: + - const: stmmaceth + - const: ptp_ref + - const: tx + + interrupts: + maxItems: 1 + + interrupt-names: + maxItems: 1 + + resets: + maxItems: 1 + + reset-names: + const: stmmaceth + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + - interrupt-names + - resets + - reset-names + +allOf: + - $ref: snps,dwmac.yaml# + +unevaluatedProperties: false + +examples: + - | + #include + + ethernet@30006000 { + compatible = "sophgo,sg2044-dwmac", "snps,dwmac-5.30a"; + reg = <0x30006000 0x4000>; + clocks = <&clk 151>, <&clk 152>, <&clk 154>; + clock-names = "stmmaceth", "ptp_ref", "tx"; + interrupt-parent = <&intc>; + interrupts = <296 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq"; + resets = <&rst 30>; + reset-names = "stmmaceth"; + snps,multicast-filter-bins = <0>; + snps,perfect-filter-entries = <1>; + snps,aal; + snps,tso; + snps,txpbl = <32>; + snps,rxpbl = <32>; + snps,mtl-rx-config = <&gmac0_mtl_rx_setup>; + snps,mtl-tx-config = <&gmac0_mtl_tx_setup>; + snps,axi-config = <&gmac0_stmmac_axi_setup>; + status = "disabled"; + + gmac0_mtl_rx_setup: rx-queues-config { + snps,rx-queues-to-use = <8>; + snps,rx-sched-wsp; + queue0 {}; + queue1 {}; + queue2 {}; + queue3 {}; + queue4 {}; + queue5 {}; + queue6 {}; + queue7 {}; + }; + + gmac0_mtl_tx_setup: tx-queues-config { + snps,tx-queues-to-use = <8>; + queue0 {}; + queue1 {}; + queue2 {}; + queue3 {}; + queue4 {}; + queue5 {}; + queue6 {}; + queue7 {}; + }; + + gmac0_stmmac_axi_setup: stmmac-axi-config { + snps,blen = <16 8 4 0 0 0 0>; + snps,wr_osr_lmt = <1>; + snps,rd_osr_lmt = <2>; + }; + }; From patchwork Fri Oct 25 01:09:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13849903 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 273A3D10399 for ; Fri, 25 Oct 2024 01:22:05 +0000 (UTC) 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:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ObJWQqbamWQLgW3lRvM1Wb6QskCzdsvaBlS+OW3U2H4=; b=OBOm6kpfrlauE7+wx8uUhADLNv a6CBtnl6ujC+RjS/MRW8viJ1dW7XsSCLGCrbnQ7TE2uKMZaCmHFQHhFO8vDSEaqwA5TG6swDotVFM wpWqrcvIMLJY1tHeIOLFCiXtGTCKIhr1vnfqR90CG6oF1GTqRJSjMYAQ0CWSOy2iySuxeWU2u4H4s ZmoAVfoww0fKSv8ulI65jVNkEgpATcTFdS4Twst6vn6VKeeGjLnU3Mjhb7+qII9tVpayvdLxPtibQ 5P4nyk67LQYmMu7tZoqk7FzK7d2t7nvRey5PvKHCOtmC2psbicQaQuHk36PYnurfiPj9nSRJMJgUn N64MPsvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t491V-00000002ALS-0YxE; Fri, 25 Oct 2024 01:21:53 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t48qX-000000028S5-0fyu; Fri, 25 Oct 2024 01:10:34 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-20c7ee8fe6bso12340835ad.2; Thu, 24 Oct 2024 18:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729818632; x=1730423432; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ObJWQqbamWQLgW3lRvM1Wb6QskCzdsvaBlS+OW3U2H4=; b=g4IDjOvmyYecjWh0OCxpnnpuHQWOHWut+ZuPzEvg3x3uujf9cZrtRJvVNNxi0ew4GQ +jNhvcVSHu697uy5+XJgLN94h3Aco+6iRl5+9NkLY92C60FyIF7vZxcdhIr6Jw83yqud vFnnoYFdspUOC8JZzqUKk0UYxgbqqHeuofe4yjLLEnP5LL10R0raizRpQL3KycZdOlvW W1uNfTDXilSdJ8nLtYt07arNbC24nR0i+hENorwHsMBJaC05UkIaoU6dpYWj47JlkDfE QK2AwUQ3DxY5MqiYCf7G8L3zlTfx/NF0teur+IGjdrrkDF44Ff8Yfdliwuz6VfRvLFHE a/SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729818632; x=1730423432; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ObJWQqbamWQLgW3lRvM1Wb6QskCzdsvaBlS+OW3U2H4=; b=KKGiowaw1eHcDYj0r3GtJdPxbuTfc2Pxxyz2epdou3eFc7/C5+bKuq+TwV3Zo+dRAY Cmnnuh01AG4mzKV574kcl4Wtp6QvELVDRpQRmjTC8PY6JaAbOSAuVm+ltBCrj650Nxvr yaOTfEq0MquN/2uRyI2OWGRKoHiuf075AD6fGb02odSAVxebwX5GOPzr8PYQBUHCv9iG brlf8So1AL0pUpNe6ruRqjzN773vJS3SNhFR4N7Au9hfDu3H+nfvUk6PeRJ5Mw8SFnnT c52R1VyH+wxVz1ZUo4cAEF9ECgF9FTMUtbx4ajIatVY9rcDaUo62jkQBzw7NTQrkKQIe myBg== X-Forwarded-Encrypted: i=1; AJvYcCVTG2meIwhMWWHb2btb/1hZPxwb9zZLtQnD9gUjRUQqQbd1/AdGYvg3+0hQYirxdTC8HWLskGx4/4vUR0EwUnoT@lists.infradead.org, AJvYcCXlk7vblWDZKrFG8b5IWXQXj5EqxDcqmUYMtk22CSVZmbkWqtpOzGJGQAzPm8VQqJ5sr2gTmnxvfiPOt78=@lists.infradead.org X-Gm-Message-State: AOJu0Ywq8gHFFJ7mr+aP6x/js4GRfUrvnGREWbYmsitdOPdaSMDp90rx XrbRhSuZUTZ7glJmRDzTiH/Z+BhAE6yBXzan83iVMktJKDtKDqs+ X-Google-Smtp-Source: AGHT+IFk4pp3atZr9i1HsCbtkP4FZ9g8J17pYJBoFXxA6qZJ156yPX2XT6nPSSu7qjRYC7DcVFlOKg== X-Received: by 2002:a17:902:cf10:b0:20c:3d9e:5f2b with SMTP id d9443c01a7336-20fb9b382a7mr56934405ad.57.1729818631749; Thu, 24 Oct 2024 18:10:31 -0700 (PDT) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-210bc04b201sm559595ad.272.2024.10.24.18.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 18:10:31 -0700 (PDT) From: Inochi Amaoto To: Chen Wang , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Inochi Amaoto , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Richard Cochran , Paul Walmsley , Palmer Dabbelt , Albert Ou , Giuseppe Cavallaro Cc: Yixun Lan , Longbin Li , Inochi Amaoto , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org Subject: [PATCH v2 3/4] net: stmmac: platform: Add snps,dwmac-5.30a IP compatible string Date: Fri, 25 Oct 2024 09:09:59 +0800 Message-ID: <20241025011000.244350-4-inochiama@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241025011000.244350-1-inochiama@gmail.com> References: <20241025011000.244350-1-inochiama@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241024_181033_226862_581FC9A3 X-CRM114-Status: GOOD ( 10.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add "snps,dwmac-5.30a" compatible string for 5.30a version that can avoid to define some platform data in the glue layer. Signed-off-by: Inochi Amaoto --- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index ad868e8d195d..3c4e78b10dd6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -555,7 +555,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) of_device_is_compatible(np, "snps,dwmac-4.10a") || of_device_is_compatible(np, "snps,dwmac-4.20a") || of_device_is_compatible(np, "snps,dwmac-5.10a") || - of_device_is_compatible(np, "snps,dwmac-5.20")) { + of_device_is_compatible(np, "snps,dwmac-5.20") || + of_device_is_compatible(np, "snps,dwmac-5.30a")) { plat->has_gmac4 = 1; plat->has_gmac = 0; plat->pmt = 1; From patchwork Fri Oct 25 01:10:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13849924 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1509DD1038E for ; Fri, 25 Oct 2024 01:23:40 +0000 (UTC) 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:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aFxf4QxLF/toEmNXgaIElhCUJYLQZAP/bPPOulcpatY=; b=PWF92uz8PMz4lqPXl2Ujp1eGDd UyugqQoTkwoV8QvvLISfLrcLcwcQfIhXNK2GTxy66kcJJKK9bGJJyeh4XCxa7/uspIPO/U9+tB+PT j3gMuH8tjAZCSKQ06GMSXyDRRN5Q2FfsJJ/AGD81qX0HASn46Ym+liRkWvk08g+iaeNrpMCmvLw9n UbMd71evhXheneq5D/Tbgaj6o1NzEdKlBNqUKXWA+ZlFpO8+4GtQdaqo7zOoOirxlfRC78aU/YJKe yJVy9wMZmZr89iInO1s3R0eSBcqMMcPv/Kok1msuPsIYg8fn75eymmbiwzurgDaxO3eXUipxZA7xF LsShhSqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t4934-00000002Apq-2JyJ; Fri, 25 Oct 2024 01:23:30 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t48qZ-000000028Sf-48al; Fri, 25 Oct 2024 01:10:37 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-20cbca51687so13586045ad.1; Thu, 24 Oct 2024 18:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729818634; x=1730423434; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aFxf4QxLF/toEmNXgaIElhCUJYLQZAP/bPPOulcpatY=; b=YxP9PJh9pTUsbf1ZFOmy+47kVnnZ1HGfy1hwembvZZcN2JClJcXC3B1ThlYpyW5wHd 1M6Cqh1gCvoWZ+9GmGfWN8y43PJtHWnbGv04p0B6DkvS5kzHI0QmcdZ93bD2VhQY01Mj FXn2bEG8HvvO+HKwp0jJdJjU2Mjvbl7nCk+v78dErwmwbkiULe6pVJnpQEp3UApmdATt MEg1Gmf+5lofOAM8UcgSnBynP0UNVzeEKyBkJp69HBxEe2GU0s+dA3hz7D+Xo+MZVQHu WnMijdwPO0sbYb3felYPD2JvJxezEx27bCZ6BElgyNydUPWYCCH8vDMywsRtHoT23fEx cW+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729818634; x=1730423434; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aFxf4QxLF/toEmNXgaIElhCUJYLQZAP/bPPOulcpatY=; b=jap2Gt9aZveLp1U+kgpNn2YIHeP8Nd5ntUZj+OjqYo7xQ1tTknWEpQ22qSCiOSmxiz tmD4uDU4kPsYZbIM84zinieOCXMAugxQoRdldgw3cAf91t+1ltwr+J3iFpWiRazthqrt W+SbOIxQPRHKGgjZ9q46syf6S0kl+aNXLHpum8JmrMgKgy8HBKsQvPj9JgkOL5JgD1c1 9vFoi6/kFTAXmfDraPPpuaRjV194IDxLAS1vi/bYtOwzeB6rv0MBjMv0NeW7DWkCna0K w/2qgkD0O/t5oLRdnhonAH2bPwXXeopbb/VbJoHZU3a0Qy7loDZgRBNr+v/sZDrWQvJn o9fw== X-Forwarded-Encrypted: i=1; AJvYcCUUST23LWUZK2Ni6YtlgeyfRpc39gKwlhB6IWLsHyrmTPc21XLjQlfd5pPiO+KZyB2FmCi1FbVmlVkxKgO56mb9@lists.infradead.org, AJvYcCW7pYOkraMdNC1XedjrC4ZXULZt30g8j2j+tFQvkD+TCM8jNvHfAsiBiVLMTqWtC3Vm7eRnkawFrmf3m9Y=@lists.infradead.org X-Gm-Message-State: AOJu0Yx1PsyNrAMTDeqx5rtDmfDXznPt4cl4MO/+sd1gBpKVGAEh9Rpi LKf6iT2T8YHT41vx3wQ49KsYmrHiLpD/+oVSXC3j3LJ0KyDJ4oqL X-Google-Smtp-Source: AGHT+IFIq9qVzQMxjRua0X+FHJBdW6t1PsYawZfLFed4kLY+0QEbScHCnjfUEv7d3LnygX8Bdb/9XA== X-Received: by 2002:a17:902:ea0f:b0:206:c486:4c4c with SMTP id d9443c01a7336-20fab2da20cmr102567405ad.57.1729818634564; Thu, 24 Oct 2024 18:10:34 -0700 (PDT) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-210bc082597sm554485ad.287.2024.10.24.18.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 18:10:34 -0700 (PDT) From: Inochi Amaoto To: Chen Wang , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Inochi Amaoto , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Richard Cochran , Paul Walmsley , Palmer Dabbelt , Albert Ou , Giuseppe Cavallaro Cc: Yixun Lan , Longbin Li , Inochi Amaoto , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org Subject: [PATCH v2 4/4] net: stmmac: Add glue layer for Sophgo SG2044 SoC Date: Fri, 25 Oct 2024 09:10:00 +0800 Message-ID: <20241025011000.244350-5-inochiama@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241025011000.244350-1-inochiama@gmail.com> References: <20241025011000.244350-1-inochiama@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241024_181036_055975_D7D76A69 X-CRM114-Status: GOOD ( 22.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Adds Sophgo dwmac driver support on the Sophgo SG2044 SoC. Signed-off-by: Inochi Amaoto --- drivers/net/ethernet/stmicro/stmmac/Kconfig | 11 ++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../ethernet/stmicro/stmmac/dwmac-sophgo.c | 109 ++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index 05cc07b8f48c..bc44b21c593f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig @@ -169,6 +169,17 @@ config DWMAC_SOCFPGA for the stmmac device driver. This driver is used for arria5 and cyclone5 FPGA SoCs. +config DWMAC_SOPHGO + tristate "Sophgo dwmac support" + depends on OF && (ARCH_SOPHGO || COMPILE_TEST) + default m if ARCH_SOPHGO + help + Support for ethernet controllers on Sophgo RISC-V SoCs + + This selects the Sophgo SoC specific glue layer support + for the stmmac device driver. This driver is used for the + ethernet controllers on various Sophgo SoCs. + config DWMAC_STARFIVE tristate "StarFive dwmac support" depends on OF && (ARCH_STARFIVE || COMPILE_TEST) diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index c2f0e91f6bf8..e1287b53047b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -23,6 +23,7 @@ obj-$(CONFIG_DWMAC_QCOM_ETHQOS) += dwmac-qcom-ethqos.o obj-$(CONFIG_DWMAC_ROCKCHIP) += dwmac-rk.o obj-$(CONFIG_DWMAC_RZN1) += dwmac-rzn1.o obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o +obj-$(CONFIG_DWMAC_SOPHGO) += dwmac-sophgo.o obj-$(CONFIG_DWMAC_STARFIVE) += dwmac-starfive.o obj-$(CONFIG_DWMAC_STI) += dwmac-sti.o obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c new file mode 100644 index 000000000000..8f37bcf86a73 --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Sophgo DWMAC platform driver + * + * Copyright (C) 2024 Inochi Amaoto + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "stmmac_platform.h" + +struct sophgo_dwmac { + struct device *dev; + struct clk *clk_tx; +}; + +static void sophgo_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode) +{ + struct sophgo_dwmac *dwmac = priv; + long rate; + int ret; + + rate = rgmii_clock(speed); + if (ret < 0) { + dev_err(dwmac->dev, "invalid speed %u\n", speed); + return; + } + + ret = clk_set_rate(dwmac->clk_tx, rate); + if (ret) + dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate); +} + +static int sophgo_sg2044_dwmac_init(struct platform_device *pdev, + struct plat_stmmacenet_data *plat_dat, + struct stmmac_resources *stmmac_res) +{ + struct sophgo_dwmac *dwmac; + int ret; + + dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + if (!dwmac) + return -ENOMEM; + + dwmac->clk_tx = devm_clk_get_enabled(&pdev->dev, "tx"); + if (IS_ERR(dwmac->clk_tx)) + return dev_err_probe(&pdev->dev, PTR_ERR(dwmac->clk_tx), + "failed to get tx clock\n"); + + dwmac->dev = &pdev->dev; + plat_dat->bsp_priv = dwmac; + plat_dat->flags |= STMMAC_FLAG_SPH_DISABLE; + plat_dat->fix_mac_speed = sophgo_dwmac_fix_mac_speed; + plat_dat->multicast_filter_bins = 0; + plat_dat->unicast_filter_entries = 1; + + return 0; +} + +static int sophgo_dwmac_probe(struct platform_device *pdev) +{ + struct plat_stmmacenet_data *plat_dat; + struct stmmac_resources stmmac_res; + int ret; + + ret = stmmac_get_platform_resources(pdev, &stmmac_res); + if (ret) + return dev_err_probe(&pdev->dev, ret, + "failed to get resources\n"); + + plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + if (IS_ERR(plat_dat)) + return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat), + "dt configuration failed\n"); + + ret = sophgo_sg2044_dwmac_init(pdev, plat_dat, &stmmac_res); + if (ret) + return ret; + + return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); +} + +static const struct of_device_id sophgo_dwmac_match[] = { + { .compatible = "sophgo,sg2044-dwmac" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, sophgo_dwmac_match); + +static struct platform_driver sophgo_dwmac_driver = { + .probe = sophgo_dwmac_probe, + .remove = stmmac_pltfr_remove, + .driver = { + .name = "sophgo-dwmac", + .pm = &stmmac_pltfr_pm_ops, + .of_match_table = sophgo_dwmac_match, + }, +}; +module_platform_driver(sophgo_dwmac_driver); + +MODULE_AUTHOR("Inochi Amaoto "); +MODULE_DESCRIPTION("Sophgo DWMAC platform driver"); +MODULE_LICENSE("GPL");