linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next v4 0/4] net: ftgmac100: Add SoC reset support for RMII mode
@ 2025-07-09  7:08 Jacky Chou
  2025-07-09  7:08 ` [net-next v4 1/4] dt-bindings: net: ftgmac100: Add resets property Jacky Chou
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Jacky Chou @ 2025-07-09  7:08 UTC (permalink / raw)
  To: netdev, devicetree, linux-kernel, linux-clk, linux-arm-kernel,
	linux-aspeed, andrew+netdev, davem, edumazet, kuba, pabeni, robh,
	krzk+dt, conor+dt, joel, andrew, mturquette, sboyd, p.zabel,
	horms, jacob.e.keller, u.kleine-koenig, hkallweit1
  Cc: BMC-SW

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/2/3/4 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       | 21 ++++++++++++---
 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, 50 insertions(+), 3 deletions(-)

---
v4:
  - Added more useful commit messages to faraday,ftgmac100.yaml.
v3:
  - Fixed allOf in faraday,ftgmac100.yaml.
v2:
  - Added restriction on resets property in faraday,ftgmac100.yaml.
---

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [net-next v4 1/4] dt-bindings: net: ftgmac100: Add resets property
  2025-07-09  7:08 [net-next v4 0/4] net: ftgmac100: Add SoC reset support for RMII mode Jacky Chou
@ 2025-07-09  7:08 ` Jacky Chou
  2025-07-09  7:46   ` Krzysztof Kozlowski
  2025-07-09  7:08 ` [net-next v4 2/4] dt-bindings: clock: ast2600: Add reset definitions for MAC1 and MAC2 Jacky Chou
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Jacky Chou @ 2025-07-09  7:08 UTC (permalink / raw)
  To: netdev, devicetree, linux-kernel, linux-clk, linux-arm-kernel,
	linux-aspeed, andrew+netdev, davem, edumazet, kuba, pabeni, robh,
	krzk+dt, conor+dt, joel, andrew, mturquette, sboyd, p.zabel,
	horms, jacob.e.keller, u.kleine-koenig, hkallweit1
  Cc: BMC-SW

In Aspeed AST2600 design, the MAC internal delay on MAC register cannot
fully reset the RMII interfaces, it may cause the RMII incompletely.
Therefore, we need to add resets property to do SoC-level reset line to
reset the whole MAC function that includes ftgmac, RGMII and RMII.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
 .../bindings/net/faraday,ftgmac100.yaml       | 21 ++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
index 55d6a8379025..d14410018bcf 100644
--- a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
+++ b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
@@ -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 <ratbert@faraday-tech.com>
 
@@ -35,6 +32,9 @@ properties:
       - description: MAC IP clock
       - description: RMII RCLK gate for AST2500/2600
 
+  resets:
+    maxItems: 1
+
   clock-names:
     minItems: 1
     items:
@@ -74,6 +74,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:
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [net-next v4 2/4] dt-bindings: clock: ast2600: Add reset definitions for MAC1 and MAC2
  2025-07-09  7:08 [net-next v4 0/4] net: ftgmac100: Add SoC reset support for RMII mode Jacky Chou
  2025-07-09  7:08 ` [net-next v4 1/4] dt-bindings: net: ftgmac100: Add resets property Jacky Chou
@ 2025-07-09  7:08 ` Jacky Chou
  2025-07-09  7:08 ` [net-next v4 3/4] ARM: dts: aspeed-g6: Add resets property for MAC controllers Jacky Chou
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Jacky Chou @ 2025-07-09  7:08 UTC (permalink / raw)
  To: netdev, devicetree, linux-kernel, linux-clk, linux-arm-kernel,
	linux-aspeed, andrew+netdev, davem, edumazet, kuba, pabeni, robh,
	krzk+dt, conor+dt, joel, andrew, mturquette, sboyd, p.zabel,
	horms, jacob.e.keller, u.kleine-koenig, hkallweit1
  Cc: BMC-SW, Conor Dooley

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.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Acked-by: Stephen Boyd <sboyd@kernel.org>
---
 include/dt-bindings/clock/ast2600-clock.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/dt-bindings/clock/ast2600-clock.h b/include/dt-bindings/clock/ast2600-clock.h
index 7ae96c7bd72f..f60fff261130 100644
--- a/include/dt-bindings/clock/ast2600-clock.h
+++ b/include/dt-bindings/clock/ast2600-clock.h
@@ -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
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [net-next v4 3/4] ARM: dts: aspeed-g6: Add resets property for MAC controllers
  2025-07-09  7:08 [net-next v4 0/4] net: ftgmac100: Add SoC reset support for RMII mode Jacky Chou
  2025-07-09  7:08 ` [net-next v4 1/4] dt-bindings: net: ftgmac100: Add resets property Jacky Chou
  2025-07-09  7:08 ` [net-next v4 2/4] dt-bindings: clock: ast2600: Add reset definitions for MAC1 and MAC2 Jacky Chou
@ 2025-07-09  7:08 ` Jacky Chou
  2025-07-09  7:08 ` [net-next v4 4/4] net: ftgmac100: Add optional reset control for RMII mode on Aspeed SoCs Jacky Chou
  2025-07-11  1:20 ` [net-next v4 0/4] net: ftgmac100: Add SoC reset support for RMII mode patchwork-bot+netdevbpf
  4 siblings, 0 replies; 8+ messages in thread
From: Jacky Chou @ 2025-07-09  7:08 UTC (permalink / raw)
  To: netdev, devicetree, linux-kernel, linux-clk, linux-arm-kernel,
	linux-aspeed, andrew+netdev, davem, edumazet, kuba, pabeni, robh,
	krzk+dt, conor+dt, joel, andrew, mturquette, sboyd, p.zabel,
	horms, jacob.e.keller, u.kleine-koenig, hkallweit1
  Cc: BMC-SW

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

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
 arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi
index 8ed715bd53aa..f9fe89665e49 100644
--- a/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi
+++ b/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi
@@ -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";
 		};
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [net-next v4 4/4] net: ftgmac100: Add optional reset control for RMII mode on Aspeed SoCs
  2025-07-09  7:08 [net-next v4 0/4] net: ftgmac100: Add SoC reset support for RMII mode Jacky Chou
                   ` (2 preceding siblings ...)
  2025-07-09  7:08 ` [net-next v4 3/4] ARM: dts: aspeed-g6: Add resets property for MAC controllers Jacky Chou
@ 2025-07-09  7:08 ` Jacky Chou
  2025-07-09 13:23   ` Andrew Lunn
  2025-07-11  1:20 ` [net-next v4 0/4] net: ftgmac100: Add SoC reset support for RMII mode patchwork-bot+netdevbpf
  4 siblings, 1 reply; 8+ messages in thread
From: Jacky Chou @ 2025-07-09  7:08 UTC (permalink / raw)
  To: netdev, devicetree, linux-kernel, linux-clk, linux-arm-kernel,
	linux-aspeed, andrew+netdev, davem, edumazet, kuba, pabeni, robh,
	krzk+dt, conor+dt, joel, andrew, mturquette, sboyd, p.zabel,
	horms, jacob.e.keller, u.kleine-koenig, hkallweit1
  Cc: BMC-SW

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.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
 drivers/net/ethernet/faraday/ftgmac100.c | 26 ++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index a98d5af3f9e3..05b8e3743a79 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -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)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [net-next v4 1/4] dt-bindings: net: ftgmac100: Add resets property
  2025-07-09  7:08 ` [net-next v4 1/4] dt-bindings: net: ftgmac100: Add resets property Jacky Chou
@ 2025-07-09  7:46   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-09  7:46 UTC (permalink / raw)
  To: Jacky Chou
  Cc: netdev, devicetree, linux-kernel, linux-clk, linux-arm-kernel,
	linux-aspeed, andrew+netdev, davem, edumazet, kuba, pabeni, robh,
	krzk+dt, conor+dt, joel, andrew, mturquette, sboyd, p.zabel,
	horms, jacob.e.keller, u.kleine-koenig, hkallweit1, BMC-SW

On Wed, Jul 09, 2025 at 03:08:06PM +0800, Jacky Chou wrote:
> In Aspeed AST2600 design, the MAC internal delay on MAC register cannot
> fully reset the RMII interfaces, it may cause the RMII incompletely.
> Therefore, we need to add resets property to do SoC-level reset line to
> reset the whole MAC function that includes ftgmac, RGMII and RMII.
> 
> Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
> ---
>  .../bindings/net/faraday,ftgmac100.yaml       | 21 ++++++++++++++++---

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [net-next v4 4/4] net: ftgmac100: Add optional reset control for RMII mode on Aspeed SoCs
  2025-07-09  7:08 ` [net-next v4 4/4] net: ftgmac100: Add optional reset control for RMII mode on Aspeed SoCs Jacky Chou
@ 2025-07-09 13:23   ` Andrew Lunn
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2025-07-09 13:23 UTC (permalink / raw)
  To: Jacky Chou
  Cc: netdev, devicetree, linux-kernel, linux-clk, linux-arm-kernel,
	linux-aspeed, andrew+netdev, davem, edumazet, kuba, pabeni, robh,
	krzk+dt, conor+dt, joel, andrew, mturquette, sboyd, p.zabel,
	horms, jacob.e.keller, u.kleine-koenig, hkallweit1, BMC-SW

On Wed, Jul 09, 2025 at 03:08:09PM +0800, Jacky Chou wrote:
> 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.
> 
> Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [net-next v4 0/4] net: ftgmac100: Add SoC reset support for RMII mode
  2025-07-09  7:08 [net-next v4 0/4] net: ftgmac100: Add SoC reset support for RMII mode Jacky Chou
                   ` (3 preceding siblings ...)
  2025-07-09  7:08 ` [net-next v4 4/4] net: ftgmac100: Add optional reset control for RMII mode on Aspeed SoCs Jacky Chou
@ 2025-07-11  1:20 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-11  1:20 UTC (permalink / raw)
  To: Jacky Chou
  Cc: netdev, devicetree, linux-kernel, linux-clk, linux-arm-kernel,
	linux-aspeed, andrew+netdev, davem, edumazet, kuba, pabeni, robh,
	krzk+dt, conor+dt, joel, andrew, mturquette, sboyd, p.zabel,
	horms, jacob.e.keller, u.kleine-koenig, hkallweit1, BMC-SW

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 9 Jul 2025 15:08:05 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next,v4,1/4] dt-bindings: net: ftgmac100: Add resets property
    https://git.kernel.org/netdev/net-next/c/fc6c8af6d784
  - [net-next,v4,2/4] dt-bindings: clock: ast2600: Add reset definitions for MAC1 and MAC2
    https://git.kernel.org/netdev/net-next/c/4dc5f7b2c0cc
  - [net-next,v4,3/4] ARM: dts: aspeed-g6: Add resets property for MAC controllers
    (no matching commit)
  - [net-next,v4,4/4] net: ftgmac100: Add optional reset control for RMII mode on Aspeed SoCs
    https://git.kernel.org/netdev/net-next/c/af350ee72e9d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-07-11  1:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09  7:08 [net-next v4 0/4] net: ftgmac100: Add SoC reset support for RMII mode Jacky Chou
2025-07-09  7:08 ` [net-next v4 1/4] dt-bindings: net: ftgmac100: Add resets property Jacky Chou
2025-07-09  7:46   ` Krzysztof Kozlowski
2025-07-09  7:08 ` [net-next v4 2/4] dt-bindings: clock: ast2600: Add reset definitions for MAC1 and MAC2 Jacky Chou
2025-07-09  7:08 ` [net-next v4 3/4] ARM: dts: aspeed-g6: Add resets property for MAC controllers Jacky Chou
2025-07-09  7:08 ` [net-next v4 4/4] net: ftgmac100: Add optional reset control for RMII mode on Aspeed SoCs Jacky Chou
2025-07-09 13:23   ` Andrew Lunn
2025-07-11  1:20 ` [net-next v4 0/4] net: ftgmac100: Add SoC reset support for RMII mode patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).