Skip to content

Commit 0106424

Browse files
committed
Merge branch 'net-ftgmac100-add-soc-reset-support-for-rmii-mode'
Jacky Chou says: ==================== 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/2/3/4 reset definitions for AST2600. - Driver changes to assert/deassert the reset line as needed. This improves reliability and initialization of the MAC in RMII mode on Aspeed platforms. ==================== Link: https://patch.msgid.link/20250709070809.2560688-1-jacky_chou@aspeedtech.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 380a889 + af350ee commit 0106424

File tree

3 files changed

+46
-3
lines changed

3 files changed

+46
-3
lines changed

Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
66

77
title: Faraday Technology FTGMAC100 gigabit ethernet controller
88

9-
allOf:
10-
- $ref: ethernet-controller.yaml#
11-
129
maintainers:
1310
- Po-Yu Chuang <ratbert@faraday-tech.com>
1411

@@ -35,6 +32,9 @@ properties:
3532
- description: MAC IP clock
3633
- description: RMII RCLK gate for AST2500/2600
3734

35+
resets:
36+
maxItems: 1
37+
3838
clock-names:
3939
minItems: 1
4040
items:
@@ -74,6 +74,21 @@ required:
7474
- reg
7575
- interrupts
7676

77+
allOf:
78+
- $ref: ethernet-controller.yaml#
79+
- if:
80+
properties:
81+
compatible:
82+
contains:
83+
enum:
84+
- aspeed,ast2600-mac
85+
then:
86+
properties:
87+
resets: true
88+
else:
89+
properties:
90+
resets: false
91+
7792
unevaluatedProperties: false
7893

7994
examples:

drivers/net/ethernet/faraday/ftgmac100.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1010

1111
#include <linux/clk.h>
12+
#include <linux/reset.h>
1213
#include <linux/dma-mapping.h>
1314
#include <linux/etherdevice.h>
1415
#include <linux/ethtool.h>
@@ -101,6 +102,8 @@ struct ftgmac100 {
101102

102103
/* AST2500/AST2600 RMII ref clock gate */
103104
struct clk *rclk;
105+
/* Aspeed reset control */
106+
struct reset_control *rst;
104107

105108
/* Link management */
106109
int cur_speed;
@@ -148,6 +151,23 @@ static int ftgmac100_reset_and_config_mac(struct ftgmac100 *priv)
148151
{
149152
u32 maccr = 0;
150153

154+
/* Aspeed RMII needs SCU reset to clear status */
155+
if (priv->is_aspeed && priv->netdev->phydev->interface == PHY_INTERFACE_MODE_RMII) {
156+
int err;
157+
158+
err = reset_control_assert(priv->rst);
159+
if (err) {
160+
dev_err(priv->dev, "Failed to reset mac (%d)\n", err);
161+
return err;
162+
}
163+
usleep_range(10000, 20000);
164+
err = reset_control_deassert(priv->rst);
165+
if (err) {
166+
dev_err(priv->dev, "Failed to deassert mac reset (%d)\n", err);
167+
return err;
168+
}
169+
}
170+
151171
switch (priv->cur_speed) {
152172
case SPEED_10:
153173
case 0: /* no link */
@@ -1968,6 +1988,12 @@ static int ftgmac100_probe(struct platform_device *pdev)
19681988

19691989
}
19701990

1991+
priv->rst = devm_reset_control_get_optional_exclusive(priv->dev, NULL);
1992+
if (IS_ERR(priv->rst)) {
1993+
err = PTR_ERR(priv->rst);
1994+
goto err_phy_connect;
1995+
}
1996+
19711997
if (priv->is_aspeed) {
19721998
err = ftgmac100_setup_clk(priv);
19731999
if (err)

include/dt-bindings/clock/ast2600-clock.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@
122122
#define ASPEED_RESET_PCIE_DEV_OEN 20
123123
#define ASPEED_RESET_PCIE_RC_O 19
124124
#define ASPEED_RESET_PCIE_RC_OEN 18
125+
#define ASPEED_RESET_MAC2 12
126+
#define ASPEED_RESET_MAC1 11
125127
#define ASPEED_RESET_PCI_DP 5
126128
#define ASPEED_RESET_HACE 4
127129
#define ASPEED_RESET_AHB 1

0 commit comments

Comments
 (0)