Skip to contentSkip to conversation

net: ftgmac100: support fixed link

PATCH Superseded [email protected] 1 participant 3 messages Sep 6, 2022

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover net: ftgmac100: support fixed link

From: Tao Ren <[email protected]>

The patch series adds fixed link support to ftgmac100 driver.

Patch #1 adds fixed link logic into ftgmac100 driver.

Patch #2 enables mac3 controller in Elbert dts: Elbert mac3 is connected to the onboard switch BCM53134P's IMP_RGMII port directly (no PHY between BMC MAC and BCM53134P).

Tao Ren (2):
net: ftgmac100: support fixed link
ARM: dts: aspeed: elbert: Enable mac3 controller

 .../boot/dts/aspeed-bmc-facebook-elbert.dts   | 20 ++++++++++++++++
 drivers/net/ethernet/faraday/ftgmac100.c      | 24 +++++++++++++++++++
 2 files changed, 44 insertions(+)
Signature · 1 line
2.37.3
#1 lore raw

PATCH v2 1/2 net: ftgmac100: support fixed link

From: Tao Ren <[email protected]>

Support fixed link in ftgmac100 driver. Fixed link is used on several Meta OpenBMC platforms, such as Elbert (AST2620) and Wedge400 (AST2520).

---
Changes in v2: None

 drivers/net/ethernet/faraday/ftgmac100.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/net/ethernet/faraday/ftgmac100.c +24 -0
index 9277d5fb5052..da04beee5865 100644
@@ -1701,10 +1701,14 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
 
 static void ftgmac100_phy_disconnect(struct net_device *netdev)
 {
+	struct ftgmac100 *priv = netdev_priv(netdev);
+
 	if (!netdev->phydev)
 		return;
 
 	phy_disconnect(netdev->phydev);
+	if (of_phy_is_fixed_link(priv->dev->of_node))
+		of_phy_deregister_fixed_link(priv->dev->of_node);
 }
 
 static void ftgmac100_destroy_mdio(struct net_device *netdev)
@@ -1867,6 +1871,26 @@ static int ftgmac100_probe(struct platform_device *pdev)
 			err = -EINVAL;
 			goto err_phy_connect;
 		}
+	} else if (np && of_phy_is_fixed_link(np)) {
+		struct phy_device *phy;
+
+		err = of_phy_register_fixed_link(np);
+		if (err) {
+			dev_err(&pdev->dev, "Failed to register fixed PHY\n");
+			goto err_phy_connect;
+		}
+
+		phy = of_phy_get_and_connect(priv->netdev, np,
+					     &ftgmac100_adjust_link);
+		if (!phy) {
+			dev_err(&pdev->dev, "Failed to connect to fixed PHY\n");
+			of_phy_deregister_fixed_link(np);
+			err = -EINVAL;
+			goto err_phy_connect;
+		}
+
+		/* Display what we found */
+		phy_attached_info(phy);
 	} else if (np && of_get_property(np, "phy-handle", NULL)) {
 		struct phy_device *phy;
 
Signature · 1 line
2.37.3
#2 lore raw

PATCH v2 2/2 ARM: dts: aspeed: elbert: Enable mac3 controller

In reply to [email protected]

From: Tao Ren <[email protected]>

Enable mac3 controller in Elbert dts: Elbert MAC3 is connected to the BCM53134P onboard switch's IMP_RGMII port directly (fixed link, no PHY between BMC MAC and BCM53134P).

Note: BMC's mdio0 controller is connected to BCM53134P's MDIO interface for debugging purposes only: BCM53134P always loads configurations from its EEPROM, and users should not configure the switch via the MDIO interface. As a result, the MDIO connection is disabled in dts.

---
Changes in v2:
- updated comments and patch description.

 .../boot/dts/aspeed-bmc-facebook-elbert.dts   | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm/boot/dts/aspeed-bmc-facebook-elbert.dts +20 -0
index 27b43fe099f1..36657d8fdb73 100644
@@ -183,3 +183,23 @@ imux31: i2c at 7 {
 &i2c11 {
 	status = "okay";
 };
+
+/*
+ * BMC's "mac3" is connected to BCM53134P's IMP_RGMII port directly (no
+ * PHY in between).
+ * Although BMC's "mdio0" controller is connected to BCM53134P's MDIO
+ * interface, it's only for debugging purposes: BCM53134P always loads
+ * configurations from its EEPROM, and users should not configure the
+ * switch through MDIO interface in regular operations. As a result,
+ * the MDIO connection is disabled in dts.
+ */
+&mac3 {
+	status = "okay";
+	phy-mode = "rgmii";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_rgmii4_default>;
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+	};
+};
Signature · 1 line
2.37.3