Skip to contentSkip to conversation

net: ftgmac100: Add SoC reset support for RMII mode

PATCH Superseded Jacky Chou 2 participants 7 messages Jul 8, 2025 – Jul 9, 2025

Subsystems (5)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Jacky Chou

author
#0 lore raw

v3 cover net: ftgmac100: Add SoC reset support for RMII mode

This patch series adds support for an optional reset line to the ftgmac100 ethernet controller, as used on Aspeed SoCs. On these SoCs, the internal MAC reset is not sufficient to reset the RMII interface. By providing a SoC-level reset via the device tree "resets" property, the driver can properly reset both the MAC and RMII logic, ensuring correct operation in RMII mode.

The series includes:
- Device tree binding update to document the new "resets" property.
- Addition of MAC1 and MAC2 reset definitions for AST2600.
- Device tree changes for AST2600 to use the new reset properties.
- Driver changes to assert/deassert the reset line as needed.

This improves reliability and initialization of the MAC in RMII mode on Aspeed platforms.

Jacky Chou (4):
dt-bindings: net: ftgmac100: Add resets property
dt-bindings: clock: ast2600: Add reset definitions for MAC1 and MAC2
ARM: dts: aspeed-g6: Add resets property for MAC controllers
net: ftgmac100: Add optional reset control for RMII mode on Aspeed
SoCs

 .../bindings/net/faraday,ftgmac100.yaml       | 23 +++++++++++++---
 arch/arm/boot/dts/aspeed/aspeed-g6.dtsi       |  4 +++
 drivers/net/ethernet/faraday/ftgmac100.c      | 26 +++++++++++++++++++
 include/dt-bindings/clock/ast2600-clock.h     |  2 ++
 4 files changed, 52 insertions(+), 3 deletions(-)

---
v3:
- Fixed allOf in faraday,ftgmac100.yaml.
v2:
- Added restriction on resets property in faraday,ftgmac100.yaml.
---

Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v3 1/4 dt-bindings: net: ftgmac100: Add resets property

Add optional resets property for Aspeed SoCs to reset the MAC and RGMII/RMII.

---
 .../bindings/net/faraday,ftgmac100.yaml       | 23 ++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml +20 -3
index 55d6a8379025..a2e7d439074a 100644
@@ -6,9 +6,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: Faraday Technology FTGMAC100 gigabit ethernet controller
 
-allOf:
-  - $ref: ethernet-controller.yaml#
-
 maintainers:
   - Po-Yu Chuang <[email protected]>
 
@@ -35,6 +32,11 @@ properties:
       - description: MAC IP clock
       - description: RMII RCLK gate for AST2500/2600
 
+  resets:
+    maxItems: 1
+    description:
+      Optional reset control for the MAC controller
+
   clock-names:
     minItems: 1
     items:
@@ -74,6 +76,21 @@ required:
   - reg
   - interrupts
 
+allOf:
+  - $ref: ethernet-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - aspeed,ast2600-mac
+    then:
+      properties:
+        resets: true
+    else:
+      properties:
+        resets: false
+
 unevaluatedProperties: false
 
 examples:
Signature · 1 line
2.34.1
#2 lore raw

Re: [net-next v3 1/4] dt-bindings: net: ftgmac100: Add resets property

Quoted 1 line · Jacky Chou

Add optional resets property for Aspeed SoCs to reset the MAC and

s/Aspeed SoCs/Aspeed AST2600 SoCs/

Quoted 1 line

RGMII/RMII.

... because ? It was missing? Incomplete? You changed hardware?

Make the commits useful, explain WHY you are doing, not repeating WHAT you are doing. What is obvious from the diff. You already got this feedback with other patches.

Quoted 21 lines
---
 .../bindings/net/faraday,ftgmac100.yaml       | 23 ++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml +0 -3
index 55d6a8379025..a2e7d439074a 100644
@@ -6,9 +6,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: Faraday Technology FTGMAC100 gigabit ethernet controller
 
-allOf:
-  - $ref: ethernet-controller.yaml#
-
 maintainers:
   - Po-Yu Chuang <[email protected]>
 

Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml properties: · line 38

Quoted 7 lines
Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml +4 -0
@@ -35,6 +32,11 @@ properties:
       - description: MAC IP clock
       - description: RMII RCLK gate for AST2500/2600
 
+  resets:
+    maxItems: 1
+    description:
+      Optional reset control for the MAC controller

Drop description, redundant and obvious form the schema. It cannot be a reset for anything else than MAC controller, because this is the MAC controller. It cannot be "non optional" because schema says it is optional.

Write concise and USEFUL descriptions/commit messages, not just something to satisfy line/patch count.

Best regards,
Krzysztof

author
#3 lore raw

回覆: [net-next v3 1/4] dt-bindings: net: ftgmac100: Add resets property

Hi Krzysztof

Thank you for your reply.

Quoted 4 lines
Quoted 1 line

Add optional resets property for Aspeed SoCs to reset the MAC and

s/Aspeed SoCs/Aspeed AST2600 SoCs/

Quoted 8 lines
Quoted 1 line

RGMII/RMII.

... because ? It was missing? Incomplete? You changed hardware?

Make the commits useful, explain WHY you are doing, not repeating WHAT you are doing. What is obvious from the diff. You already got this feedback with other patches.

Agreed.
Got it. I will add more commit message to describe why we do that and what we do.

Quoted 37 lines
Quoted 4 lines
---
 .../bindings/net/faraday,ftgmac100.yaml       | 23

++++++++++++++++---

Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml $schema:

Quoted 9 lines
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml index 55d6a8379025..a2e7d439074a 100644

Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml +0 -0
@@ -6,9 +6,6 @@ $schema:

http://devicetree.org/meta-schemas/core.yaml#

Quoted 10 lines
Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml +0 -3
 title: Faraday Technology FTGMAC100 gigabit ethernet controller
 
-allOf:
-  - $ref: ethernet-controller.yaml#
-
 maintainers:
   - Po-Yu Chuang <[email protected]>
 

Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml properties: · line 38

Quoted 7 lines
Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml +4 -0
@@ -35,6 +32,11 @@ properties:
       - description: MAC IP clock
       - description: RMII RCLK gate for AST2500/2600
 
+  resets:
+    maxItems: 1
+    description:
+      Optional reset control for the MAC controller

Drop description, redundant and obvious form the schema. It cannot be a reset for anything else than MAC controller, because this is the MAC controller. It cannot be "non optional" because schema says it is optional.

Quoted 2 lines

Write concise and USEFUL descriptions/commit messages, not just something to satisfy line/patch count.

Agreed.
I will adjust this part to meet schema.

Thanks,
Jacky

author
#4 lore raw

PATCH v3 2/4 dt-bindings: clock: ast2600: Add reset definitions for MAC1 and MAC2

In reply to Jacky Chou

Add ASPEED_RESET_MAC1 and ASPEED_RESET_MAC2 reset definitions to the ast2600-clock binding header. These are required for proper reset control of the MAC1 and MAC2 ethernet controllers on the AST2600 SoC.

---
 include/dt-bindings/clock/ast2600-clock.h | 2 ++
 1 file changed, 2 insertions(+)
include/dt-bindings/clock/ast2600-clock.h +2 -0
index 7ae96c7bd72f..f60fff261130 100644
@@ -122,6 +122,8 @@
 #define ASPEED_RESET_PCIE_DEV_OEN	20
 #define ASPEED_RESET_PCIE_RC_O		19
 #define ASPEED_RESET_PCIE_RC_OEN	18
+#define ASPEED_RESET_MAC2		12
+#define ASPEED_RESET_MAC1		11
 #define ASPEED_RESET_PCI_DP		5
 #define ASPEED_RESET_HACE		4
 #define ASPEED_RESET_AHB		1
Signature · 1 line
2.34.1
author
#5 lore raw

PATCH v3 3/4 ARM: dts: aspeed-g6: Add resets property for MAC controllers

In reply to Jacky Chou

Add the "resets" property to the MAC nodes in the AST2600 device tree, using the appropriate ASPEED_RESET_MACx definitions.

---
 arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/aspeed/aspeed-g6.dtsi +4 -0
index 8ed715bd53aa..f9fe89665e49 100644
@@ -236,6 +236,7 @@ mac0: ethernet@1e660000 {
 			reg = <0x1e660000 0x180>;
 			interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&syscon ASPEED_CLK_GATE_MAC1CLK>;
+			resets = <&syscon ASPEED_RESET_MAC1>;
 			status = "disabled";
 		};
 
@@ -244,6 +245,7 @@ mac1: ethernet@1e680000 {
 			reg = <0x1e680000 0x180>;
 			interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&syscon ASPEED_CLK_GATE_MAC2CLK>;
+			resets = <&syscon ASPEED_RESET_MAC2>;
 			status = "disabled";
 		};
 
@@ -252,6 +254,7 @@ mac2: ethernet@1e670000 {
 			reg = <0x1e670000 0x180>;
 			interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&syscon ASPEED_CLK_GATE_MAC3CLK>;
+			resets = <&syscon ASPEED_RESET_MAC3>;
 			status = "disabled";
 		};
 
@@ -260,6 +263,7 @@ mac3: ethernet@1e690000 {
 			reg = <0x1e690000 0x180>;
 			interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&syscon ASPEED_CLK_GATE_MAC4CLK>;
+			resets = <&syscon ASPEED_RESET_MAC4>;
 			status = "disabled";
 		};
 
Signature · 1 line
2.34.1
author
#6 lore raw

PATCH v3 4/4 net: ftgmac100: Add optional reset control for RMII mode on Aspeed SoCs

In reply to Jacky Chou

On Aspeed SoCs, the internal MAC reset is insufficient to fully reset the RMII interface; only the SoC-level reset line can properly reset the RMII logic. This patch adds support for an optional "resets" property in the device tree, allowing the driver to assert and deassert the SoC reset line when operating in RMII mode. This ensures the MAC and RMII interface are correctly reset and initialized.

---
 drivers/net/ethernet/faraday/ftgmac100.c | 26 ++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/net/ethernet/faraday/ftgmac100.c +26 -0
index a98d5af3f9e3..05b8e3743a79 100644
@@ -9,6 +9,7 @@
 #define pr_fmt(fmt)	KBUILD_MODNAME ": " fmt
 
 #include <linux/clk.h>
+#include <linux/reset.h>
 #include <linux/dma-mapping.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
@@ -101,6 +102,8 @@ struct ftgmac100 {
 
 	/* AST2500/AST2600 RMII ref clock gate */
 	struct clk *rclk;
+	/* Aspeed reset control */
+	struct reset_control *rst;
 
 	/* Link management */
 	int cur_speed;
@@ -148,6 +151,23 @@ static int ftgmac100_reset_and_config_mac(struct ftgmac100 *priv)
 {
 	u32 maccr = 0;
 
+	/* Aspeed RMII needs SCU reset to clear status */
+	if (priv->is_aspeed && priv->netdev->phydev->interface == PHY_INTERFACE_MODE_RMII) {
+		int err;
+
+		err = reset_control_assert(priv->rst);
+		if (err) {
+			dev_err(priv->dev, "Failed to reset mac (%d)\n", err);
+			return err;
+		}
+		usleep_range(10000, 20000);
+		err = reset_control_deassert(priv->rst);
+		if (err) {
+			dev_err(priv->dev, "Failed to deassert mac reset (%d)\n", err);
+			return err;
+		}
+	}
+
 	switch (priv->cur_speed) {
 	case SPEED_10:
 	case 0: /* no link */
@@ -1968,6 +1988,12 @@ static int ftgmac100_probe(struct platform_device *pdev)
 
 	}
 
+	priv->rst = devm_reset_control_get_optional_exclusive(priv->dev, NULL);
+	if (IS_ERR(priv->rst)) {
+		err = PTR_ERR(priv->rst);
+		goto err_phy_connect;
+	}
+
 	if (priv->is_aspeed) {
 		err = ftgmac100_setup_clk(priv);
 		if (err)
Signature · 1 line
2.34.1