mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Max Hsu <max.hsu@sifive.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,  Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Paul Walmsley <pjw@kernel.org>,
	 Samuel Holland <samuel.holland@sifive.com>,
	 Nicolas Ferre <nicolas.ferre@microchip.com>,
	 Claudiu Beznea <claudiu.beznea@tuxon.dev>,
	 Thomas Gleixner <tglx@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Conor Dooley <conor@kernel.org>,
	Albert Ou <aou@eecs.berkeley.edu>,
	 Alexandre Ghiti <alex@ghiti.fr>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	 Paul Walmsley <paul.walmsley@sifive.com>,
	Max Hsu <max.hsu@sifive.com>
Subject: [PATCH 3/5] net: macb: Add support for SiFive FU740-C000
Date: Fri, 20 Feb 2026 16:27:07 +0800	[thread overview]
Message-ID: <20260220-fu740-v1-3-c8af54130c58@sifive.com> (raw)
In-Reply-To: <20260220-fu740-v1-0-c8af54130c58@sifive.com>

Add a distinct configuration for the SiFive FU740-C000 ethernet
controller to comply with the SiFive IP versioning guidelines.

The FU740 ethernet controller uses the same management IP block as
the FU540, which is tightly coupled with the Cadence MACB IP and
manages boundary signals. To avoid code duplication while maintaining
distinct SoC identification, this patch:

- Renames sifive_fu540_macb_mgmt to sifive_macb_mgmt to reflect
  that it's shared between FU540 and FU740
- Adds a fu740_c000_config structure that reuses the FU540
  initialization functions
- Follows the established pattern in this driver where multiple
  SoC configs share the same init functions

Signed-off-by: Max Hsu <max.hsu@sifive.com>
---
 drivers/net/ethernet/cadence/macb_main.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 43cd013bb70e..10d049391a73 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -39,8 +39,8 @@
 #include <net/pkt_sched.h>
 #include "macb.h"
 
-/* This structure is only used for MACB on SiFive FU540 devices */
-struct sifive_fu540_macb_mgmt {
+/* This structure is used for MACB on SiFive FU540/FU740 devices */
+struct sifive_macb_mgmt {
 	void __iomem *reg;
 	unsigned long rate;
 	struct clk_hw hw;
@@ -4650,7 +4650,7 @@ static const struct macb_usrio_config macb_default_usrio = {
 /* max number of receive buffers */
 #define AT91ETHER_MAX_RX_DESCR	9
 
-static struct sifive_fu540_macb_mgmt *mgmt;
+static struct sifive_macb_mgmt *mgmt;
 
 static int at91ether_alloc_coherent(struct macb *lp)
 {
@@ -5236,6 +5236,16 @@ static const struct macb_config fu540_c000_config = {
 	.usrio = &macb_default_usrio,
 };
 
+static const struct macb_config fu740_c000_config = {
+	.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO |
+		MACB_CAPS_GEM_HAS_PTP,
+	.dma_burst_length = 16,
+	.clk_init = fu540_c000_clk_init,
+	.init = fu540_c000_init,
+	.jumbo_max_len = 10240,
+	.usrio = &macb_default_usrio,
+};
+
 static const struct macb_config at91sam9260_config = {
 	.caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
 	.clk_init = macb_clk_init,
@@ -5411,6 +5421,7 @@ static const struct of_device_id macb_dt_ids[] = {
 	{ .compatible = "cdns,zynqmp-gem", .data = &zynqmp_config}, /* deprecated */
 	{ .compatible = "cdns,zynq-gem", .data = &zynq_config }, /* deprecated */
 	{ .compatible = "sifive,fu540-c000-gem", .data = &fu540_c000_config },
+	{ .compatible = "sifive,fu740-c000-gem", .data = &fu740_c000_config },
 	{ .compatible = "microchip,mpfs-macb", .data = &mpfs_config },
 	{ .compatible = "microchip,sama7g5-gem", .data = &sama7g5_gem_config },
 	{ .compatible = "microchip,sama7g5-emac", .data = &sama7g5_emac_config },

-- 
2.43.0


  parent reply	other threads:[~2026-02-20  8:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20  8:27 [PATCH 0/5] riscv: dts: sifive: fu740: Fix compatible strings per IP versioning Max Hsu
2026-02-20  8:27 ` [PATCH 1/5] dt-bindings: net: macb: Add SiFive FU740-C000 support Max Hsu
2026-02-20  9:29   ` Conor Dooley
2026-02-20 18:42     ` Max Hsu
2026-02-20  8:27 ` [PATCH 2/5] dt-bindings: interrupt-controller: Add SiFive FU740-C000 PLIC Max Hsu
2026-02-20  9:23   ` Conor Dooley
2026-02-20 18:49     ` Max Hsu
2026-02-20 22:33       ` Conor Dooley
2026-02-20  8:27 ` Max Hsu [this message]
2026-02-20 13:13   ` [PATCH 3/5] net: macb: Add support for SiFive FU740-C000 Andrew Lunn
2026-02-20 18:35     ` Max Hsu
2026-02-20 22:00       ` Conor Dooley
2026-02-20  8:27 ` [PATCH 4/5] riscv: dts: sifive: fu740: Use correct ethernet compatible string Max Hsu
2026-02-20  8:27 ` [PATCH 5/5] riscv: dts: sifive: fu740: Use correct PLIC " Max Hsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260220-fu740-v1-3-c8af54130c58@sifive.com \
    --to=max.hsu@sifive.com \
    --cc=alex@ghiti.fr \
    --cc=andrew+netdev@lunn.ch \
    --cc=aou@eecs.berkeley.edu \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=conor+dt@kernel.org \
    --cc=conor@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=pjw@kernel.org \
    --cc=robh@kernel.org \
    --cc=samuel.holland@sifive.com \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®