From nobody Sun Nov 24 23:34:11 2024 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 3AE1B39FF2; Fri, 25 Oct 2024 01:10:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729818631; cv=none; b=f8YFi3l5ONlSsRMXpKjai8y87mt5m2XXWIO61ssSwPbWgNMFSF/j8+wal+fokxHlR1SVPN14DNPqBh3mzOTwIfvXERBVFk9ZvwM1jpdOUoLjccsE24H/Mm9d41Ot2m0O+wCC8/GtvuRefTkeRpvD2aaiugYFl+CBVgmk23TjHxg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729818631; c=relaxed/simple; bh=vMFMrXzztda6HoheqmQ7CEavZSRuUMIpXDfn/S5dXa8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LioRQS6v1Rr90I9ea3txK3Yxz2QMzPSktpYbNexqw6dFTjeRm6K/o6cMYsb8MsE+Fu9bHAP92UdEo2k2mWlotWYjr2R11gSQjZem5y+3j3v4O8dq1Vv575HK/+rHsg7f3teHFtOTT28k2ByNo17SBM2sgvOlKHEUu6Q/A5R2zhQ= 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=FjZUWLPF; arc=none smtp.client-ip=209.85.214.169 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="FjZUWLPF" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-20c714cd9c8so14559175ad.0; 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=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=FjZUWLPFNORuUerQI4FMLFXUaGXyGlsKAlFrMHnjMght5mwaRTMzGyBNDJn34nDM4y 8V+Gzluv7sNins/S8eqZ48CoKygdhe441q6C+RRUVF4J6lsBIApCWAkJU1XeNUxX+9f0 XV0kXTi8Tc3bXDGQfmppeJDggYXUoQ4Eu4g8caXA2CB1rJZhUtAdHkjX2AnA4tTDPtXs FlW5pdLHeA+VwNyY0sfvDFLVFaOZLw0WlCMUWMqn7e9Su9pvGinp9lIL8PMXJsjhkd3V pfckT68tTn/+RnZc+JJ52TkbK6m14KeqN0in+GoJRWsopLeF8GRpy3su/7C6wlMt9CHY xHpQ== 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=lHeJTxDAAUBmc/YsACubYRuvxUHrcGWbOyTmLt4r3zFQnmTEb4GxEJ+7xVjKB80bEY 0w4ahTi1DHLq3156xblYkqIutTumvNj0SHNhVDROzeIzAnv/dkKwA1V2mQ1ANgfg0Cvb Sh0y8hdtUB6YcjInUPei686DsjaOBd3KXc8qb9mIVDioc5JcXSbKQA/VGVLKiVLvdKGh NgRQEdfTqexsINoOtzlENs/zuT/DRSXMWzv95OA35h7ZoCWJTRUXXrGu+r3hybJNaUgG 7mZbK2/WZ1xuEupzIGD7cMyfjSTQvhMkFgpbR5t7w5DFgGhL8SWjhHIjex1F98OmhS48 FQRQ== X-Forwarded-Encrypted: i=1; AJvYcCUBsFUbUHKf8OReYxpmagaffB2YhOhK1LbA9mFYeFIgWruGT280m2ovs/3dhapbevLdCDhfHxAY8PSBT1B+@vger.kernel.org, AJvYcCWblKzd2DZLGkWOv2pSrsoFuSENyUfvaiZLxSHZQgzEXwAGDr5KMxwrDjpfX7JGTsPMRjJpzM1z@vger.kernel.org, AJvYcCWk2d6dKMvCVCN2kAjFZS4WRGLchIaVMaV8FVag0HUSgk/rIzTkW64GPqMAWVQllEWYXzzJFI/uwRS9@vger.kernel.org X-Gm-Message-State: AOJu0YwLFsvteAYtTqehPsj9RaCtUfJVvsfQaw+aBuPxijQAKYApUri7 bHstTdExOivI51jjCt90WGl47Z64K8mYH0xevYwMD//Td+1qRUbW 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> 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 Sun Nov 24 23:34:11 2024 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 804F23B290; Fri, 25 Oct 2024 01:10:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729818632; cv=none; b=liT2NA5zeshDsTaGaI2//Nc2CRh7Poh01Bagdh5rdI5pdkAuFxv3D7o70elewLn7ye1rYNaCwVCeQylF1SpARCW5xX7FyTwgzNIMSnEHZcLr0Ct3PKg1YAX6jp4uLO3mxMjbE9lgq8YAc1piNXsD1jT123Q7BFKh13M/DiVK28Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729818632; c=relaxed/simple; bh=OnFEaOU1kULi6oPNGWWGHqOMwYv7yDsJ85wEJrz9eHM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CsgshcpAT/qajAneuyu6So3FsNdbIvRFIs7l+xXDT3Gfq2pWi4jvX8qjgPIOFJuFc2zrD0Uj1HZbvzLc+WAg6bTJbvwuw2joOaSLTtnMhw8009d44SZMF97CifV/KBWdtnKfiTiDQXzIVnMvAAUM/MQWWzvjjLvOUiLKjVPIEYc= 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=Mg5U/cX0; arc=none smtp.client-ip=209.85.214.181 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="Mg5U/cX0" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-20caccadbeeso14740735ad.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=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=HjsxbPPZPhrPsk8Kv9v/JHWFfPAbNR5NFf7Fw2jHbOc=; b=Mg5U/cX0v/6LlUCkM12fLN3wqdkpnaxYvL+RDieu+HRdqCeIW/mf3zSsB3hF7zNYvB W/3Kjnxq3Vp/OnvPhaX6HnQzJcpuu8dgzXEFbqqnBZlbaYdPEKv8/c9u9SROqi54TWDG QdIx8XGKoVpke7sA6xsY5iNfbacRSNHWiKe3iKdo4apspQ80tR9uXua+MrPSyIg2VnXb +y2bYslLrrQb/8gilJEpVquW0v6/ixaBhVCKcl5ma1VDlUA5f2u/qqqfNy1ACelXTwhd 97kTCU3HuMtNh2akXRugW6Kxny1vVzC4fP+I3/NJjrHqB+BtBUfZsjgffdMWDCZ4Ny9y uKRA== 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=FtfO+bcTF5FndjmAxwNvtvHA8CZjTIO22azAeMENcqJ2P19ZWe8x8TBtA1oS8ZR+uo pZZSczxGlzmBEZqBFAcgi5e2TE2HqRIpp9IaDGGXHQI9oc8yD5tMEDTMSZtny269lshq QMtASf82IJLjWfCsxoZKiLRQortZ/8ku2qkGXh1d9wIKHt0ib/MLdj6tV5SyCBM8jQT4 NH1oUdEw9XnziQpveGckr8Kz6XETXWfUzqVy2ccqZxaEIm02LPE0pZNmr1g1N1w2vE9/ stbKbCsEo0RHVqWoolgAIdrYR011FYDp0+trMuDNzgZzHn+GxunHzZoSXopwe2HwyR/r 8JrA== X-Forwarded-Encrypted: i=1; AJvYcCUTQcLr8gnvJcTmW8vQOwRx9+poR1TX7oLtPgImXmsQbGkRGW3Qn2paGwZ9C96U5AF+dY3bbElp@vger.kernel.org, AJvYcCWvdSxFbuZaQMxbqzBeQUR01F59vFwVdtxPjB5CNrD/7z9W1qPt0FwyyEBUAHDzhvVhejJMkWA2RnrIjeC1@vger.kernel.org, AJvYcCXRi9G9GI/iDXH1XLiGyDAVfLL5jWq/hYnDH93e76TPn25woX3+Uvs+IIMpPqCM68rzD8uzxsX7Hnii@vger.kernel.org X-Gm-Message-State: AOJu0Yx6G2G6uXqZl3Iq+8yMGWgqq0P+AbxTwb2GVlApogka8jiF31ou qpWareeYyF6yLYG9xlPmegy+sJgSB1MvFISF2m0pSagv9KeUr89R 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> 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 | 124 ++++++++++++++++++ 2 files changed, 125 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..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 =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 Sun Nov 24 23:34:12 2024 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 63673433CE; Fri, 25 Oct 2024 01:10:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729818634; cv=none; b=eV+MrStA3yQFHdZzBOqsLiJlVVgVnK5T+Lj3F4aiH7/gK21AaIpC42fO9ofhIn4lxQcBtgYtvQmJBKvpsMjg4ONo/3Zlt3IzfoDfumZoqPCjjv2VL4FF8OqX43bypD4T5+rMhGller8BDGm2JZCEjN/cpm0FYt/+Bt472KUOeD4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729818634; c=relaxed/simple; bh=f6Dima2Y36bgxCR9/TC5mO1Yg4VTmiBOuZ2X/k0C2Hk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FdSnXp7ik8AaE9VzEUzxRqzcsO8//W4PwVyH6501mj6iNR6HGvnMD88TIdidNWFnAu8b9tIJaZrBPHyMt/8CwdU3z0GoDNvjFA1YjNjS0VbdVS3gZ49zRlK1Yy8J1xwP20Mgn61TaQLtkElgd5M22RAoLFFt9BPyg12YKSBUyTk= 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=ntXaLEDv; arc=none smtp.client-ip=209.85.214.181 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="ntXaLEDv" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-20c7ee8fe6bso12340815ad.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=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=ntXaLEDvtSYowqDd6yKTsbLN70uQc8eZQwTavenx/uyP030v+k3yrN3WGkjSC+HelA UU8SlPZ8Wh6HA49EOlkgQX2cP1Nbkd3KSNNPKk8AUI/OLtFePgcCE9V4unKtQFUCo0QA gMjIllvIyKiMt6Z61c0W8RNyvPdHHE51WjjK1INbqUuPIy1NGkq4EpbmFuDFcEs59f20 FK7xRXFkK9YyY+Be2ca/ZcVA3w9YEDQ+PjcMyGv4Vxwp7RuLqM4AJArKC1UavnBstrMQ Jfad0K0gbAE++qcXDToodoOeZilCBTq9SS3XkEuqIgLgQdPG8fzEw1/JgJZnsAaqU+2k R0tw== 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=i9bdH5Jsy5bIN0UjdOIYEsNTIw9DPUYioItgEmcW/VmUCVjzbDCl/Z48r/A079AU5P UeyY6MJdb6n4k5zP/3hnA5psRB+lWrt5BohM5z8kfIapwiemVHl9ekMIuDR8nCKSd6LD vSqJw523QXd2eJc3Xf71azGfeYD+HlOKxjS+RKQaNa1tlBXsf9YJE5kgkDI8ZFpb20Pt 4wHxmkYNBjeHgUs6fpvIbfTbxaRFC7PhV9wFiFz9mR6yJSY6IhHKIrQjeVwgAPW5+PEv NZnC44fPLURdCUMJdavdkbB//yQkOBu09HdPfx+4v85OvHkBi2mJ7RlPjq+PJbK/6adc JZBg== X-Forwarded-Encrypted: i=1; AJvYcCVMM04Mv6pbwOVYZuZ58m194G5Zp6S8k8/fYrD9TCLwiOZNkJKPuKFAk36n/taXl6WcGkzKYp/UYQB+@vger.kernel.org, AJvYcCXT2fc3Qn8e22XK/Z47Ag3gz5uCwt+mFPuD5OuYXCMkhNxW601LDNQlJSXhH16qrRlVzWZy2Qms@vger.kernel.org, AJvYcCXphs+yXDjO0mHK1dyPbeLzRSaqHpINpUiJ8vgVRfnRl8LpD70zsABnSmgSq3kHyilzS2M+yCq8nelJa3mw@vger.kernel.org X-Gm-Message-State: AOJu0YxiomhWZcT5gb3AJzDo5JJAIb0ZT5IR7NUiG3toCou4CjJTjp9l EJdUzp7lVTTq+Jf7lHMByrIWhAyqZ6+MlUveI4pDwDmjKIR/+jSg 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> 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 Sun Nov 24 23:34:12 2024 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 4D69013B58B; Fri, 25 Oct 2024 01:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729818637; cv=none; b=r4+45n2ZnvnzORPFb7iUhlB924L3gTpqXdzA8X8xzuSk4JnwlX3KlzbvOQrgzlL/1WeFckHgg1jA25Sktq+dQdKG24TR/i8gop3YdYl62v0cKMt6R9vHy1dr3QkUs7C2B6/bxO4Sd6uw0PVyBEkpcW3zToohUdrdPT1f7c0t9sc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729818637; c=relaxed/simple; bh=W9i5Zg+RiJZ2r/kuY+MWyba1Q2p2aXsuX5p5r7Mw3J8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UiMeZItpBYOa1x5oTGs3H3EOVSexxDwqStXRtCyQYb7rmFwH5Nqkwxt4i0D6kDGtiImBTd1kOid+mVEtO6Byy/gliO3DLURz524NqAthGsZc2DyIMj6avjUvjByG3NJMDL3srYdnQGHAVI1/XgtVZncaJ07vGJOFxu3APNdq/uo= 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=i+jWHOYU; arc=none smtp.client-ip=209.85.214.182 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="i+jWHOYU" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-20cbca51687so13586055ad.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=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=aFxf4QxLF/toEmNXgaIElhCUJYLQZAP/bPPOulcpatY=; b=i+jWHOYUK39ol42lNCZfdU/lR+Etz/B2fhHq8pEKxS1srHrOMM+rJyhn+Bo+sx+OVx SNqgYPrrP9KBsoJhxzdMtKPxCGYMiB5koohFMRzkKKEHxDv1cEFyewF7Tex7BZu+niYF ZX12EMPwe3jUIO6pCR3S2Dv5X+r/TiNEUL3xy5M/N7XYS8wT2gQowIJ/qmGkTDnpKBAg 5WNzBrFatTePy2khCrT/GfLh9FXaBHAZORTY/3c8EjbC48n2gSodZkEUtq5lLRyLRKEX gIx6+TLlcnmxZ6pbOBQpzWi7rGzIolFJluwrvJwqr12M+8Z45O8dlgpOynpaZHqu/Djc 60TQ== 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=cILnvRQyxJhB8qVyK+ksaoMnlXbYSeTowdiV4QuQ96peZV2BUFlvjcGFQkltMkzOVq 4Zx6nBSIkJUnN6hcIqKFJcmgS5YjYgWMFQCtdvRDjCMDNC8bBmPMYucHsunGE82Zlya+ rhxar3ve2gkilv0FGuAFoJNodGNPaO9IGYTi6o1Orkbm3YsBHER9+12TcKbsTxLpI3Wh +qSkd+6CfndE6aNHcpeJ5DRa2kp9z4Kf/oOTfqhNlKpv8CAbNultFf9Q7evrq1pbFaLT dAVqmXf+pZg8dSshAVut6vqsgJSMb46tWO0EksHx6brGFpFaORq9DZW9w51J4hnMD73U CkZA== X-Forwarded-Encrypted: i=1; AJvYcCUpDczaCr79L/UcZZnTCo/yuJtFBcJX9bTX2LVhZSPSdjt3GtGtqzpT7khDGk0iy4cwWNbeDMbbLvU7@vger.kernel.org, AJvYcCWM3cqZQRcAP4K8CfofHaZGiQI7fp+fJUuJ5B6IlxKpg+3NrzH3AaTnGAsaJtdILOTykx1bUsTfhlwqj+mw@vger.kernel.org, AJvYcCXX2miPpUfNyf4PzoflHO3+RXx7d86Vm8kPjogRFeLNzDjD5HxSioNvkcS4SBELvoc45i1lmcer@vger.kernel.org X-Gm-Message-State: AOJu0YxkdXGi8zxTL/Jm3YoLmXxyb8FW0+nQyu72uTRk7nOpJz/rJPVD GYNwjLbV7b/GzApxfD25B7k1YOe0O2fgbaBILrHere4S4TYMXg6Q 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> 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 | 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/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..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, uns= igned int mode) +{ + struct sophgo_dwmac *dwmac =3D priv; + long rate; + int ret; + + rate =3D rgmii_clock(speed); + if (ret < 0) { + dev_err(dwmac->dev, "invalid speed %u\n", speed); + return; + } + + 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; + 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"); + + 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 =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_AUTHOR("Inochi Amaoto "); +MODULE_DESCRIPTION("Sophgo DWMAC platform driver"); +MODULE_LICENSE("GPL"); --=20 2.47.0