From nobody Tue Nov 26 05:33:36 2024 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (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 1DCDE1EF937; Mon, 21 Oct 2024 10:36:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729507011; cv=none; b=TUVHzAAjsxZb10rvf9WVXmNuP7KetlrwMe0VmZSAqwNXi/BLoh0CHB+tugHH0/TgetPjBOU6eP6rhth7hla68X3uX26vfm8XNj6++vT5wGe6O2d9FAYQtH0xpK7mO18K2MyqZnUQq1C6cSHAdrOp/iKDIP3qt9vsAAOneZbMsrY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729507011; c=relaxed/simple; bh=vMFMrXzztda6HoheqmQ7CEavZSRuUMIpXDfn/S5dXa8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KVlhtlxrqiq2TbVy9Kct5ToyX0TBsrN8AGm9Chay/dI7MXaJG8lZxg2TNEFFPYvUdXMLVRnOLC3EZqXx0IWVusUPqY4JnvSXr0iI78kBnelPmXAfngRSGY1x+m7hWIST2oC8lerELNr/C9e+9ilV7hVw0EqzSl0ocvEeEiZETKs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dS0SMo4w; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dS0SMo4w" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-7ea80863f12so1803390a12.1; Mon, 21 Oct 2024 03:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729507009; x=1730111809; darn=vger.kernel.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=dS0SMo4wNGOIfZc1clpTfCidzm+7iUtAuMYOXGd920LAE43Adkar6q+EEHJV9SCcHn e1T2NvmZ4TU4xdulxEmVaHQvNKo9tF3lM8BVjpM+V8iLQxgnLx9CLULL2qqGb6YyjPl0 J+XsqTU78yDJR/hof+uUMYTNpyVW2Vtl7wj3Y2k8Dm1FXcc8RkigNf5QN2QS8tgErYsj M2k5VWqGqpdRsVOS/Z7zTeTTJMAB4ndaPfdyUVk9D+btsit4q7qzpERTuUIohBCvorfB Y31MqdcGtUWVgzNEpeNhJGBF2hWW+YaZ3XDN/D+Yc2JUiuUaRoPolwS+0nw/k/ekWSA4 c++Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729507009; x=1730111809; 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=VD827vaeNMhcse2MY/1ypm+cxVpgRGdI5s/nRFkHnRMXJavgD5BGRlv2/K2AqZyTCn jzF36OrCDPdZt1IDbjqF2iDwnQZGdYLDwioB35Mx+x8BwQNC1mMpeU9jboZVWZd0Ff4E dmE14aeu4V0a8+Bp8Ew0EOL+uhCiikthWXXQLJwuf/rDJPm5BkZFQfAKgCmHmG2Y6R/7 533bYjmKovskWIYMH0nXU8vBjVz6d8cDxE7mS8ZX3gK4taKtxz/3r6R6bS8e9Gxaj+Wx 0zaLtkR7HzLf+VAgo8v82ksT0FhSrXOIDVNq4KxO0TUJQ0/JwBVvy5hYSwP0eT7cSyR1 3jMQ== X-Forwarded-Encrypted: i=1; AJvYcCVgR9mC3wHGJ0BYs4vhs8bV56xlgq5TSc3tfPK8GaipXP3ltv6yaE5lSUIPH0MGmZ8mGaBPqRMR@vger.kernel.org, AJvYcCWHlayhuG3L9qCjcms8u25sc5Vp4oPixZaBf8LYSDjnrZnwmXtezpC8Rj2v4Bi42NfKPgtpbFb1j397@vger.kernel.org, AJvYcCXdijEgzpUcfzQ6BMu5fPHucVVS/r609Q7Pc5Esaegrr713oK1JvPOMvuzgSzYtAyGCZ7e+W+txohWPhXvw@vger.kernel.org X-Gm-Message-State: AOJu0YzKR6CyZQDOEL7nv91z8uufVCFkhOdNxfBPZp2+ArbEQ214W1oa d3MU3GUAXZt8l5Xji4GwGtXdqfJmYXXsqY0+Mu17eYis9Oou0n+N X-Google-Smtp-Source: AGHT+IHcfOB8KvzIPdr/4gmQUpcTvuERKiXFCsr6Yz6aTePpzQBGy3C9mW284sw41jWu8/yv/Ub+BA== X-Received: by 2002:a05:6300:44:b0:1d8:a759:525c with SMTP id adf61e73a8af0-1d92c572670mr15063786637.39.1729507009210; Mon, 21 Oct 2024 03:36:49 -0700 (PDT) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20e7eee63a1sm23044785ad.18.2024.10.21.03.36.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 03:36:48 -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 , 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 1/4] dt-bindings: net: snps,dwmac: Add dwmac-5.30a version Date: Mon, 21 Oct 2024 18:36:14 +0800 Message-ID: <20241021103617.653386-2-inochiama@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241021103617.653386-1-inochiama@gmail.com> References: <20241021103617.653386-1-inochiama@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/Docume= ntation/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 =20 @@ -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 --=20 2.47.0 From nobody Tue Nov 26 05:33:36 2024 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 2AD9C1F4730; Mon, 21 Oct 2024 10:36:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729507014; cv=none; b=a1+0qmSg/iXmHK+LRfd6uOjTdXHmtKjmxvVwQdurcrfiB7iLFbgyY3+9BlRDZSffg+NxoMXUmhT6o0h4vOflVBmEHUmu9ULO0bRuQ73o4QYDkUproGc4F5sGV8Gmp9W40UU+ZWYibgLaUHx3thRu+2t7c3Yzyhi5yh2rBraviEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729507014; c=relaxed/simple; bh=kZXJ3DQ0Jh/J5QPQJqoZESvxBuSqHtS8WWbLXbahlWo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dEDoWg0VusoDLJhKcNK2Rl67clN0EqBvS+JiluUW0tWSoOwUH8bqJinMzP9+SL621+AKZENX9JyzhYAxX0P0JcnFaPfHQjk+lh49kxZHEybB4DESq/u9ZEiTPvYWv82HjG+Kk4oO10e/KvKoXmmywU0OJ/rdpdnWROB13uy9ykw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Z7QVhJQO; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z7QVhJQO" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-20cd76c513cso35659475ad.3; Mon, 21 Oct 2024 03:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729507011; x=1730111811; darn=vger.kernel.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=ROalFAeuv2FT5XJcCDsa2eyjiagS1IAfhK+ybSBBNOk=; b=Z7QVhJQO67s5JH3PFwhlGh8Ru0tNN69IBbMq5skZIegNbdJBB8icLg4INW4ay0lXN9 l3zjvzDcda7hJ2O856twBlHTj1VqSlU5crgiOrMI+fGBrDONVaQ9SIK+E68IoFRjEl7w 95TQaDDnaVvQxhHU8SIpgrYunP6hLK0e7JG4waREH7hi0240nTBiVtE8w+bBS0ioKlBU AGoXWTTthn45C13OU3QdoqwHFY5ap+oY6jRVUIUbcpZFZN59/RBCOtjsCBN8xdhBa1G9 DFaTHG7ScJovSQJsmoVHL6dTAVHzGEjGsUknWevLW5T8gfxnbgBwy8P6zS8aZbTBL4U2 DjhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729507011; x=1730111811; 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=ROalFAeuv2FT5XJcCDsa2eyjiagS1IAfhK+ybSBBNOk=; b=C7DvYkd4lFU/3L2hLcagHx1x/Jf1Eq8SON8oeidelFrB7a/ie1yYPUlRyqXmLVB3aq kMMWGnBuxwjM9zcDXz3+P5666LBrgmIPcS3p9cY/d6cFmracBNKRsTSTdu+jmWu51ijM izpMc/d7K+2SNRhX8VFb9oAopNmCgff1k/ng+UaltspdPgTXTUHBEm2z5iOi8c4MM1xX MAXet+9baHhJUIjSqmnilPzJM8r4688KBhuHGzqRciDFJYYQDFQYyXKlFaKTrYn+nrZq zG8HqH1FIEMp462h4TURQZgBYxD3BPrJAVAXhzP2mFTpQ8rIlDoW1AyWtq2npotRCqpF gKAA== X-Forwarded-Encrypted: i=1; AJvYcCUXm2dKjTxndSK0QfYhgFpximmC88Xai+R6BRNcLYn4MjN7Vy0lUC0iI+b0Ywwr6f93rwd2+jaQYEIDCVoP@vger.kernel.org, AJvYcCVktecPd582Lr9eaBRqlIuvcSqKdF6bAuCywImB3Zpaxvi0gjImIdBCkWlq9/grscIQlkvdu+84@vger.kernel.org, AJvYcCX3fS8PflhA6Il0Sqby1/XQhlQoQe/MZAFDPEfZNJOKqH/G/YAqdeZpo7fFTElJqX7evlSRRpQwUWhw@vger.kernel.org X-Gm-Message-State: AOJu0YwNs97oBLncfQltnurRHTNIFYsCTplsS66+sK/oyqwetyq6NLFT wjS0lT71Kf5KjfHT1vl81arHKRN0F3/vUwjDfnb0x7eyPLhCbsbE X-Google-Smtp-Source: AGHT+IGtGQdZs96OgFnH+jxQO02blnd9Mr30IOhQfnSRFPAMbUhlzzNhum28G7bu+yZXf1ru9cnQAw== X-Received: by 2002:a17:902:e846:b0:20c:a8cf:fa25 with SMTP id d9443c01a7336-20e5a9339efmr140267755ad.46.1729507011181; Mon, 21 Oct 2024 03:36:51 -0700 (PDT) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20e7f0c0e5asm22850335ad.167.2024.10.21.03.36.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 03:36:50 -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 , 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 2/4] dt-bindings: net: Add support for Sophgo SG2044 dwmac Date: Mon, 21 Oct 2024 18:36:15 +0800 Message-ID: <20241021103617.653386-3-inochiama@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241021103617.653386-1-inochiama@gmail.com> References: <20241021103617.653386-1-inochiama@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 | 145 ++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/sophgo,sg2044-dwm= ac.yaml diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Docume= ntation/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 =20 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..93c41550b0b6 --- /dev/null +++ b/Documentation/devicetree/bindings/net/sophgo,sg2044-dwmac.yaml @@ -0,0 +1,145 @@ +# 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: StarFive JH7110 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 + + sophgo,syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to syscon that configures phy + - description: offset of phy mode register + - description: length of the phy mode register + description: + A phandle to syscon with two arguments that configure phy mode. + The argument one is the offset of phy mode register, the + argument two is the length of phy mode register. + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + - interrupt-names + - resets + - reset-names + +allOf: + - $ref: snps,dwmac.yaml# + + - if: + properties: + compatible: + contains: + const: sophgo,sg2044-dwmac + then: + properties: + interrupts: + minItems: 1 + maxItems: 1 + + interrupt-names: + minItems: 1 + maxItems: 1 + + resets: + maxItems: 1 + + reset-names: + const: stmmaceth + +unevaluatedProperties: false + +examples: + - | + #include + + ethernet@30006000 { + compatible =3D "sophgo,sg2044-dwmac", "snps,dwmac-5.30a"; + reg =3D <0x30006000 0x4000>; + clocks =3D <&clk 151>, <&clk 152>, <&clk 154>; + clock-names =3D "stmmaceth", "ptp_ref", "tx"; + interrupt-parent =3D <&intc>; + interrupts =3D <296 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names =3D "macirq"; + resets =3D <&rst 30>; + reset-names =3D "stmmaceth"; + snps,multicast-filter-bins =3D <0>; + snps,perfect-filter-entries =3D <1>; + snps,aal; + snps,tso; + snps,txpbl =3D <32>; + snps,rxpbl =3D <32>; + snps,mtl-rx-config =3D <&gmac0_mtl_rx_setup>; + snps,mtl-tx-config =3D <&gmac0_mtl_tx_setup>; + snps,axi-config =3D <&gmac0_stmmac_axi_setup>; + status =3D "disabled"; + + gmac0_mtl_rx_setup: rx-queues-config { + snps,rx-queues-to-use =3D <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 =3D <8>; + queue0 {}; + queue1 {}; + queue2 {}; + queue3 {}; + queue4 {}; + queue5 {}; + queue6 {}; + queue7 {}; + }; + + gmac0_stmmac_axi_setup: stmmac-axi-config { + snps,blen =3D <16 8 4 0 0 0 0>; + snps,wr_osr_lmt =3D <1>; + snps,rd_osr_lmt =3D <2>; + }; + }; --=20 2.47.0 From nobody Tue Nov 26 05:33:36 2024 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (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 F21BA1F4FB1; Mon, 21 Oct 2024 10:36:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729507015; cv=none; b=nE8UznxGTwoKkT4+VGAkH7xIeeLrzigJFqanX5EIRHWb0scZ77SQ75SRUPBXERO3Hsi6fOFblWzComigasYzFfQmpLbR8ikpe+LWwKjnYQfbR5QTVntcU5NPO4ujBPvwsJNeEqpFJLRasf75oaPRnfVTAvS1QePiLKuEGb8O1Yw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729507015; c=relaxed/simple; bh=f6Dima2Y36bgxCR9/TC5mO1Yg4VTmiBOuZ2X/k0C2Hk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SMOMsdIS9AvsGCh7Fj23DB4BAAv+F0KQnjKCAnsYlinErNd6pJTrtBws9/bvENjTWp0BkGP1G5F5wOSJjHqZJCk/Bi8RELAOIYRCvimWoXSm7sdvOVI7Y9ZvJL8wjZCfv+QUjAiytJ18uoP2PSav705SngZvoeGt6z6/Ifw1RLo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=emO6Lf7u; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="emO6Lf7u" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-71e7086c231so3234113b3a.0; Mon, 21 Oct 2024 03:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729507013; x=1730111813; darn=vger.kernel.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=emO6Lf7uN1dNDvxcVV/OmfEfunBgglw2+qoV+GJ153UMvEEpKiDOqNIzjGGd5OQ6Oc DFrrtVACWEKxJEcqdZmXl/R+8O17CcOs/Hvyqeg6wqJYIx7tVBtLpmKuZN4sDyhiWyXL XSUOnrlbDqGtDRHhqbsdkQoDNyc4XXMVxPL2KWkh6N1rIrH+A2PoANrsj8Cewjmmpapc B+B6azCAKuhpML2mkKgn3VwZhbNUit9ndC9ZUCn02PciqnahjRUqtgDpCVgX8ON7vRIT QWtXcqr8ha0pBUg/lBXNcEdrNQIbYGEUCwQ7jT+1sS1gVIbxC370XKK9AW0/6ntMGmwP U3gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729507013; x=1730111813; 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=fat2feCv+IvGSbL+mEdVN/++UyhesbwF2B4wDznRNJlFanUCDawCrFJDzfXxPHXJkj 2uM8id5pWr3c6xFBZFFlYfZKTbgFrv7Lknnhy57k6rpQ/rHCW5cgdGnBJWXY1Tvgc3Kt lQ7pQpHyoBC4tv5midQGNqD5ZfO5/nZCoOYna6KS+vaVt1f2fwAuZMnadtMhbqkw8PQR KbauiJTvYFn82BYsR9Eo1zD8F31kLkwmibkLMuRDdgbPwHHBYWf5Tf/29yyt86aPYZ2o 57p9gwqlURfeut72hbutCqJXghepnTYmu/ly56awad2DuFVQYwjkkaTWNfEAZqN/RlgY 4xrw== X-Forwarded-Encrypted: i=1; AJvYcCVVqKRoMsqtC9W87mMM4dX4SERI8I5EuEqCBY7C+PlZtM6nP31Emkbh+pWFiSb2t3aySoebrwZH2G7S@vger.kernel.org, AJvYcCVuAckMpY0g4lbKtV9cANYKaKN8aHwYc47+YeWFez4PE566mr6GlqzvdKNWr+O6CE72ho52hvQs@vger.kernel.org, AJvYcCXLzLb3NL8KYxi2gmbRYFsTwEfC2b2beuPXknzQvp58xMn6eWiuWZe8vOdTZ4qlfiigduPCqTzM5f0epkW0@vger.kernel.org X-Gm-Message-State: AOJu0Yy4UOcIDyj46H2vISkPbZqNKclZn8zlWSgsDOdt+ZKGVz8hmapb zFAmx+jbq55qqkSH6xi4W5CpuUHSjiCJ+WSJkon87CLgjA89hn34 X-Google-Smtp-Source: AGHT+IH92yYXC4eqDoteqMVnaKaZwnewH6U4taRuuS75GAekpZY3rtWoFcqSB+3PqyFf4WP9/QcVHw== X-Received: by 2002:a05:6a00:23d1:b0:71e:6f63:f076 with SMTP id d2e1a72fcca58-71ea31927d8mr16089602b3a.5.1729507013033; Mon, 21 Oct 2024 03:36:53 -0700 (PDT) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec132ffc3sm2556008b3a.62.2024.10.21.03.36.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 03:36:52 -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 , 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 3/4] net: stmmac: platform: Add snps,dwmac-5.30a IP compatible string Date: Mon, 21 Oct 2024 18:36:16 +0800 Message-ID: <20241021103617.653386-4-inochiama@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241021103617.653386-1-inochiama@gmail.com> References: <20241021103617.653386-1-inochiama@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/driver= s/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 =3D 1; plat->has_gmac =3D 0; plat->pmt =3D 1; --=20 2.47.0 From nobody Tue Nov 26 05:33:36 2024 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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 9AA8E1F6681; Mon, 21 Oct 2024 10:36:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729507018; cv=none; b=R7G29Xt6Usutl+W7Pr1V0W06FZRUKFmmx4FtfHfIJjiHqrpwpgPS68XRdJnT5skeYjkB4wBw7QVYk8sfd2GmzFURYxLqe5ieSKblQxsZ1PVJ2abGPP+RSLDjDSVgHciB2jlcXpwEKA+1OO0mawSrlGu/Cj0sjX4ogSFd6DAJdCU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729507018; c=relaxed/simple; bh=etEndz2Qo0Ninz2eZPaGO+kvPjiGsNRIVQ9duINjyQE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YbooEpS+YOTuysZkmZjoi1LGzePv36Gr7zxWH0V6QrX2FqDFFExZQgOL2pDKkiHmdjQhTIEIrxSnlqGrbnrqlFVGXakzNPH+jF4ustI1DrkACttQddQGRhniBQ/ewP2K0CHo6PBGgHJXyv1Y0apLtxiGFYXOIRf50WXXqwzxLCM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SMrWULaY; arc=none smtp.client-ip=209.85.219.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SMrWULaY" Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-e28fe3b02ffso3836048276.3; Mon, 21 Oct 2024 03:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729507015; x=1730111815; darn=vger.kernel.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=svclsiCEeUb5+9t03qJl3db9yymwfO2bBzTcRxMC9P8=; b=SMrWULaYT2P/Ihus8WQelGojoGLWKAahl6tHrcZy4wi+OPLSVQnke+ITyx8v6g0DFd xqimyVrmvq407uZ3Sb7OpHvhYKaXj/HxiEmWV33karMYTSyCAF50RvWyaTpRG3rlIlhN oZLolnfUsyj1dNg7sEayNCmeMpXHQoWPmjmAIYEbCKEasnbECZ3EahwTlFL+p1Khjbgj QNm+uHtEw9r02qWgPazKio+4eFhZRuiq8yzUzZD5RV8FeMOjP4XYC5OvM5wZFVQD0LiX F/7oVyvVnPepnA9Fiq9aJoITIW12z1ygWZgEwaGJka2RE40/xJzy4kgRKjksJNETnGYs dOng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729507015; x=1730111815; 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=svclsiCEeUb5+9t03qJl3db9yymwfO2bBzTcRxMC9P8=; b=vV8L0EoO3VQpp61gbX088vTQr3JgUBaEi3HzEjXvIpeYSyf86EAmq3bx6lcON8Y86s cUIHPklNGVpswMYIa4m3OLUw3+i+kc4i3y8Qlh1nND7XHQPUODSzbOXLY+NNBd09LtdD rbtu5X6iTy6G6BWRhN/H9EL1P453IFKqcVCy5ZPSsI9chN/ur5Sys/1lb/x3IYSCm4Nc gvRIJn6MTDu5bbjmR1IrU6Pd8Ug9+KeHD4/02jY7M770rjpfGBIj4oxrBzccQdM8APL/ Qv832DRTtaN9wx1XYZacXd1eLkcQBs8UIFek7yKT5seKyHvC2XFGKW7XyZPGLt9QMqWD c+dg== X-Forwarded-Encrypted: i=1; AJvYcCVLPYkAb0U8mfAj2bCEFy5oKeQPSJgLcRNR+7om5xAJypVCcpcrsPz70LAaJQTghPdW+pP22pr9@vger.kernel.org, AJvYcCWgLJnVLeFf53L+L6XNgNtOXLXiLR+++TeeUd3v1GCONI/wy1SUbhAhyFm9IkAdDtMSKvPWqhn14zE4AlX2@vger.kernel.org, AJvYcCX/QR7ZtBTxKYp4bYXQAld1t/cFiJ9c+n9Oh/wIQKOx8eso2DOxmh1CU0Gi1OQnk2javhnrsPZ5YuL0@vger.kernel.org X-Gm-Message-State: AOJu0Yw0uEVUv+iYhxUyDG3q4sjelIMvLUTr94t3me2AG4JV1MeRcEkN hz4zfWk/FMkFVpfvYyRpHlEwg2EvIpQMODCQ4GjLuOzdxGNZfZEE X-Google-Smtp-Source: AGHT+IHlrA+/dcj1vd4lrPU9QHu+0p+ysA9RIWhCRIkhzXUN8cuwR3GxzlOFB2/p619LdCBVuIUTOA== X-Received: by 2002:a05:6902:1b8b:b0:e29:1572:6d03 with SMTP id 3f1490d57ef6-e2bb16cf119mr9061983276.47.1729507015417; Mon, 21 Oct 2024 03:36:55 -0700 (PDT) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7eaeabd8dc8sm2772799a12.77.2024.10.21.03.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 03:36:55 -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 , 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 4/4] net: stmmac: Add glue layer for Sophgo SG2044 SoC Date: Mon, 21 Oct 2024 18:36:17 +0800 Message-ID: <20241021103617.653386-5-inochiama@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241021103617.653386-1-inochiama@gmail.com> References: <20241021103617.653386-1-inochiama@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 | 132 ++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethe= rnet/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. =20 +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/eth= ernet/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) +=3D dwmac-qcom-ethqos.o obj-$(CONFIG_DWMAC_ROCKCHIP) +=3D dwmac-rk.o obj-$(CONFIG_DWMAC_RZN1) +=3D dwmac-rzn1.o obj-$(CONFIG_DWMAC_SOCFPGA) +=3D dwmac-altr-socfpga.o +obj-$(CONFIG_DWMAC_SOPHGO) +=3D dwmac-sophgo.o obj-$(CONFIG_DWMAC_STARFIVE) +=3D dwmac-starfive.o obj-$(CONFIG_DWMAC_STI) +=3D dwmac-sti.o obj-$(CONFIG_DWMAC_STM32) +=3D dwmac-stm32.o diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c b/drivers/n= et/ethernet/stmicro/stmmac/dwmac-sophgo.c new file mode 100644 index 000000000000..83c67c061182 --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Sophgo DWMAC platform driver + * + * Copyright (C) 2024 Inochi Amaoto + * + */ + +#include +#include +#include +#include +#include +#include + +#include "stmmac_platform.h" + +struct sophgo_dwmac { + struct device *dev; + struct clk *clk_tx; +}; + +#define DWMAC_SG2044_FLAG_USE_RX_DELAY BIT(16) + +static void sophgo_dwmac_fix_mac_speed(void *priv, unsigned int speed, uns= igned int mode) +{ + struct sophgo_dwmac *dwmac =3D priv; + unsigned long rate; + int ret; + + switch (speed) { + case SPEED_1000: + rate =3D 125000000; + break; + case SPEED_100: + rate =3D 25000000; + break; + case SPEED_10: + rate =3D 2500000; + break; + default: + dev_err(dwmac->dev, "invalid speed %u\n", speed); + break; + } + + ret =3D 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; + struct regmap *regmap; + unsigned int args[2]; + int ret; + + dwmac =3D devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + if (!dwmac) + return -ENOMEM; + + dwmac->clk_tx =3D 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"); + + regmap =3D syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node, + "sophgo,syscon", + 2, args); + if (IS_ERR(regmap)) + return dev_err_probe(&pdev->dev, PTR_ERR(regmap), + "failed to get the regmap\n"); + + ret =3D regmap_set_bits(regmap, args[0], DWMAC_SG2044_FLAG_USE_RX_DELAY); + if (ret) + return dev_err_probe(&pdev->dev, ret, + "failed to set the phy rx delay\n"); + + dwmac->dev =3D &pdev->dev; + plat_dat->bsp_priv =3D dwmac; + plat_dat->flags |=3D STMMAC_FLAG_SPH_DISABLE; + plat_dat->fix_mac_speed =3D sophgo_dwmac_fix_mac_speed; + plat_dat->multicast_filter_bins =3D 0; + plat_dat->unicast_filter_entries =3D 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 =3D stmmac_get_platform_resources(pdev, &stmmac_res); + if (ret) + return dev_err_probe(&pdev->dev, ret, + "failed to get resources\n"); + + plat_dat =3D 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 =3D 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[] =3D { + { .compatible =3D "sophgo,sg2044-dwmac" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, sophgo_dwmac_match); + +static struct platform_driver sophgo_dwmac_driver =3D { + .probe =3D sophgo_dwmac_probe, + .remove_new =3D stmmac_pltfr_remove, + .driver =3D { + .name =3D "sophgo-dwmac", + .pm =3D &stmmac_pltfr_pm_ops, + .of_match_table =3D sophgo_dwmac_match, + }, +}; +module_platform_driver(sophgo_dwmac_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Sophgo DWMAC platform driver"); --=20 2.47.0