Skip to contentSkip to conversation

net: stmmac: Add NCSI support for STMMAC

PATCH In review Tomer Maimon 2 participants 3 messages Jul 9, 2024 – Jul 16, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: stmmac: Add NCSI support for STMMAC

Add NCSI support for STMMAC.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |   2 +
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 196 ++++++++++++------
 .../ethernet/stmicro/stmmac/stmmac_platform.c |  27 ++-
 include/linux/stmmac.h                        |   1 +
 4 files changed, 158 insertions(+), 68 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac.h +2 -0
index b8c93b881a65..02db099e29b2 100644
@@ -332,6 +332,8 @@ struct stmmac_priv {
 	/* XDP BPF Program */
 	unsigned long *af_xdp_zc_qps;
 	struct bpf_prog *xdp_prog;
+
+	struct ncsi_dev *ncsidev;
 };
 
 enum stmmac_state {
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +135 -61

301 lines not on this page · raw message

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +20 -7
index 30d5e635190e..8865a74b6f32 100644
@@ -417,17 +417,30 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
 		eth_zero_addr(mac);
 	}
 
-	phy_mode = device_get_phy_mode(&pdev->dev);
-	if (phy_mode < 0)
-		return ERR_PTR(phy_mode);
+	if (of_get_property(pdev->dev.of_node, "use-ncsi", NULL)) {
+		plat->use_ncsi = true;
+		plat->has_xgmac = 0;
+		plat->has_gmac4 = 0;
+		plat->has_gmac = 0;
+	}
+	else
+		plat->use_ncsi = false;
 
-	plat->phy_interface = phy_mode;
+	if (!plat->use_ncsi) {
+		phy_mode = device_get_phy_mode(&pdev->dev);
+		if (phy_mode < 0)
+			return ERR_PTR(phy_mode);
+
+		plat->phy_interface = phy_mode;
+	}
 	rc = stmmac_of_get_mac_mode(np);
 	plat->mac_interface = rc < 0 ? plat->phy_interface : rc;
 
-	/* Some wrapper drivers still rely on phy_node. Let's save it while
-	 * they are not converted to phylink. */
-	plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
+	if (!plat->use_ncsi) {
+		/* Some wrapper drivers still rely on phy_node. Let's save it while
+		 * they are not converted to phylink. */
+		plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
+	}
 
 	/* PHYLINK automatically parses the phy-handle property */
 	plat->port_node = of_fwnode_handle(np);
include/linux/stmmac.h +1 -0
index 5acb77968902..3e948e685ada 100644
@@ -285,6 +285,7 @@ struct plat_stmmacenet_data {
 			   void *ctx);
 	void (*dump_debug_regs)(void *priv);
 	void *bsp_priv;
+	int use_ncsi;
 	struct clk *stmmac_clk;
 	struct clk *pclk;
 	struct clk *clk_ptp_ref;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 10 lines · Tomer Maimon

Add NCSI support for STMMAC.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |   2 +
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 196 ++++++++++++------
 .../ethernet/stmicro/stmmac/stmmac_platform.c |  27 ++-
 include/linux/stmmac.h                        |   1 +
 4 files changed, 158 insertions(+), 68 deletions(-)

What's the state of this patch with respect to upstream? Is this something specific to the openbmc/linux dev-6.6 tree, or is there an upstream equivalent? If the latter, can you please link to the relevant patch?

Andrew

#2 lore raw

Hi Andrew,

Quoted 13 lines · Andrew Jeffery
Quoted 10 lines · Tomer Maimon

Add NCSI support for STMMAC.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |   2 +
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 196 ++++++++++++------
 .../ethernet/stmicro/stmmac/stmmac_platform.c |  27 ++-
 include/linux/stmmac.h                        |   1 +
 4 files changed, 158 insertions(+), 68 deletions(-)
Quoted 4 lines

What's the state of this patch with respect to upstream? Is this something specific to the openbmc/linux dev-6.6 tree, or is there an upstream equivalent? If the latter, can you please link to the relevant patch?

This patch set hasn't been upstream yet to OpenBMC vanilla and Its not specific to openbmc/linux dev-6.6 tree.
We plan to upstream it to Linux version 6.11 (I believe it the next few weeks), since we need to upgrade the NPCM from dev-6.1 to dev-6.6, we would appreciate if you could add it now to dev-6.6

Quoted 2 lines

Andrew

Thanks,

Tomer