Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v6 0/7] net: ftgmac100: Add AST2700 support
@ 2026-11-12  8:39 Jacky Chou
  2026-11-12  8:39 ` [PATCH net-next v6 1/7] dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone Jacky Chou
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Jacky Chou @ 2026-11-12  8:39 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Po-Yu Chuang,
	Eric Dumazet, Heiner Kallweit, Russell King, Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, Jacky Chou, Andrew Lunn

Add the pieces needed for the FTGMAC100 driver to run on Aspeed AST2700
systems.

AST2700 keeps using the FTGMAC100 MAC IP, but the enablement is not
limited to a new compatible string. The SoC can boot with the MAC on
ARM64, needs the Aspeed-specific RMII mode bit programmed when a port is
wired for RMII, and requires the driver to use the upper DMA address
fields in the ring base registers and packet descriptors. Those fields
expose a 35-bit DMA address range on AST2700, so the driver must request
a mask that matches the address bits the hardware can encode.

The series first documents and wires up the aspeed,ast2700-mac
compatible. It then treats AST2700 as an Aspeed MAC in the driver,
enables the RMII mode programming, writes the AST2700 high descriptor-ring
base registers, carries the RX/TX descriptor high address bits, rebuilds
full DMA addresses before unmapping buffers, and requests a 35-bit DMA
mask. The high ring base registers are only touched for AST2700 so older
Aspeed device tree register windows remain unchanged. With that in place,
the FTGMAC100 Kconfig entry can be made available on ARM64 while keeping
the existing Aspeed MDIO dependency for AST2600 and newer ARCH_ASPEED
systems.

RGMII delay is configured at the bootloader stage, the same way it is
handled for AST2600, not by this driver. Aspeed's SDK bootloader
configures both AST2600 and AST2700 boards with the RGMII delay
disabled and advertises "phy-mode = rgmii-id" to match, mirroring the
OpenBMC bootloader change that stopped inserting delays on AST2600 so
its device trees could use the correct "rgmii-id" setting. On AST2700,
every on-chip MAC is likewise configured by the bootloader with RGMII
delay disabled and "rgmii-id" phy-mode. Because the delay is already
resolved before Linux boots, the ftgmac100 driver does not need to
program any RGMII delay for either AST2600 or AST2700.

This series has been validated on AST2700 EVB and AST2600 EVB.

Patch layout:
- patch 1 makes the existing aspeed,ast2400-mac, aspeed,ast2500-mac,
  and aspeed,ast2600-mac compatibles standalone, dropping the
  requirement to pair them with the generic "faraday,ftgmac100"
  fallback compatible, and constrains the clocks/clock-names properties
  per compatible instead of leaving them generically optional.
- patch 2 adds the aspeed,ast2700-mac compatible to the binding, with
  its RMII RCLK gate, reset support, the "phy-mode" requirement, and
  extends the clocks/clock-names validation to cover it as well.
- patch 3 adds the AST2700 match data and OF compatible.
- patch 4 programs the AST2700 RMII enable bit and documents why
  netdev->phydev can never be NULL at that point for AST2700.
- patch 5 makes "phy-mode" a required device tree property for AST2700
  and fails probe if it is missing.
- patch 6 adds AST2700 upper DMA address handling for rings and
  descriptors.
- patch 7 enables the Faraday/FTGMAC100 Kconfig options on ARM64 and
  selects MDIO_ASPEED for ARCH_ASPEED.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
Changes in v6:
- Constrain the clocks and clock-names properties per compatible in the
  devicetree binding instead of leaving them generically optional:
  aspeed,ast2400-mac takes exactly one clock, aspeed,ast2500-mac/
  aspeed,ast2600-mac/aspeed,ast2700-mac take one or two, and the plain
  faraday,ftgmac100 compatible takes none. Require clock-names whenever
  two clocks are listed. Split across patch 1 (base rule) and patch 2
  (extended to AST2700), matching how the compatible additions
  themselves are already split.
- Simplify the compatible schema from oneOf: [const: faraday,ftgmac100,
  enum: [...]] to a single flat enum, since neither branch needs
  multi-string matching.
- Drop Reviewed-by from Rob Herring on patch 2 since its content
  changed again.
- Link to v5: https://lore.kernel.org/r/20261104-support_ast2700-v5-0-44057f4dde75@aspeedtech.com

Changes in v5:
- Pick up Reviewed-by from Rob Herring on the AST2700 binding
  patch.
- Link to v4: https://lore.kernel.org/r/20261020-support_ast2700-v4-0-4d36b40939b3@aspeedtech.com

Changes in v4:
- Split the dt-bindings patch into two: one making the existing
  aspeed,ast2400-mac, aspeed,ast2500-mac, and aspeed,ast2600-mac
  compatibles standalone, and a second adding the new
  aspeed,ast2700-mac compatible, per review feedback that these are
  two separate concerns.
- Link to v3: https://lore.kernel.org/r/20261015-support_ast2700-v3-0-8d7999171ac4@aspeedtech.com

Changes in v3:
- Require "phy-mode" in the devicetree binding when the AST2700
  compatible is used, matching the driver's probe-time requirement
  added in v2.
- Drop the "faraday,ftgmac100" fallback compatible requirement for
  AST2700; "aspeed,ast2700-mac" now stands on its own in the binding,
  matching how the driver already matches it independently.
- Drop the same "faraday,ftgmac100" fallback requirement for
  aspeed,ast2400-mac, aspeed,ast2500-mac, and aspeed,ast2600-mac as
  well, per review feedback. The same EDORR/EDOTR bit mismatch applies
  to all of them if a node ever bound through the generic
  faraday,ftgmac100 entry alone; there is no evidence this has ever
  happened in practice since ftgmac100_of_match[] has had dedicated
  entries for these SoCs since commit 03a2aba50b2c, but keeping the
  binding correct avoids leaving the same landmine in place. Folded
  into this series rather than sent as a follow-up, to avoid
  self-conflicting with a later series touching the same "compatible"
  block. Note this makes `make dtbs_check` warn against
  arch/arm/boot/dts/aspeed/aspeed-g4.dtsi, aspeed-g5.dtsi, and
  aspeed-g6.dtsi, which still declare the two-string compatible; that
  .dtsi change will be sent separately through the Aspeed/arm-soc tree,
  since dt-bindings changes don't go through that tree.
- Document in the RMII-enable patch why netdev->phydev is always
  non-NULL by the time ftgmac100_start_hw() checks phydev->interface
  for AST2700: ftgmac100_probe_dt() always attaches a phy_device
  before register_netdev() can succeed, via a discrete PHY
  (phy-handle), a fixed-link node, or NC-SI's internal fixed 100Mbit
  PHY, and any failure in that setup aborts probe first.
- Drop Reviewed-by from Krzysztof Kozlowski on the dt-bindings patch
  since its content changed.
- Link to v2: https://lore.kernel.org/r/20261006-support_ast2700-v2-0-36de51fb8066@aspeedtech.com

Changes in v2:
- Make "phy-mode" a required device tree property for AST2700 and fail
  probe if it is missing, instead of silently defaulting to RGMII.
- Document in the cover letter how RGMII delay is configured at the
  bootloader stage for AST2600 and AST2700.
- Simplify the MDIO_ASPEED Kconfig select to ARCH_ASPEED only, dropping
  the redundant MACH_ASPEED_G6 condition, and update its help text to
  mention AST2700.
- Pick up Reviewed-by from Krzysztof Kozlowski on the dt-bindings patch.
- Link to v1: https://lore.kernel.org/r/20260927-support_ast2700-v1-0-9f03f29d2c82@aspeedtech.com

---
Jacky Chou (7):
      dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone
      dt-bindings: net: ftgmac100: Add AST2700 compatible
      net: ftgmac100: Add AST2700 compatible support
      net: ftgmac100: Enable AST2700 RMII support
      net: ftgmac100: Require phy-mode for AST2700
      net: ftgmac100: Add AST2700 upper DMA address support
      net: ftgmac100: Allow building on ARM64

 .../devicetree/bindings/net/faraday,ftgmac100.yaml | 85 ++++++++++++++++---
 drivers/net/ethernet/faraday/Kconfig               |  7 +-
 drivers/net/ethernet/faraday/ftgmac100.c           | 98 +++++++++++++++++++---
 drivers/net/ethernet/faraday/ftgmac100.h           |  7 ++
 drivers/net/mdio/Kconfig                           | 16 ++--
 5 files changed, 180 insertions(+), 33 deletions(-)
---
base-commit: c88fd6989aea9237a60a4859139a265bfb7ddc0b
change-id: 20260623-support_ast2700-68fb164da45c

Best regards,
-- 
Jacky Chou <jacky_chou@aspeedtech.com>


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

* [PATCH net-next v6 1/7] dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone
  2026-11-12  8:39 [PATCH net-next v6 0/7] net: ftgmac100: Add AST2700 support Jacky Chou
@ 2026-11-12  8:39 ` Jacky Chou
  2026-11-12 18:43   ` Conor Dooley
  2026-11-16 13:54   ` netdev-bot+sashiko
  2026-11-12  8:39 ` [PATCH net-next v6 2/7] dt-bindings: net: ftgmac100: Add AST2700 compatible Jacky Chou
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 17+ messages in thread
From: Jacky Chou @ 2026-11-12  8:39 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Po-Yu Chuang,
	Eric Dumazet, Heiner Kallweit, Russell King, Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, Jacky Chou

The aspeed,ast2400-mac, aspeed,ast2500-mac, and aspeed,ast2600-mac
compatibles are currently only valid when paired with the generic
"faraday,ftgmac100" fallback: if a node ever bound through the
generic entry alone, ftgmac100_probe() would set
rxdes0_edorr_mask/txdes0_edotr_mask to BIT(15) instead of the Aspeed
BIT(30), skip Aspeed clock setup, and leave the DMA mask too narrow.

Make each of them a standalone compatible instead, so none of the
Aspeed compatibles require the generic fallback alongside them.

Now that the Aspeed compatibles no longer need the generic fallback,
also constrain the clocks and clock-names properties per compatible
instead of leaving them generically optional: aspeed,ast2400-mac takes
exactly one clock, aspeed,ast2500-mac and aspeed,ast2600-mac take one
or two, and the plain faraday,ftgmac100 compatible takes none. Require
clock-names whenever two clocks are listed.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>

---
ftgmac100_of_match[] has had dedicated entries for AST2400, AST2500,
and AST2600 since commit 03a2aba50b2c ("net: ftgmac100: List all
compatibles"), so there is no known kernel + devicetree combination
where a node has actually bound through the generic entry and gotten
the wrong EDORR bit. This part is a binding correctness fix, not a fix
for an observed failure.

Note that arch/arm/boot/dts/aspeed/aspeed-g4.dtsi, aspeed-g5.dtsi, and
aspeed-g6.dtsi still declare their MAC nodes with the two-string
"aspeed,astXXXX-mac", "faraday,ftgmac100" compatible, so this will make
dtbs_check warn against those files until the redundant fallback
compatible is dropped there as well. That .dtsi change will be sent as
a separate series through the Aspeed/arm-soc tree, since dt-bindings
changes don't go through that tree.
---
 .../devicetree/bindings/net/faraday,ftgmac100.yaml | 71 +++++++++++++++++++---
 1 file changed, 61 insertions(+), 10 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
index d14410018bcf..9d352e3686aa 100644
--- a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
+++ b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
@@ -11,14 +11,11 @@ maintainers:
 
 properties:
   compatible:
-    oneOf:
-      - const: faraday,ftgmac100
-      - items:
-          - enum:
-              - aspeed,ast2400-mac
-              - aspeed,ast2500-mac
-              - aspeed,ast2600-mac
-          - const: faraday,ftgmac100
+    enum:
+      - faraday,ftgmac100
+      - aspeed,ast2400-mac
+      - aspeed,ast2500-mac
+      - aspeed,ast2600-mac
 
   reg:
     maxItems: 1
@@ -88,22 +85,76 @@ allOf:
     else:
       properties:
         resets: false
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: aspeed,ast2400-mac
+    then:
+      properties:
+        clocks:
+          maxItems: 1
+        clock-names:
+          maxItems: 1
+      required:
+        - clocks
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - aspeed,ast2500-mac
+              - aspeed,ast2600-mac
+    then:
+      properties:
+        clocks:
+          minItems: 1
+          maxItems: 2
+        clock-names:
+          minItems: 1
+          maxItems: 2
+      required:
+        - clocks
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - aspeed,ast2400-mac
+                - aspeed,ast2500-mac
+                - aspeed,ast2600-mac
+    then:
+      properties:
+        clocks: false
+        clock-names: false
+  - if:
+      properties:
+        clocks:
+          minItems: 2
+    then:
+      required:
+        - clock-names
 
 unevaluatedProperties: false
 
 examples:
   - |
+    #include <dt-bindings/clock/aspeed-clock.h>
+
     ethernet@1e660000 {
-        compatible = "aspeed,ast2500-mac", "faraday,ftgmac100";
+        compatible = "aspeed,ast2500-mac";
         reg = <0x1e660000 0x180>;
         interrupts = <2>;
+        clocks = <&syscon ASPEED_CLK_GATE_MAC1CLK>;
         use-ncsi;
     };
 
     ethernet@1e680000 {
-        compatible = "aspeed,ast2500-mac", "faraday,ftgmac100";
+        compatible = "aspeed,ast2500-mac";
         reg = <0x1e680000 0x180>;
         interrupts = <2>;
+        clocks = <&syscon ASPEED_CLK_GATE_MAC2CLK>;
 
         phy-handle = <&phy>;
         phy-mode = "rgmii";

-- 
2.34.1


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

* [PATCH net-next v6 2/7] dt-bindings: net: ftgmac100: Add AST2700 compatible
  2026-11-12  8:39 [PATCH net-next v6 0/7] net: ftgmac100: Add AST2700 support Jacky Chou
  2026-11-12  8:39 ` [PATCH net-next v6 1/7] dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone Jacky Chou
@ 2026-11-12  8:39 ` Jacky Chou
  2026-11-12 18:44   ` Conor Dooley
  2026-11-16 13:54   ` netdev-bot+sashiko
  2026-11-12  8:39 ` [PATCH net-next v6 3/7] net: ftgmac100: Add AST2700 compatible support Jacky Chou
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 17+ messages in thread
From: Jacky Chou @ 2026-11-12  8:39 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Po-Yu Chuang,
	Eric Dumazet, Heiner Kallweit, Russell King, Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, Jacky Chou

Add AST2700 to the FTGMAC100 compatible list and document that its
RMII RCLK gate matches the earlier Aspeed SoCs. Allow the reset line
for AST2700 as it follows the same reset requirements as AST2600.

Require "phy-mode" to be present in the device tree when the AST2700
compatible is used, matching the driver's probe-time requirement.

Add aspeed,ast2700-mac as a standalone compatible, consistent with
the other Aspeed compatibles.

Extend the per-compatible clocks/clock-names validation to also cover
AST2700, since it shares the same one-or-two-clock layout as
AST2500/2600.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
 .../devicetree/bindings/net/faraday,ftgmac100.yaml         | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
index 9d352e3686aa..613d4f1caa4f 100644
--- a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
+++ b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
@@ -16,6 +16,7 @@ properties:
       - aspeed,ast2400-mac
       - aspeed,ast2500-mac
       - aspeed,ast2600-mac
+      - aspeed,ast2700-mac
 
   reg:
     maxItems: 1
@@ -27,7 +28,7 @@ properties:
     minItems: 1
     items:
       - description: MAC IP clock
-      - description: RMII RCLK gate for AST2500/2600
+      - description: RMII RCLK gate for AST2500/2600/2700
 
   resets:
     maxItems: 1
@@ -79,12 +80,21 @@ allOf:
           contains:
             enum:
               - aspeed,ast2600-mac
+              - aspeed,ast2700-mac
     then:
       properties:
         resets: true
     else:
       properties:
         resets: false
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: aspeed,ast2700-mac
+    then:
+      required:
+        - phy-mode
   - if:
       properties:
         compatible:
@@ -105,6 +115,7 @@ allOf:
             enum:
               - aspeed,ast2500-mac
               - aspeed,ast2600-mac
+              - aspeed,ast2700-mac
     then:
       properties:
         clocks:
@@ -124,6 +135,7 @@ allOf:
                 - aspeed,ast2400-mac
                 - aspeed,ast2500-mac
                 - aspeed,ast2600-mac
+                - aspeed,ast2700-mac
     then:
       properties:
         clocks: false

-- 
2.34.1


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

* [PATCH net-next v6 3/7] net: ftgmac100: Add AST2700 compatible support
  2026-11-12  8:39 [PATCH net-next v6 0/7] net: ftgmac100: Add AST2700 support Jacky Chou
  2026-11-12  8:39 ` [PATCH net-next v6 1/7] dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone Jacky Chou
  2026-11-12  8:39 ` [PATCH net-next v6 2/7] dt-bindings: net: ftgmac100: Add AST2700 compatible Jacky Chou
@ 2026-11-12  8:39 ` Jacky Chou
  2026-11-16 13:54   ` netdev-bot+sashiko
  2026-11-12  8:39 ` [PATCH net-next v6 4/7] net: ftgmac100: Enable AST2700 RMII support Jacky Chou
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Jacky Chou @ 2026-11-12  8:39 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Po-Yu Chuang,
	Eric Dumazet, Heiner Kallweit, Russell King, Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, Jacky Chou, Andrew Lunn

Add match data for the Aspeed AST2700 FTGMAC100 controller and wire
its compatible string into the OF match table. This lets AST2700 device
tree nodes bind to the ftgmac100 driver.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
 drivers/net/ethernet/faraday/ftgmac100.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 6d2fe5c2f390..67b1fa464a42 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -37,7 +37,8 @@ enum ftgmac100_mac_id {
 	FTGMAC100_FARADAY = 1,
 	FTGMAC100_AST2400,
 	FTGMAC100_AST2500,
-	FTGMAC100_AST2600
+	FTGMAC100_AST2600,
+	FTGMAC100_AST2700
 };
 
 struct ftgmac100_match_data {
@@ -2017,7 +2018,8 @@ static int ftgmac100_probe(struct platform_device *pdev)
 
 	if (priv->mac_id == FTGMAC100_AST2400 ||
 	    priv->mac_id == FTGMAC100_AST2500 ||
-	    priv->mac_id == FTGMAC100_AST2600) {
+	    priv->mac_id == FTGMAC100_AST2600 ||
+	    priv->mac_id == FTGMAC100_AST2700) {
 		priv->rxdes0_edorr_mask = BIT(30);
 		priv->txdes0_edotr_mask = BIT(30);
 		priv->is_aspeed = true;
@@ -2131,6 +2133,10 @@ static const struct ftgmac100_match_data ftgmac100_match_data_ast2600 = {
 	.mac_id = FTGMAC100_AST2600
 };
 
+static const struct ftgmac100_match_data ftgmac100_match_data_ast2700 = {
+	.mac_id = FTGMAC100_AST2700
+};
+
 static const struct ftgmac100_match_data ftgmac100_match_data_faraday = {
 	.mac_id = FTGMAC100_FARADAY
 };
@@ -2142,6 +2148,8 @@ static const struct of_device_id ftgmac100_of_match[] = {
 	  .data = &ftgmac100_match_data_ast2500 },
 	{ .compatible = "aspeed,ast2600-mac",
 	  .data = &ftgmac100_match_data_ast2600 },
+	{ .compatible = "aspeed,ast2700-mac",
+	  .data = &ftgmac100_match_data_ast2700 },
 	{ .compatible = "faraday,ftgmac100",
 	  .data = &ftgmac100_match_data_faraday },
 	{ }

-- 
2.34.1


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

* [PATCH net-next v6 4/7] net: ftgmac100: Enable AST2700 RMII support
  2026-11-12  8:39 [PATCH net-next v6 0/7] net: ftgmac100: Add AST2700 support Jacky Chou
                   ` (2 preceding siblings ...)
  2026-11-12  8:39 ` [PATCH net-next v6 3/7] net: ftgmac100: Add AST2700 compatible support Jacky Chou
@ 2026-11-12  8:39 ` Jacky Chou
  2026-11-16 13:54   ` netdev-bot+sashiko
  2026-11-12  8:39 ` [PATCH net-next v6 5/7] net: ftgmac100: Require phy-mode for AST2700 Jacky Chou
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Jacky Chou @ 2026-11-12  8:39 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Po-Yu Chuang,
	Eric Dumazet, Heiner Kallweit, Russell King, Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, Jacky Chou

Set the RMII enable bit when an AST2700 port uses RMII so the MAC is
programmed for the selected interface mode. Describe the requirement as
a match-data quirk instead of checking the MAC generation in the data
path, allowing later compatible controllers to opt into the behavior.

phydev is always populated by the time this runs: ftgmac100_start_hw()
is only reached once the device has been opened, and
ftgmac100_probe_dt() always attaches a phy_device before
register_netdev() can succeed -- via a discrete PHY ("phy-handle"), a
"fixed-link" node, or NC-SI's internal fixed 100Mbit PHY
(ftgmac100_probe_ncsi()). Any failure in that setup aborts probe before
register_netdev(), so an opened AST2700 netdev always has phydev set.
This mirrors the same assumption ftgmac100_reset_and_config_mac()
already makes for every Aspeed SoC earlier in the open path.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
 drivers/net/ethernet/faraday/ftgmac100.c | 21 +++++++++++++++++++--
 drivers/net/ethernet/faraday/ftgmac100.h |  1 +
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 67b1fa464a42..9b7becb01726 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -41,8 +41,11 @@ enum ftgmac100_mac_id {
 	FTGMAC100_AST2700
 };
 
+#define FTGMAC100_QUIRK_RMII_ENABLE	BIT(0)
+
 struct ftgmac100_match_data {
 	enum ftgmac100_mac_id mac_id;
+	u32 quirks;
 };
 
 /* Arbitrary values, I am not sure the HW has limits */
@@ -79,6 +82,7 @@ struct ftgmac100 {
 	void __iomem *base;
 
 	enum ftgmac100_mac_id mac_id;
+	u32 quirks;
 
 	/* Rx ring */
 	unsigned int rx_q_entries;
@@ -355,6 +359,12 @@ static void ftgmac100_init_hw(struct ftgmac100 *priv)
 static void ftgmac100_start_hw(struct ftgmac100 *priv)
 {
 	u32 maccr = ioread32(priv->base + FTGMAC100_OFFSET_MACCR);
+	/*
+	 * Only reached once the device is open, so a phy_device is already
+	 * attached: a discrete PHY via "phy-handle", a "fixed-link" node, or
+	 * NC-SI's internal fixed 100M PHY.
+	 */
+	struct phy_device *phydev = priv->netdev->phydev;
 
 	/* Keep the original GMAC and FAST bits */
 	maccr &= (FTGMAC100_MACCR_FAST_MODE | FTGMAC100_MACCR_GIGA_MODE);
@@ -383,6 +393,11 @@ static void ftgmac100_start_hw(struct ftgmac100 *priv)
 	if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
 		maccr |= FTGMAC100_MACCR_RM_VLAN;
 
+	if ((priv->quirks & FTGMAC100_QUIRK_RMII_ENABLE) &&
+	    phydev->interface == PHY_INTERFACE_MODE_RMII) {
+		maccr |= FTGMAC100_MACCR_RMII_ENABLE;
+	}
+
 	/* Hit the HW */
 	iowrite32(maccr, priv->base + FTGMAC100_OFFSET_MACCR);
 }
@@ -1942,7 +1957,7 @@ static int ftgmac100_probe_dt(struct net_device *netdev,
 
 static int ftgmac100_probe(struct platform_device *pdev)
 {
-	const struct ftgmac100_match_data *match_data;
+	const struct ftgmac100_match_data *match_data = NULL;
 	enum ftgmac100_mac_id mac_id;
 	struct resource *res;
 	int irq;
@@ -1987,6 +2002,7 @@ static int ftgmac100_probe(struct platform_device *pdev)
 	priv->netdev = netdev;
 	priv->dev = &pdev->dev;
 	priv->mac_id = mac_id;
+	priv->quirks = match_data ? match_data->quirks : 0;
 	INIT_WORK(&priv->reset_task, ftgmac100_reset_task);
 
 	/* map io memory */
@@ -2134,7 +2150,8 @@ static const struct ftgmac100_match_data ftgmac100_match_data_ast2600 = {
 };
 
 static const struct ftgmac100_match_data ftgmac100_match_data_ast2700 = {
-	.mac_id = FTGMAC100_AST2700
+	.mac_id = FTGMAC100_AST2700,
+	.quirks = FTGMAC100_QUIRK_RMII_ENABLE,
 };
 
 static const struct ftgmac100_match_data ftgmac100_match_data_faraday = {
diff --git a/drivers/net/ethernet/faraday/ftgmac100.h b/drivers/net/ethernet/faraday/ftgmac100.h
index 4968f6f0bdbc..8c35c895b146 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.h
+++ b/drivers/net/ethernet/faraday/ftgmac100.h
@@ -167,6 +167,7 @@
 #define FTGMAC100_MACCR_RX_BROADPKT	(1 << 17)
 #define FTGMAC100_MACCR_DISCARD_CRCERR	(1 << 18)
 #define FTGMAC100_MACCR_FAST_MODE	(1 << 19)
+#define FTGMAC100_MACCR_RMII_ENABLE	BIT(20)
 #define FTGMAC100_MACCR_SW_RST		(1 << 31)
 
 /*

-- 
2.34.1


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

* [PATCH net-next v6 5/7] net: ftgmac100: Require phy-mode for AST2700
  2026-11-12  8:39 [PATCH net-next v6 0/7] net: ftgmac100: Add AST2700 support Jacky Chou
                   ` (3 preceding siblings ...)
  2026-11-12  8:39 ` [PATCH net-next v6 4/7] net: ftgmac100: Enable AST2700 RMII support Jacky Chou
@ 2026-11-12  8:39 ` Jacky Chou
  2026-11-16 13:54   ` netdev-bot+sashiko
  2026-11-12  8:39 ` [PATCH net-next v6 6/7] net: ftgmac100: Add AST2700 upper DMA address support Jacky Chou
  2026-11-12  8:39 ` [PATCH net-next v6 7/7] net: ftgmac100: Allow building on ARM64 Jacky Chou
  6 siblings, 1 reply; 17+ messages in thread
From: Jacky Chou @ 2026-11-12  8:39 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Po-Yu Chuang,
	Eric Dumazet, Heiner Kallweit, Russell King, Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, Jacky Chou, Andrew Lunn

The driver currently defaults to RGMII when the "phy-mode" property
is missing from the device tree. This default is no longer valid for
AST2700, which also supports RMII via FTGMAC100_QUIRK_RMII_ENABLE.

Make "phy-mode" a required property for AST2700 and fail probe with
an error message if it is not specified, instead of silently
defaulting to RGMII.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
 drivers/net/ethernet/faraday/ftgmac100.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 9b7becb01726..5a578a62df67 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -1526,8 +1526,13 @@ static int ftgmac100_mii_probe(struct net_device *netdev)
 
 	/* Default to RGMII. It's a gigabit part after all */
 	err = of_get_phy_mode(np, &phy_intf);
-	if (err)
+	if (err) {
+		if (priv->mac_id == FTGMAC100_AST2700) {
+			dev_err(priv->dev, "phy-mode is required for this SoC\n");
+			return -EINVAL;
+		}
 		phy_intf = PHY_INTERFACE_MODE_RGMII;
+	}
 
 	/* Aspeed only supports these. I don't know about other IP
 	 * block vendors so I'm going to just let them through for

-- 
2.34.1


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

* [PATCH net-next v6 6/7] net: ftgmac100: Add AST2700 upper DMA address support
  2026-11-12  8:39 [PATCH net-next v6 0/7] net: ftgmac100: Add AST2700 support Jacky Chou
                   ` (4 preceding siblings ...)
  2026-11-12  8:39 ` [PATCH net-next v6 5/7] net: ftgmac100: Require phy-mode for AST2700 Jacky Chou
@ 2026-11-12  8:39 ` Jacky Chou
  2026-11-16 13:54   ` netdev-bot+sashiko
  2026-11-12  8:39 ` [PATCH net-next v6 7/7] net: ftgmac100: Allow building on ARM64 Jacky Chou
  6 siblings, 1 reply; 17+ messages in thread
From: Jacky Chou @ 2026-11-12  8:39 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Po-Yu Chuang,
	Eric Dumazet, Heiner Kallweit, Russell King, Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, Jacky Chou, Andrew Lunn

Program the high RX and TX descriptor ring base registers and carry the
upper DMA address bits in RX and TX descriptors. Rebuild full buffer DMA
addresses in a 64-bit type before unmapping them so bits 34:32 are not
lost to 32-bit arithmetic.

The descriptor format provides three upper buffer address bits, so
request a 35-bit DMA mask instead of advertising an address range that
the hardware cannot encode. Gate all extended address handling with a
match-data quirk so older register layouts remain untouched and later
compatible controllers can opt into the same capability.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
 drivers/net/ethernet/faraday/ftgmac100.c | 62 +++++++++++++++++++++++++++-----
 drivers/net/ethernet/faraday/ftgmac100.h |  6 ++++
 2 files changed, 59 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 5a578a62df67..263594de0e07 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -8,6 +8,7 @@
 
 #define pr_fmt(fmt)	KBUILD_MODNAME ": " fmt
 
+#include <linux/bitfield.h>
 #include <linux/clk.h>
 #include <linux/reset.h>
 #include <linux/dma-mapping.h>
@@ -42,6 +43,7 @@ enum ftgmac100_mac_id {
 };
 
 #define FTGMAC100_QUIRK_RMII_ENABLE	BIT(0)
+#define FTGMAC100_QUIRK_DMA_35BIT	BIT(1)
 
 struct ftgmac100_match_data {
 	enum ftgmac100_mac_id mac_id;
@@ -303,10 +305,16 @@ static void ftgmac100_init_hw(struct ftgmac100 *priv)
 	iowrite32(reg, priv->base + FTGMAC100_OFFSET_ISR);
 
 	/* Setup RX ring buffer base */
-	iowrite32(priv->rxdes_dma, priv->base + FTGMAC100_OFFSET_RXR_BADR);
+	iowrite32(lower_32_bits(priv->rxdes_dma), priv->base + FTGMAC100_OFFSET_RXR_BADR);
+	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
+		iowrite32(upper_32_bits(priv->rxdes_dma),
+			  priv->base + FTGMAC100_OFFSET_RXR_BADDR_HIGH);
 
 	/* Setup TX ring buffer base */
-	iowrite32(priv->txdes_dma, priv->base + FTGMAC100_OFFSET_NPTXR_BADR);
+	iowrite32(lower_32_bits(priv->txdes_dma), priv->base + FTGMAC100_OFFSET_NPTXR_BADR);
+	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
+		iowrite32(upper_32_bits(priv->txdes_dma),
+			  priv->base + FTGMAC100_OFFSET_TXR_BADDR_HIGH);
 
 	/* Configure RX buffer size */
 	iowrite32(FTGMAC100_RBSR_SIZE(RX_BUF_SIZE),
@@ -474,7 +482,10 @@ static int ftgmac100_alloc_rx_buf(struct ftgmac100 *priv, unsigned int entry,
 	priv->rx_skbs[entry] = skb;
 
 	/* Store DMA address into RX desc */
-	rxdes->rxdes3 = cpu_to_le32(map);
+	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
+		rxdes->rxdes2 = cpu_to_le32(FIELD_PREP(FTGMAC100_RXDES2_RXBUF_BADR_HI,
+						       upper_32_bits(map)));
+	rxdes->rxdes3 = cpu_to_le32(lower_32_bits(map));
 
 	/* Ensure the above is ordered vs clearing the OWN bit */
 	dma_wmb();
@@ -601,6 +612,9 @@ static bool ftgmac100_rx_packet(struct ftgmac100 *priv, int *processed)
 
 	/* Tear down DMA mapping, do necessary cache management */
 	map = le32_to_cpu(rxdes->rxdes3);
+	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
+		map |= (u64)FIELD_GET(FTGMAC100_RXDES2_RXBUF_BADR_HI,
+				     le32_to_cpu(rxdes->rxdes2)) << 32;
 
 #if defined(CONFIG_ARM) && !defined(CONFIG_ARM_DMA_USE_IOMMU)
 	/* When we don't have an iommu, we can save cycles by not
@@ -677,9 +691,14 @@ static void ftgmac100_free_tx_packet(struct ftgmac100 *priv,
 				     struct ftgmac100_txdes *txdes,
 				     u32 ctl_stat)
 {
-	dma_addr_t map = le32_to_cpu(txdes->txdes3);
+	dma_addr_t map;
 	size_t len;
 
+	map = le32_to_cpu(txdes->txdes3);
+	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
+		map |= (u64)FIELD_GET(FTGMAC100_TXDES2_TXBUF_BADR_HI,
+				     le32_to_cpu(txdes->txdes2)) << 32;
+
 	if (ctl_stat & FTGMAC100_TXDES0_FTS) {
 		len = skb_headlen(skb);
 		dma_unmap_single(priv->dev, map, len, DMA_TO_DEVICE);
@@ -833,7 +852,10 @@ static netdev_tx_t ftgmac100_hard_start_xmit(struct sk_buff *skb,
 	f_ctl_stat |= FTGMAC100_TXDES0_FTS;
 	if (nfrags == 0)
 		f_ctl_stat |= FTGMAC100_TXDES0_LTS;
-	txdes->txdes3 = cpu_to_le32(map);
+	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
+		txdes->txdes2 = cpu_to_le32(FIELD_PREP(FTGMAC100_TXDES2_TXBUF_BADR_HI,
+						       upper_32_bits(map)));
+	txdes->txdes3 = cpu_to_le32(lower_32_bits(map));
 	txdes->txdes1 = cpu_to_le32(csum_vlan);
 
 	/* Next descriptor */
@@ -861,7 +883,10 @@ static netdev_tx_t ftgmac100_hard_start_xmit(struct sk_buff *skb,
 			ctl_stat |= FTGMAC100_TXDES0_LTS;
 		txdes->txdes0 = cpu_to_le32(ctl_stat);
 		txdes->txdes1 = 0;
-		txdes->txdes3 = cpu_to_le32(map);
+		if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
+			txdes->txdes2 = cpu_to_le32(FIELD_PREP(FTGMAC100_TXDES2_TXBUF_BADR_HI,
+							       upper_32_bits(map)));
+		txdes->txdes3 = cpu_to_le32(lower_32_bits(map));
 
 		/* Next one */
 		pointer = ftgmac100_next_tx_pointer(priv, pointer);
@@ -936,7 +961,12 @@ static void ftgmac100_free_buffers(struct ftgmac100 *priv)
 	for (i = 0; i < priv->rx_q_entries; i++) {
 		struct ftgmac100_rxdes *rxdes = &priv->rxdes[i];
 		struct sk_buff *skb = priv->rx_skbs[i];
-		dma_addr_t map = le32_to_cpu(rxdes->rxdes3);
+		dma_addr_t map;
+
+		map = le32_to_cpu(rxdes->rxdes3);
+		if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
+			map |= (u64)FIELD_GET(FTGMAC100_RXDES2_RXBUF_BADR_HI,
+					     le32_to_cpu(rxdes->rxdes2)) << 32;
 
 		if (!skb)
 			continue;
@@ -1055,7 +1085,12 @@ static void ftgmac100_init_rings(struct ftgmac100 *priv)
 	for (i = 0; i < priv->rx_q_entries; i++) {
 		rxdes = &priv->rxdes[i];
 		rxdes->rxdes0 = 0;
-		rxdes->rxdes3 = cpu_to_le32(priv->rx_scratch_dma);
+		if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT) {
+			u32 hi = upper_32_bits(priv->rx_scratch_dma);
+
+			rxdes->rxdes2 = cpu_to_le32(FIELD_PREP(FTGMAC100_RXDES2_RXBUF_BADR_HI, hi));
+		}
+		rxdes->rxdes3 = cpu_to_le32(lower_32_bits(priv->rx_scratch_dma));
 	}
 	/* Mark the end of the ring */
 	rxdes->rxdes0 |= cpu_to_le32(priv->rxdes0_edorr_mask);
@@ -2104,6 +2139,14 @@ static int ftgmac100_probe(struct platform_device *pdev)
 		netdev->hw_features &= ~(NETIF_F_HW_CSUM | NETIF_F_RXCSUM);
 	netdev->features |= netdev->hw_features;
 
+	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT) {
+		err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(35));
+		if (err) {
+			dev_err(&pdev->dev, "35-bit DMA enable failed\n");
+			goto err;
+		}
+	}
+
 	/* register network device */
 	err = register_netdev(netdev);
 	if (err) {
@@ -2156,7 +2199,8 @@ static const struct ftgmac100_match_data ftgmac100_match_data_ast2600 = {
 
 static const struct ftgmac100_match_data ftgmac100_match_data_ast2700 = {
 	.mac_id = FTGMAC100_AST2700,
-	.quirks = FTGMAC100_QUIRK_RMII_ENABLE,
+	.quirks = FTGMAC100_QUIRK_RMII_ENABLE |
+		  FTGMAC100_QUIRK_DMA_35BIT,
 };
 
 static const struct ftgmac100_match_data ftgmac100_match_data_faraday = {
diff --git a/drivers/net/ethernet/faraday/ftgmac100.h b/drivers/net/ethernet/faraday/ftgmac100.h
index 8c35c895b146..0c244b1c0a35 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.h
+++ b/drivers/net/ethernet/faraday/ftgmac100.h
@@ -57,6 +57,9 @@
 #define FTGMAC100_OFFSET_RX_RUNT	0xc0
 #define FTGMAC100_OFFSET_RX_CRCER_FTL	0xc4
 #define FTGMAC100_OFFSET_RX_COL_LOST	0xc8
+/* reserved 0xcc - 0x178 */
+#define FTGMAC100_OFFSET_TXR_BADDR_HIGH	0x17c
+#define FTGMAC100_OFFSET_RXR_BADDR_HIGH	0x18c
 
 /*
  * Interrupt status register & interrupt enable register
@@ -226,6 +229,7 @@ struct ftgmac100_txdes {
 #define FTGMAC100_TXDES1_TX2FIC		(1 << 30)
 #define FTGMAC100_TXDES1_TXIC		(1 << 31)
 
+#define FTGMAC100_TXDES2_TXBUF_BADR_HI	GENMASK(18, 16)
 /*
  * Receive descriptor, aligned to 16 bytes
  */
@@ -272,4 +276,6 @@ struct ftgmac100_rxdes {
 #define FTGMAC100_RXDES1_UDP_CHKSUM_ERR	(1 << 26)
 #define FTGMAC100_RXDES1_IP_CHKSUM_ERR	(1 << 27)
 
+#define FTGMAC100_RXDES2_RXBUF_BADR_HI	GENMASK(18, 16)
+
 #endif /* __FTGMAC100_H */

-- 
2.34.1


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

* [PATCH net-next v6 7/7] net: ftgmac100: Allow building on ARM64
  2026-11-12  8:39 [PATCH net-next v6 0/7] net: ftgmac100: Add AST2700 support Jacky Chou
                   ` (5 preceding siblings ...)
  2026-11-12  8:39 ` [PATCH net-next v6 6/7] net: ftgmac100: Add AST2700 upper DMA address support Jacky Chou
@ 2026-11-12  8:39 ` Jacky Chou
  2026-11-16 13:54   ` netdev-bot+sashiko
  6 siblings, 1 reply; 17+ messages in thread
From: Jacky Chou @ 2026-11-12  8:39 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Po-Yu Chuang,
	Eric Dumazet, Heiner Kallweit, Russell King, Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, Jacky Chou, Andrew Lunn

Allow the Faraday vendor menu and FTGMAC100 driver to be selected on
ARM64 so AST2700 platforms can enable the MAC. The driver now programs
the upper DMA address fields, so it no longer needs to be marked BROKEN
for 64-bit builds.

AST2700 has no dedicated MACH_ASPEED_G7 symbol; unlike the 32-bit
generations it is only gated by the common ARCH_ASPEED symbol. On
32-bit Aspeed platforms, arch/arm/mach-aspeed/Kconfig nests
MACH_ASPEED_G4/G5/G6 under "if ARCH_ASPEED", so MACH_ASPEED_G6 already
implies ARCH_ASPEED and is redundant once ARCH_ASPEED is part of the
condition. Drop it and select MDIO_ASPEED directly on ARCH_ASPEED.

This does widen the MDIO_ASPEED select beyond AST2600: it is now also
selected for AST2400/AST2500, which keep driving their embedded MDIO
controller from FTGMAC100 itself and have no MDIO node for this driver
to bind to, so it is built but stays unused there. Update the
MDIO_ASPEED help text to describe this.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
 drivers/net/ethernet/faraday/Kconfig |  7 +++----
 drivers/net/mdio/Kconfig             | 16 ++++++++++------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/faraday/Kconfig b/drivers/net/ethernet/faraday/Kconfig
index 474073c7f94d..9acc2d260c1f 100644
--- a/drivers/net/ethernet/faraday/Kconfig
+++ b/drivers/net/ethernet/faraday/Kconfig
@@ -6,7 +6,7 @@
 config NET_VENDOR_FARADAY
 	bool "Faraday devices"
 	default y
-	depends on ARM || COMPILE_TEST
+	depends on ARM || ARM64 || COMPILE_TEST
 	help
 	  If you have a network (Ethernet) card belonging to this class, say Y.
 
@@ -28,11 +28,10 @@ config FTMAC100
 
 config FTGMAC100
 	tristate "Faraday FTGMAC100 Gigabit Ethernet support"
-	depends on ARM || COMPILE_TEST
-	depends on !64BIT || BROKEN
+	depends on ARM || ARM64 || COMPILE_TEST
 	select PHYLIB
 	select FIXED_PHY
-	select MDIO_ASPEED if MACH_ASPEED_G6
+	select MDIO_ASPEED if ARCH_ASPEED
 	select CRC32
 	help
 	  This driver supports the FTGMAC100 Gigabit Ethernet controller
diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig
index 6f272fae4bb5..ec1794cc64b0 100644
--- a/drivers/net/mdio/Kconfig
+++ b/drivers/net/mdio/Kconfig
@@ -50,12 +50,16 @@ config MDIO_ASPEED
 	depends on OF_MDIO && HAS_IOMEM
 	help
 	  This module provides a driver for the independent MDIO bus
-	  controllers found in the ASPEED AST2600 SoC. This is a driver for the
-	  third revision of the ASPEED MDIO register interface - the first two
-	  revisions are the "old" and "new" interfaces found in the AST2400 and
-	  AST2500, embedded in the MAC. For legacy reasons, FTGMAC100 driver
-	  continues to drive the embedded MDIO controller for the AST2400 and
-	  AST2500 SoCs, so say N if AST2600 support is not required.
+	  controllers found in the ASPEED AST2600 and AST2700 SoCs. This is a
+	  driver for the third revision of the ASPEED MDIO register interface -
+	  the first two revisions are the "old" and "new" interfaces found in
+	  the AST2400 and AST2500, embedded in the MAC. For legacy reasons,
+	  FTGMAC100 driver continues to drive the embedded MDIO controller for
+	  the AST2400 and AST2500 SoCs. AST2700 has no dedicated MACH_ASPEED_G7
+	  symbol and is only gated by ARCH_ASPEED, so FTGMAC100 now
+	  unconditionally selects this driver on every ARCH_ASPEED platform,
+	  including the older AST2400/AST2500 SoCs where it has no MDIO node to
+	  bind to.
 
 config MDIO_BITBANG
 	tristate "Bitbanged MDIO buses"

-- 
2.34.1


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

* Re: [PATCH net-next v6 1/7] dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone
  2026-11-12  8:39 ` [PATCH net-next v6 1/7] dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone Jacky Chou
@ 2026-11-12 18:43   ` Conor Dooley
  2026-11-16 13:54   ` netdev-bot+sashiko
  1 sibling, 0 replies; 17+ messages in thread
From: Conor Dooley @ 2026-11-12 18:43 UTC (permalink / raw)
  To: Jacky Chou
  Cc: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Po-Yu Chuang,
	Eric Dumazet, Heiner Kallweit, Russell King, netdev, devicetree,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 52 bytes --]

Acked-by: Conor Dooley <conor.dooley@microchip.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH net-next v6 2/7] dt-bindings: net: ftgmac100: Add AST2700 compatible
  2026-11-12  8:39 ` [PATCH net-next v6 2/7] dt-bindings: net: ftgmac100: Add AST2700 compatible Jacky Chou
@ 2026-11-12 18:44   ` Conor Dooley
  2026-11-16 13:54   ` netdev-bot+sashiko
  1 sibling, 0 replies; 17+ messages in thread
From: Conor Dooley @ 2026-11-12 18:44 UTC (permalink / raw)
  To: Jacky Chou
  Cc: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Po-Yu Chuang,
	Eric Dumazet, Heiner Kallweit, Russell King, netdev, devicetree,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 53 bytes --]

Acked-by: Conor Dooley <conor.dooley@microchip.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH net-next v6 1/7] dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone
  2026-11-12  8:39 ` [PATCH net-next v6 1/7] dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone Jacky Chou
  2026-11-12 18:43   ` Conor Dooley
@ 2026-11-16 13:54   ` netdev-bot+sashiko
  1 sibling, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-11-16 13:54 UTC (permalink / raw)
  To: jacky_chou
  Cc: andrew+netdev, davem, kuba, pabeni, robh, krzk+dt, conor+dt,
	ratbert, edumazet, hkallweit1, linux, netdev, devicetree,
	linux-kernel, andrew

Thank you for your contribution! Sashiko AI review found 5 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 4

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] One of the new allOf conditionals in faraday,ftgmac100.yaml is
  vacuously true.
- [Low] The commit message justifies the change partly with a false
  claim.
- [Low] After this patch, properties/compatible is an enum of single
  strings, so a two-string compatible list is invalid.
- [Low] The patch adds `clocks = <&syscon ASPEED_CLK_GATE_MAC1CLK>;` to
  the binding example `ethernet@1e660000`, an aspeed,ast2500-mac node…
- [Low] For the plain faraday,ftgmac100 compatible, the new conditional
  (lines 118-130) sets `clocks: false` and `clock-names: false`.

--

dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone

This patch turns the aspeed,ast2400-mac, aspeed,ast2500-mac and
aspeed,ast2600-mac compatibles into standalone strings, so they no longer
need the faraday,ftgmac100 fallback. It also adds per-compatible limits on
clocks and clock-names. The examples now drop the fallback and list a MAC
clock.

> The aspeed,ast2400-mac, aspeed,ast2500-mac, and aspeed,ast2600-mac
> compatibles are currently only valid when paired with the generic
> "faraday,ftgmac100" fallback: if a node ever bound through the
> generic entry alone, ftgmac100_probe() would set
> rxdes0_edorr_mask/txdes0_edotr_mask to BIT(15) instead of the Aspeed
> BIT(30), skip Aspeed clock setup, and leave the DMA mask too narrow.

[Severity: Low]
Is the "leave the DMA mask too narrow" part accurate? At this commit,
drivers/net/ethernet/faraday/ftgmac100.c does not seem to contain any
dma_set_mask*() or DMA_BIT_MASK() call. That would mean the generic and
Aspeed entries get the same DMA mask.

Later in the series, the only DMA mask code is
dma_set_mask_and_coherent(..., DMA_BIT_MASK(35)), gated by
FTGMAC100_QUIRK_DMA_35BIT. Only ftgmac100_match_data_ast2700 sets that
quirk, so it doesn't cover ast2400/2500/2600 either.

Also, ftgmac100_probe() uses of_device_get_match_data(), which picks the
best match by position in the compatible list:

    match_data = of_device_get_match_data(&pdev->dev);

So a node with "aspeed,ast2500-mac", "faraday,ftgmac100" always gets the
AST2500 match data and never the generic entry. The note below the cut
seems to say the same thing.

Could the commit message give the actual reason, that the Aspeed MACs
differ from the generic Faraday programming model (EDORR/EDOTR at BIT(30),
Aspeed clock setup), and drop the DMA mask claim?

> diff --git a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> index d14410018bcf6..9d352e3686aaf 100644
> --- a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> +++ b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> @@ -11,14 +11,11 @@ maintainers:
>  
>  properties:
>    compatible:
> -    oneOf:
> -      - const: faraday,ftgmac100
> -      - items:
> -          - enum:
> -              - aspeed,ast2400-mac
> -              - aspeed,ast2500-mac
> -              - aspeed,ast2600-mac
> -          - const: faraday,ftgmac100
> +    enum:
> +      - faraday,ftgmac100
> +      - aspeed,ast2400-mac
> +      - aspeed,ast2500-mac
> +      - aspeed,ast2600-mac

[Severity: Low]
Now that compatible is an enum of single strings, the two-string form no
longer validates. All of the in-tree MAC nodes still use it:

arch/arm/boot/dts/aspeed/aspeed-g4.dtsi (mac0, mac1):
    compatible = "aspeed,ast2400-mac", "faraday,ftgmac100";

arch/arm/boot/dts/aspeed/aspeed-g5.dtsi (mac0, mac1):
    compatible = "aspeed,ast2500-mac", "faraday,ftgmac100";

arch/arm/boot/dts/aspeed/aspeed-g6.dtsi (mac0..mac3):
    compatible = "aspeed,ast2600-mac", "faraday,ftgmac100";

Won't dtbs_check warn on every Aspeed board DTS that includes these files
as soon as this lands? The note below the cut says the dtsi update will go
through a separate tree, but nothing in this series touches arch/.

Would it make sense to keep the old pairing as a deprecated oneOf
alternative, so existing DTs keep validating until the dtsi change lands?

[ ... ]

> @@ -88,22 +85,76 @@ allOf:
>      else:
>        properties:
>          resets: false

[ ... ]

> +  - if:
> +      not:
> +        properties:
> +          compatible:
> +            contains:
> +              enum:
> +                - aspeed,ast2400-mac
> +                - aspeed,ast2500-mac
> +                - aspeed,ast2600-mac
> +    then:
> +      properties:
> +        clocks: false
> +        clock-names: false

[Severity: Low]
Should the generic faraday,ftgmac100 compatible forbid clocks altogether?
Before this patch, clocks were optional for every compatible, and the
binding describes the first clock as:

  clocks:
    minItems: 1
    items:
      - description: MAC IP clock

FTGMAC100 is a licensable IP block, so a non-Aspeed integration would
still normally have a MAC/bus clock input. The driver only calls
ftgmac100_setup_clk() when priv->is_aspeed, but that doesn't mean the
hardware has no clock.

With this change, a generic-compatible node that used to validate with a
clocks property now fails. The commit message says "the plain
faraday,ftgmac100 compatible takes none", but doesn't explain why the IP
clock input is forbidden rather than left optional.

> +  - if:
> +      properties:
> +        clocks:
> +          minItems: 2
> +    then:
> +      required:
> +        - clock-names

[Severity: Medium]
Does this if also match nodes that have no clocks property at all?
properties only checks keys that are present, so a node without clocks
satisfies the if, and clock-names becomes required.

Combined with the block above, which sets clocks: false and
clock-names: false for non-Aspeed compatibles, a plain faraday,ftgmac100
node can't pass either way:

  - without clock-names: "'clock-names' is a required property"
  - with clock-names: "False schema does not allow"

The compatible is still in the top-level enum, and it is still in
ftgmac100_of_match[]:

    { .compatible = "faraday,ftgmac100",
      .data = &ftgmac100_match_data_faraday },

An Aspeed node that leaves out clocks would also get an extra clock-names
error on top of the missing-clocks error.

dt_binding_check won't catch this, because both examples are
aspeed,ast2500-mac nodes with exactly one clock.

Would putting the presence check inside the if, as in the presence-based
conditionals in Documentation/devicetree/bindings/example-schema.yaml,
match the commit message's "Require clock-names whenever two clocks are
listed"? For example:

  - if:
      properties:
        clocks:
          minItems: 2
      required:
        - clocks
    then:
      required:
        - clock-names

>  
>  unevaluatedProperties: false
>  
>  examples:
>    - |
> +    #include <dt-bindings/clock/aspeed-clock.h>
> +
>      ethernet@1e660000 {
> -        compatible = "aspeed,ast2500-mac", "faraday,ftgmac100";
> +        compatible = "aspeed,ast2500-mac";
>          reg = <0x1e660000 0x180>;
>          interrupts = <2>;
> +        clocks = <&syscon ASPEED_CLK_GATE_MAC1CLK>;
>          use-ncsi;
>      };

[Severity: Low]
This example node uses use-ncsi, which runs over RMII, but it only lists
the MAC clock. Should it also list the MAC1 RCLK gate, along with
clock-names?

In ftgmac100_setup_clk(), RCLK is only enabled when the DT names it:

    /* RCLK is for RMII, typically used for NCSI. Optional because it's not
     * necessary if it's the AST2400 MAC, or the MAC is configured for
     * RGMII, or the controller is not an ASPEED-based controller.
     */
    priv->rclk = devm_clk_get_optional_enabled(priv->dev, "RCLK");

On AST2500, aspeed_clk_probe() registers mac1rclk as a plain gate:

    /* RMII1 50MHz (RCLK) output enable */
    hw = clk_hw_register_gate(dev, "mac1rclk", "mac12rclk", 0,
            scu_base + ASPEED_MAC_CLK_DLY, 29, 0,

If nothing claims that gate, can clk_disable_unused() turn off the RMII
reference clock? On a board whose DT was copied from this example, that
would take the NC-SI link down.

The new ast2500/ast2600 rule only asks for minItems: 1, so such a DT would
pass dtbs_check. The in-tree AST2500/AST2600 NC-SI boards (romulus,
witherspoon, tacoma, mtjade, ethanolx, ...) all list both MACCLK and RCLK
with clock-names.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-support_ast2700-v6-0-238020bf46cf%40aspeedtech.com

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

* Re: [PATCH net-next v6 2/7] dt-bindings: net: ftgmac100: Add AST2700 compatible
  2026-11-12  8:39 ` [PATCH net-next v6 2/7] dt-bindings: net: ftgmac100: Add AST2700 compatible Jacky Chou
  2026-11-12 18:44   ` Conor Dooley
@ 2026-11-16 13:54   ` netdev-bot+sashiko
  1 sibling, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-11-16 13:54 UTC (permalink / raw)
  To: jacky_chou
  Cc: andrew+netdev, davem, kuba, pabeni, robh, krzk+dt, conor+dt,
	ratbert, edumazet, hkallweit1, linux, netdev, devicetree,
	linux-kernel, andrew

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] In
  Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml,…
- [Medium] dt-bindings: net: ftgmac100: requiring phy-mode on AST2700
  breaks use-ncsi
- [Low] This commit adds a new allOf block (faraday,ftgmac100.yaml lines
  90-97) that makes `phy-mode` mandatory for `aspeed,ast2700-mac`.

--

dt-bindings: net: ftgmac100: Add AST2700 compatible

This commit adds aspeed,ast2700-mac to the FTGMAC100 binding as a
standalone compatible. It extends the resets and clocks conditionals to
cover AST2700, and it makes phy-mode a required property for AST2700.

> diff --git a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> index 9d352e3686aaf..613d4f1caa4fa 100644
> --- a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> +++ b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> @@ -16,6 +16,7 @@ properties:
>        - aspeed,ast2400-mac
>        - aspeed,ast2500-mac
>        - aspeed,ast2600-mac
> +      - aspeed,ast2700-mac
>  
>    reg:
>      maxItems: 1

[Severity: Medium]
An earlier patch in this series ("dt-bindings: net: ftgmac100: Make Aspeed
compatibles standalone") turned properties:compatible into a flat enum.
That enum accepts only a single string:

  compatible:
    enum:
      - faraday,ftgmac100
      - aspeed,ast2400-mac
      - aspeed,ast2500-mac
      - aspeed,ast2600-mac
      - aspeed,ast2700-mac

dt-schema expands this into a list that holds one item. A compatible with
two entries then fails with "is too long".

Do the in-tree Aspeed MAC nodes still validate? At the end of the series
they all still use the two-string form:

arch/arm/boot/dts/aspeed/aspeed-g4.dtsi:
    compatible = "aspeed,ast2400-mac", "faraday,ftgmac100";

arch/arm/boot/dts/aspeed/aspeed-g5.dtsi:
    compatible = "aspeed,ast2500-mac", "faraday,ftgmac100";

arch/arm/boot/dts/aspeed/aspeed-g6.dtsi:
    compatible = "aspeed,ast2600-mac", "faraday,ftgmac100";

No patch in the series updates these nodes. If that is right, dtbs_check
fails for every AST2400/AST2500/AST2600 board.

The binding also seems to contradict itself. This patch extends the
if/contains blocks for resets, phy-mode and clocks. Those blocks are
written for compatible lists with more than one entry, but the top-level
enum never lets such a list validate.

Could the binding use a oneOf that accepts both the standalone form and
the legacy pair of aspeed,*-mac plus faraday,ftgmac100? The other option
is to convert the in-tree DTS files in the same series.

[ ... ]

> @@ -79,12 +80,21 @@ allOf:
>            contains:
>              enum:
>                - aspeed,ast2600-mac
> +              - aspeed,ast2700-mac
>      then:
>        properties:
>          resets: true
>      else:
>        properties:
>          resets: false
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: aspeed,ast2700-mac
> +    then:
> +      required:
> +        - phy-mode

[Severity: Medium]
Is phy-mode really mandatory for every AST2700 MAC node? The binding
also documents the use-ncsi boolean. That mode runs the NC-SI stack
over RMII instead of talking to an MDIO PHY. The first example in this
file sets use-ncsi and has no phy-mode property, and that is a valid
setup on the earlier Aspeed parts.

With this rule, an aspeed,ast2700-mac node that uses use-ncsi fails
dtbs_check unless it also carries a redundant phy-mode.

The driver does not seem to need phy-mode in that case either.
ftgmac100_probe_dt() checks use-ncsi first and calls
ftgmac100_probe_ncsi(). That path registers a fixed PHY and connects
it with PHY_INTERFACE_MODE_RMII without ever reading phy-mode.

The commit message says the rule matches the driver's probe-time
requirement. However, the check added later in this series ("net:
ftgmac100: Require phy-mode for AST2700") sits in ftgmac100_mii_probe().
That function only runs for the legacy MDIO bus scan, which happens
only when there is no use-ncsi, fixed-link, phy-handle or mdio child
node. On AST2600 and AST2700 that path returns -ENODEV anyway, because
ftgmac100_setup_mdio() is only called for Faraday, AST2400 and
AST2500.

A binding should also describe hardware constraints rather than what
one version of the Linux driver checks at probe time.

Should the requirement be dropped? Or should it apply only to nodes
without use-ncsi, for example by adding a not/required use-ncsi
condition to the if clause?

[Severity: Low]
Can every AST2700 MAC instance meet this new requirement? The local
phy-mode enum allows only RGMII and RMII modes:

  phy-mode:
    enum:
      - rgmii
      - rgmii-id
      - rgmii-rxid
      - rgmii-txid
      - rmii

AST2700 SoC1 appears to have three MACs. There are three resets
(SCU1_RESET_MAC0/1/2) and three gate clocks (SCU1_CLK_GATE_MAC0CLK,
MAC1CLK and MAC2CLK).

However, there are only two RMII reference clocks (SCU1_CLK_MAC0RCLK and
SCU1_CLK_MAC1RCLK). The only RGMII/RMII pin groups are RGMII0, RGMII1,
RMII0 and RMII1. There is also an SGMII group in
arch/arm64/boot/dts/aspeed/aspeed-g7-soc1-pinctrl.dtsi:

	pinctrl_sgmii_default: sgmii-default-state {
		function = "SGMII";
		groups = "SGMII";

This suggests the third MAC supports only SGMII. That is an inference
from the pinctrl, clock and reset headers, not from a datasheet.

If so, a node for that MAC fails validation either way. Without phy-mode
it breaks the new required rule, and phy-mode = "sgmii" is rejected by
the enum.

Should sgmii be allowed for aspeed,ast2700-mac, so the binding describes
every instance of the hardware even before the driver supports SGMII?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-support_ast2700-v6-0-238020bf46cf%40aspeedtech.com

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

* Re: [PATCH net-next v6 3/7] net: ftgmac100: Add AST2700 compatible support
  2026-11-12  8:39 ` [PATCH net-next v6 3/7] net: ftgmac100: Add AST2700 compatible support Jacky Chou
@ 2026-11-16 13:54   ` netdev-bot+sashiko
  0 siblings, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-11-16 13:54 UTC (permalink / raw)
  To: jacky_chou
  Cc: andrew+netdev, davem, kuba, pabeni, robh, krzk+dt, conor+dt,
	ratbert, edumazet, hkallweit1, linux, netdev, devicetree,
	linux-kernel, andrew

Thank you for your contribution! Sashiko AI review found 6 potential
issue(s) to consider.

Critical: 0 · High: 2 · Medium: 2 · Low: 2

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] ftgmac100_reset_and_config_mac() dereferences
  priv->netdev->phydev->interface whenever priv->is_aspeed is true, with…
- [High] net: ftgmac100: missing MAC reset deassertion for AST2700 in
  ftgmac100_probe()
- [Medium] Since this patch, AST2700 goes through the Aspeed path in
  ftgmac100_probe(): is_aspeed is set, EDORR/EDOTR use BIT(30), and…
- [Medium] The series commit "dt-bindings: net: ftgmac100: Make Aspeed
  compatibles standalone" (extended by "dt-bindings: net: ftgmac100: Add…
- [Low] The binding requires `phy-mode` for every aspeed,ast2700-mac
  node, and its commit message says this matches "the driver's probe-…
- [Low] The comment on struct ftgmac100::rclk still says `/*
  AST2500/AST2600 RMII ref clock gate */`.

--

net: ftgmac100: Add AST2700 compatible support

This patch adds an FTGMAC100_AST2700 mac_id, its OF match data and an
"aspeed,ast2700-mac" compatible entry. It also adds AST2700 to the Aspeed
branch in ftgmac100_probe(), which sets is_aspeed and the BIT(30)
EDORR/EDOTR masks for the new MAC.

> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 6d2fe5c2f3903..67b1fa464a421 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c

[ ... ]

> @@ -2017,7 +2018,8 @@ static int ftgmac100_probe(struct platform_device *pdev)
>  
>  	if (priv->mac_id == FTGMAC100_AST2400 ||
>  	    priv->mac_id == FTGMAC100_AST2500 ||
> -	    priv->mac_id == FTGMAC100_AST2600) {
> +	    priv->mac_id == FTGMAC100_AST2600 ||
> +	    priv->mac_id == FTGMAC100_AST2700) {
>  		priv->rxdes0_edorr_mask = BIT(30);
>  		priv->txdes0_edotr_mask = BIT(30);
>  		priv->is_aspeed = true;

[Severity: High]
With AST2700 now on the is_aspeed path, does anything release the MAC
from reset on this SoC?

On AST2400 to AST2600, the MAC clock gates in the Aspeed clock drivers
carry a coupled reset index. Enabling MACCLK through
devm_clk_get_enabled() in ftgmac100_setup_clk() therefore also
deasserts the SCU MAC reset.

On AST2700 that coupling seems to be gone. The SCU1_CLK_GATE_MAC0CLK to
MAC2CLK gates in clk-ast2700.c only clear the stop bit in
SCU1_CLK_STOP. SCU1_RESET_MAC0 to MAC2 are separate reset lines in
reset-aspeed.c, so enabling the clock leaves the MAC in reset.

ftgmac100_probe() gets priv->rst with
devm_reset_control_get_optional_exclusive() but never calls
reset_control_deassert() on it. The only deassert is in
ftgmac100_reset_and_config_mac(), and only for RMII:

	/* Aspeed RMII needs SCU reset to clear status */
	if (priv->is_aspeed && priv->netdev->phydev->interface == PHY_INTERFACE_MODE_RMII) {

Suppose the bootloader did not release the AST2700 MAC reset. An RGMII
MAC would then stay in reset across probe and ndo_open, and
ftgmac100_open() -> ftgmac100_reset_and_config_mac() ->
ftgmac100_reset_mac() would be driving a block that is held in reset.
The interface would not come up, and the most likely visible symptom is
-EIO from the SW_RST poll.

The probe ordering has a related problem. ftgmac100_initial_mac() reads
FTGMAC100_OFFSET_MAC_MADR and FTGMAC100_OFFSET_MAC_LADR before priv->rst
is obtained and before ftgmac100_setup_clk() enables the MAC clock. On
AST2700 this read can hit a gated and reset block. In that case the
bootloader-programmed address is lost and the driver falls back to a
random MAC.

Other AST2700 peripheral drivers, such as aspeed-vhub and
aspeed-g6-pwm-tach, deassert their reset explicitly in probe. For
AST2700, should ftgmac100_probe() enable the clock and deassert
priv->rst before it first touches MAC registers? Or does the series
expect firmware to always leave the MAC clocked and out of reset? If it
is the latter, that requirement should be stated somewhere.

[Severity: Medium]
This groups AST2700 with the AST2600-style Aspeed MACs. Should the two
AST2600-only workarounds later in ftgmac100_probe() also apply to AST2700?

	/* Disable ast2600 problematic HW arbitration */
	if (priv->mac_id == FTGMAC100_AST2600)
		iowrite32(FTGMAC100_TM_DEFAULT,
			  priv->base + FTGMAC100_OFFSET_TM);
	...
	/* AST2600 tx checksum with NCSI is broken */
	if (priv->use_ncsi && priv->mac_id == FTGMAC100_AST2600)
		netdev->hw_features &= ~NETIF_F_HW_CSUM;

Suppose the AST2700 MAC kept the AST2600 arbitration logic or the NC-SI TX
checksum defect. AST2700 would then run with the hardware default
arbitration mode, and with NC-SI it would still advertise NETIF_F_HW_CSUM.

Neither this patch nor the rest of the series changes these checks or says
that AST2700 is free of these errata.

[Severity: High]
Now that is_aspeed is set for AST2700, can ftgmac100_reset_and_config_mac()
dereference a NULL phydev?

ftgmac100_reset_and_config_mac() {
	...
	if (priv->is_aspeed && priv->netdev->phydev->interface == PHY_INTERFACE_MODE_RMII) {
	...
}

ftgmac100_probe_dt() returns 0 without attaching a PHY when the node has no
use-ncsi, no fixed-link and no phy-handle, but does have an mdio child:

	if (!ftgmac100_has_child_node(np, "mdio")) {
		...
		err = ftgmac100_mii_probe(netdev);
		...
	}

	return 0;

The binding allows this configuration. For such an AST2700 node,
register_netdev() succeeds. After that, both of these paths would reach the
unchecked dereference:

  ftgmac100_open()->ftgmac100_reset_and_config_mac()
  ftgmac100_reset()->ftgmac100_reset_and_config_mac()

ftgmac100_open() runs under RTNL, so an oops there would leave rtnl_mutex
held.

The dereference itself dates back to commit af350ee72e9d ("net: ftgmac100:
Add optional reset control for RMII mode on Aspeed SoCs"), which covered
AST2400 to AST2600. This patch makes it reachable for AST2700.

Later in the series, "net: ftgmac100: Enable AST2700 RMII support" adds a
second unchecked dereference in ftgmac100_start_hw():

	if ((priv->quirks & FTGMAC100_QUIRK_RMII_ENABLE) &&
	    phydev->interface == PHY_INTERFACE_MODE_RMII) {

That commit message says "ftgmac100_probe_dt() always attaches a
phy_device before register_netdev() can succeed". The mdio child path
above shows that this is not always true.

Elsewhere, ftgmac100_open() and the reset task both check
if (netdev->phydev) before using it. Should these two paths do the same?

[Severity: Low]
This isn't a bug, but with is_aspeed now set for AST2700,
ftgmac100_setup_clk() also stores the "RCLK" clock in priv->rclk for
AST2700. The comment on that field in struct ftgmac100 still reads:

	/* AST2500/AST2600 RMII ref clock gate */
	struct clk *rclk;

Should it mention AST2700, as the binding in this series does?

[ ... ]

> @@ -2142,6 +2148,8 @@ static const struct of_device_id ftgmac100_of_match[] = {
>  	  .data = &ftgmac100_match_data_ast2500 },
>  	{ .compatible = "aspeed,ast2600-mac",
>  	  .data = &ftgmac100_match_data_ast2600 },
> +	{ .compatible = "aspeed,ast2700-mac",
> +	  .data = &ftgmac100_match_data_ast2700 },
>  	{ .compatible = "faraday,ftgmac100",
>  	  .data = &ftgmac100_match_data_faraday },
>  	{ }

[Severity: Medium]
This comment is about the binding changes elsewhere in the series, not this
hunk. "dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone",
later extended by "dt-bindings: net: ftgmac100: Add AST2700 compatible",
removes the oneOf that accepted the "aspeed,ast2x00-mac",
"faraday,ftgmac100" pair. In its place is a single-value enum:

  compatible:
    enum:
      - faraday,ftgmac100
      - aspeed,ast2400-mac
      - aspeed,ast2500-mac
      - aspeed,ast2600-mac
      - aspeed,ast2700-mac

Will the in-tree Aspeed MAC nodes still validate? They all still use the
two-string form. For example, aspeed-g6.dtsi has:

	compatible = "aspeed,ast2600-mac", "faraday,ftgmac100";

aspeed-g4.dtsi and aspeed-g5.dtsi use the same form, and the series does
not change any of them. With a bare enum, dtbs_check would reject all of
these nodes as too long.

The change also drops a documented compatible combination that deployed
DTBs use. The match table above already handles both forms, so the driver
does not need the binding restructured.

[Severity: Low]
This one is also about the series. The binding makes phy-mode required for
every aspeed,ast2700-mac node, and its commit message says this matches
"the driver's probe-time requirement". Can the driver ever enforce that
requirement?

"net: ftgmac100: Require phy-mode for AST2700" adds this check to
ftgmac100_mii_probe():

	if (priv->mac_id == FTGMAC100_AST2700) {
		dev_err(priv->dev, "phy-mode is required for this SoC\n");
		return -EINVAL;
	}

However, ftgmac100_mii_probe() returns -ENODEV earlier when !priv->mii_bus.
priv->mii_bus is only set by ftgmac100_setup_mdio(), and ftgmac100_probe()
calls that only for FARADAY, AST2400 and AST2500:

	if (priv->mac_id == FTGMAC100_FARADAY ||
	    priv->mac_id == FTGMAC100_AST2400 ||
	    priv->mac_id == FTGMAC100_AST2500) {
		err = ftgmac100_setup_mdio(netdev);

The other paths behave as follows:

  - ftgmac100_probe_ncsi() hard-codes PHY_INTERFACE_MODE_RMII and never
    reads phy-mode.
  - On the phy-handle and fixed-link path, of_phy_get_and_connect() fails
    without phy-mode for every compatible, not just AST2700.

So the new AST2700 check looks unreachable, and NC-SI AST2700 nodes would
have to carry a property that the driver ignores.

Could the binding constraint and the commit messages be updated to match
what the driver actually does?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-support_ast2700-v6-0-238020bf46cf%40aspeedtech.com

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

* Re: [PATCH net-next v6 4/7] net: ftgmac100: Enable AST2700 RMII support
  2026-11-12  8:39 ` [PATCH net-next v6 4/7] net: ftgmac100: Enable AST2700 RMII support Jacky Chou
@ 2026-11-16 13:54   ` netdev-bot+sashiko
  0 siblings, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-11-16 13:54 UTC (permalink / raw)
  To: jacky_chou
  Cc: andrew+netdev, davem, kuba, pabeni, robh, krzk+dt, conor+dt,
	ratbert, edumazet, hkallweit1, linux, netdev, devicetree,
	linux-kernel, andrew

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The commit message and the new comment in ftgmac100_start_hw()
  (drivers/net/ethernet/faraday/ftgmac100.c:362-367) say an opened…
- [Medium] On AST2700, the patch moves the RMII/RGMII interface select
  into a MACCR bit (FTGMAC100_MACCR_RMII_ENABLE, BIT(20)).

--

net: ftgmac100: Enable AST2700 RMII support

This commit adds a FTGMAC100_QUIRK_RMII_ENABLE match-data quirk for
AST2700. When the attached PHY uses RMII, ftgmac100_start_hw() now sets
the new FTGMAC100_MACCR_RMII_ENABLE bit. The commit message says phydev is
always populated once the device is opened.

> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 67b1fa464a421..9b7becb017262 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c

[ ... ]

> @@ -355,6 +359,12 @@ static void ftgmac100_init_hw(struct ftgmac100 *priv)
>  static void ftgmac100_start_hw(struct ftgmac100 *priv)
>  {
>  	u32 maccr = ioread32(priv->base + FTGMAC100_OFFSET_MACCR);
> +	/*
> +	 * Only reached once the device is open, so a phy_device is already
> +	 * attached: a discrete PHY via "phy-handle", a "fixed-link" node, or
> +	 * NC-SI's internal fixed 100M PHY.
> +	 */
> +	struct phy_device *phydev = priv->netdev->phydev;
>  
>  	/* Keep the original GMAC and FAST bits */
>  	maccr &= (FTGMAC100_MACCR_FAST_MODE | FTGMAC100_MACCR_GIGA_MODE);

[ ... ]

> @@ -383,6 +393,11 @@ static void ftgmac100_start_hw(struct ftgmac100 *priv)
>  	if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
>  		maccr |= FTGMAC100_MACCR_RM_VLAN;
>  
> +	if ((priv->quirks & FTGMAC100_QUIRK_RMII_ENABLE) &&
> +	    phydev->interface == PHY_INTERFACE_MODE_RMII) {

[Severity: Medium]

Do the comment above and the commit message describe an invariant that
always holds? The commit message says:

  ftgmac100_probe_dt() always attaches a phy_device before
  register_netdev() can succeed -- via a discrete PHY ("phy-handle"), a
  "fixed-link" node, or NC-SI's internal fixed 100Mbit PHY

In ftgmac100_probe_dt(), if the node has an "mdio" child but no
phy-handle, fixed-link or use-ncsi, no PHY gets connected:

drivers/net/ethernet/faraday/ftgmac100.c:ftgmac100_probe_dt() {
    ...
	if (!ftgmac100_has_child_node(np, "mdio")) {
		...
		err = ftgmac100_mii_probe(netdev);
		...
	}

	return 0;
}

AST2700 does not call ftgmac100_setup_mdio(), and ftgmac100_probe() never
checks netdev->phydev before register_netdev().

The binding in faraday,ftgmac100.yaml allows an mdio child for every
compatible. For aspeed,ast2700-mac it requires only phy-mode, not
phy-handle, so this layout passes schema validation.

The rest of the driver treats a NULL phydev as valid. ftgmac100_open()
does this:

	if (netdev->phydev) {
		/* If we have a PHY, start polling */
		phy_start(netdev->phydev);
	}

ftgmac100_reset() and ftgmac100_stop() have similar checks.

With such a DT, can phydev be NULL here on AST2700? The
FTGMAC100_QUIRK_RMII_ENABLE quirk is always set for that compatible, so
the NULL phydev would be dereferenced on every open.

The commit message cites ftgmac100_reset_and_config_mac() as precedent.
That check has the same unguarded dereference:

	if (priv->is_aspeed && priv->netdev->phydev->interface == PHY_INTERFACE_MODE_RMII) {

It runs first in both ftgmac100_open() and ftgmac100_reset(). Today it
would oops before ftgmac100_start_hw() is reached, and once it is guarded
this new site would be the next oops. None of the later patches in the
series seem to change either site.

Could this check phydev && phydev->interface == PHY_INTERFACE_MODE_RMII,
and could ftgmac100_reset_and_config_mac() get the same guard? Failing
probe on Aspeed parts with no PHY attached would also work. Either way,
the comment and commit message could then be corrected.

> +		maccr |= FTGMAC100_MACCR_RMII_ENABLE;
> +	}
> +
>  	/* Hit the HW */
>  	iowrite32(maccr, priv->base + FTGMAC100_OFFSET_MACCR);
>  }

[Severity: Medium]

Should FTGMAC100_MACCR_RMII_ENABLE also go into the other MACCR writes?
This is the only place the interface-select bit gets set. It is the same
write that enables TXDMA/RXDMA/TXMAC/RXMAC.

ftgmac100_reset_and_config_mac() builds maccr from cur_speed only and
passes it to ftgmac100_reset_mac(), which issues SW_RST with it:

drivers/net/ethernet/faraday/ftgmac100.c:ftgmac100_reset_mac() {
	/* NOTE: reset clears all registers */
	iowrite32(maccr, priv->base + FTGMAC100_OFFSET_MACCR);
	iowrite32(maccr | FTGMAC100_MACCR_SW_RST,
		  priv->base + FTGMAC100_OFFSET_MACCR);
    ...
}

ftgmac100_stop_hw() writes 0:

	iowrite32(0, priv->base + FTGMAC100_OFFSET_MACCR);

On an AST2700 RMII or NC-SI port, every SW_RST therefore runs with RGMII
selected. That covers open, reset_task after adjust_link, tx_timeout and
ring resize. Every stop or reset also switches the port back to RGMII.

The driver passes FAST_MODE/GIGA_MODE into the pre-reset MACCR write on
purpose and keeps them in ftgmac100_start_hw(). That suggests mode bits
are expected to be set before SW_RST.

This is speculative without AST2700 MACCR documentation. RMII uses the
50MHz REF_CLK and RGMII uses RXC/TXC. If SW_RST completion or clock-domain
sync depends on the selected interface, could the reset time out with
"Hardware reset failed"? Or could the MAC start with its state synced to
the wrong clock?

Would it be safer to fold RMII_ENABLE into the maccr passed to
ftgmac100_reset_mac() and into the value ftgmac100_stop_hw() writes?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-support_ast2700-v6-0-238020bf46cf%40aspeedtech.com

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

* Re: [PATCH net-next v6 5/7] net: ftgmac100: Require phy-mode for AST2700
  2026-11-12  8:39 ` [PATCH net-next v6 5/7] net: ftgmac100: Require phy-mode for AST2700 Jacky Chou
@ 2026-11-16 13:54   ` netdev-bot+sashiko
  0 siblings, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-11-16 13:54 UTC (permalink / raw)
  To: jacky_chou
  Cc: andrew+netdev, davem, kuba, pabeni, robh, krzk+dt, conor+dt,
	ratbert, edumazet, hkallweit1, linux, netdev, devicetree,
	linux-kernel, andrew

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 2 · Medium: 0 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] The new AST2700 check in ftgmac100_mii_probe()
  (drivers/net/ethernet/faraday/ftgmac100.c, lines 1529-1535) can never…
- [High] The commit says it makes phy-mode required for AST2700 and fails
  probe when it is missing.
- [Low] In the series' binding change (commit "dt-bindings: net:
  ftgmac100: Add AST2700 compatible"), phy-mode is required for every…

--

net: ftgmac100: Require phy-mode for AST2700

This commit makes ftgmac100_mii_probe() fail with -EINVAL on AST2700 when
the phy-mode property is missing, instead of falling back to RGMII. The
stated goal is to make phy-mode a required property for AST2700, since
that SoC also supports RMII.

> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 9b7becb017262..5a578a62df673 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> @@ -1526,8 +1526,13 @@ static int ftgmac100_mii_probe(struct net_device *netdev)
>  
>  	/* Default to RGMII. It's a gigabit part after all */
>  	err = of_get_phy_mode(np, &phy_intf);
> -	if (err)
> +	if (err) {
> +		if (priv->mac_id == FTGMAC100_AST2700) {
> +			dev_err(priv->dev, "phy-mode is required for this SoC\n");
> +			return -EINVAL;
> +		}
>  		phy_intf = PHY_INTERFACE_MODE_RGMII;
> +	}

[Severity: High]
Can this new branch ever be reached on AST2700?

priv->mii_bus is only set by ftgmac100_setup_mdio(), and ftgmac100_probe()
only calls that for the Faraday, AST2400 and AST2500 variants:

drivers/net/ethernet/faraday/ftgmac100.c:ftgmac100_probe() {
    ...
	if (priv->mac_id == FTGMAC100_FARADAY ||
	    priv->mac_id == FTGMAC100_AST2400 ||
	    priv->mac_id == FTGMAC100_AST2500) {
		err = ftgmac100_setup_mdio(netdev);
    ...
}

So on AST2700 priv->mii_bus is always NULL, and ftgmac100_mii_probe()
returns before it gets to the new check:

drivers/net/ethernet/faraday/ftgmac100.c:ftgmac100_mii_probe() {
    ...
	if (!priv->mii_bus) {
		dev_err(priv->dev, "No MDIO bus available\n");
		return -ENODEV;
	}
    ...
}

That would mean the "phy-mode is required for this SoC" message is never
printed, and the patch has no effect at runtime.

The commit message also says:

  The driver currently defaults to RGMII when the "phy-mode" property
  is missing from the device tree.

Is that accurate for AST2700? These are the probe paths in
ftgmac100_probe_dt():

  - use-ncsi: ftgmac100_probe_ncsi() hard-codes PHY_INTERFACE_MODE_RMII.
  - phy-handle / fixed-link: of_phy_get_and_connect() calls
    of_get_phy_mode() itself and returns NULL if phy-mode is missing, so
    probe already fails with "Failed to connect to phy".
  - no "mdio" child: stops at the mii_bus check above.

None of these paths reach the RGMII fallback.

The binding patch in this series ("dt-bindings: net: ftgmac100: Add
AST2700 compatible") says its required phy-mode matches the driver's
probe-time requirement, but this check doesn't seem to provide that.

The later patches in the series ("net: ftgmac100: Add AST2700 upper DMA
address support", "net: ftgmac100: Allow building on ARM64") don't touch
ftgmac100_mii_probe() or ftgmac100_probe_dt(). The check would still be
unreachable at the end of the series.

Would it make more sense to put this check on a path AST2700 actually
takes, for example at the top of ftgmac100_probe_dt()?

[Severity: High]
Apart from the reachability question above, some AST2700 probe paths
still succeed without phy-mode and never read it.

If the node has an "mdio" child but no phy-handle, fixed-link or
use-ncsi, ftgmac100_probe_dt() skips the legacy block and returns 0 with
no PHY attached:

drivers/net/ethernet/faraday/ftgmac100.c:ftgmac100_probe_dt() {
    ...
	if (!ftgmac100_has_child_node(np, "mdio")) {
		...
		err = ftgmac100_mii_probe(netdev);
		...
	}

	return 0;
}

The use-ncsi path also connects the fixed PHY with a hard-coded
PHY_INTERFACE_MODE_RMII and ignores phy-mode.

In the mdio-child case, netdev->phydev is still NULL after a successful
probe. Could opening the interface then oops in
ftgmac100_reset_and_config_mac()?

drivers/net/ethernet/faraday/ftgmac100.c:ftgmac100_reset_and_config_mac() {
    ...
	if (priv->is_aspeed && priv->netdev->phydev->interface == PHY_INTERFACE_MODE_RMII) {
    ...
}

ftgmac100_start_hw() has the same kind of unchecked dereference through
the RMII quirk:

	if ((priv->quirks & FTGMAC100_QUIRK_RMII_ENABLE) &&
	    phydev->interface == PHY_INTERFACE_MODE_RMII) {

This would happen through ftgmac100_open()->ftgmac100_reset_and_config_mac(),
whether or not the DT has phy-mode. It also contradicts the claim in
"net: ftgmac100: Enable AST2700 RMII support" that ftgmac100_probe_dt()
always attaches a phy_device.

The dereference in ftgmac100_reset_and_config_mac() already existed for
AST2600 (since af350ee72e9dda). Earlier patches in this series make it
reachable on AST2700.

Should the phy-mode check go at the top of ftgmac100_probe_dt() (or in
ftgmac100_probe()), before the branching, instead of in the legacy
MDIO-scan helper?

[Severity: Low]
This isn't a bug, but the binding and the driver disagree on the NC-SI
path. "dt-bindings: net: ftgmac100: Add AST2700 compatible" requires
phy-mode for every aspeed,ast2700-mac node, including use-ncsi nodes:

  - if:
      properties:
        compatible:
          contains:
            const: aspeed,ast2700-mac
    then:
      required:
        - phy-mode

ftgmac100_probe_dt() hands off to ftgmac100_probe_ncsi() as soon as
use-ncsi is present, and that path connects with a fixed RMII mode:

	err = phy_connect_direct(netdev, phydev, ftgmac100_adjust_link,
				 PHY_INTERFACE_MODE_RMII);

An NC-SI node with phy-mode = "rgmii" would pass schema validation, but
the value is silently ignored. ftgmac100_start_hw() would still set
FTGMAC100_MACCR_RMII_ENABLE.

Should the binding exempt use-ncsi nodes, or should the driver check
phy-mode against RMII on that path?

>  
>  	/* Aspeed only supports these. I don't know about other IP
>  	 * block vendors so I'm going to just let them through for

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-support_ast2700-v6-0-238020bf46cf%40aspeedtech.com

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

* Re: [PATCH net-next v6 6/7] net: ftgmac100: Add AST2700 upper DMA address support
  2026-11-12  8:39 ` [PATCH net-next v6 6/7] net: ftgmac100: Add AST2700 upper DMA address support Jacky Chou
@ 2026-11-16 13:54   ` netdev-bot+sashiko
  0 siblings, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-11-16 13:54 UTC (permalink / raw)
  To: jacky_chou
  Cc: andrew+netdev, davem, kuba, pabeni, robh, krzk+dt, conor+dt,
	ratbert, edumazet, hkallweit1, linux, netdev, devicetree,
	linux-kernel, andrew

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] On AST2700 (FTGMAC100_QUIRK_DMA_35BIT), the driver stores DMA
  address bits 34:32 only in RXDES2[18:16]/TXDES2[18:16].
- [Low] The new register-map comment in ftgmac100.h says '/* reserved
  0xcc - 0x178 */', and the patch defines only…

--

net: ftgmac100: Add AST2700 upper DMA address support

On AST2700, this patch programs the high halves of the RX and TX
descriptor ring bases. It also stores DMA address bits 34:32 in bits
18:16 of rxdes2/txdes2, and rebuilds the full address from the
descriptors before unmapping. A 35-bit DMA mask is set, and all of this
is gated behind a new FTGMAC100_QUIRK_DMA_35BIT match-data quirk.

> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 5a578a62df673..263594de0e072 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c

[ ... ]

> @@ -601,6 +612,9 @@ static bool ftgmac100_rx_packet(struct ftgmac100 *priv, int *processed)
>  
>  	/* Tear down DMA mapping, do necessary cache management */
>  	map = le32_to_cpu(rxdes->rxdes3);
> +	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
> +		map |= (u64)FIELD_GET(FTGMAC100_RXDES2_RXBUF_BADR_HI,
> +				     le32_to_cpu(rxdes->rxdes2)) << 32;

[Severity: Medium]
Is it safe to rebuild the unmap address from rxdes2 after the MAC has
completed the descriptor?

The driver keeps no CPU-side copy of the mapped dma_addr_t. Bits 34:32
are stored only in RXDES2[18:16], and in TXDES2[18:16] on the TX side.

In ftgmac100.h, struct ftgmac100_rxdes still describes rxdes2 as a field
the hardware writes:

	__le32	rxdes2; /* length/type on AST2500 */

and struct ftgmac100_txdes still calls txdes2 reserved:

	__le32	txdes2; /* Reserved */

Neither comment is updated. Nothing in the patch or the commit message
says whether AST2700 leaves bits 18:16 alone when it writes the
descriptor back.

If the MAC writes any of those bits on completion, dma_unmap_single()
gets the wrong 35-bit handle, both here and in ftgmac100_free_buffers().
The real mapping or swiotlb slot would leak, and the call could sync or
unmap a different mapping. ftgmac100_free_tx_packet() relies on txdes2 in
the same way.

The drop label in ftgmac100_rx_packet() also rewrites only rxdes0 before
it gives the descriptor back to the MAC:

drop:
	/* Clean rxdes0 (which resets own bit) */
	rxdes->rxdes0 = cpu_to_le32(status & priv->rxdes0_edorr_mask);

In that case, would the next frame be DMA'd to the same low 32 bits but
in a different 4 GiB window? A remote sender can reach this path with
runt, CRC error, oversize or fragmented frames.

Can the AST2700 writeback behaviour for RXDES2/TXDES2 bits 18:16 be
confirmed? Alternatively, would it be safer to keep the full dma_addr_t
on the CPU side and update the descriptor comments to match? Any later
controller that opts into FTGMAC100_QUIRK_DMA_35BIT would inherit the
same assumption.

[ ... ]

> diff --git a/drivers/net/ethernet/faraday/ftgmac100.h b/drivers/net/ethernet/faraday/ftgmac100.h
> index 8c35c895b1465..0c244b1c0a351 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.h
> +++ b/drivers/net/ethernet/faraday/ftgmac100.h
> @@ -57,6 +57,9 @@
>  #define FTGMAC100_OFFSET_RX_RUNT	0xc0
>  #define FTGMAC100_OFFSET_RX_CRCER_FTL	0xc4
>  #define FTGMAC100_OFFSET_RX_COL_LOST	0xc8
> +/* reserved 0xcc - 0x178 */
> +#define FTGMAC100_OFFSET_TXR_BADDR_HIGH	0x17c
> +#define FTGMAC100_OFFSET_RXR_BADDR_HIGH	0x18c

[Severity: Low]
Is 0x178 really reserved?

Both HIGH registers sit at +4 within a 16-byte aligned block. That looks
like per-ring {LOW, HIGH} pairs: TX at 0x178/0x17c, possibly high
priority TX at 0x180/0x184, and RX at 0x188/0x18c. The comment also
doesn't cover the 0x180 - 0x188 range.

Related to this, ftgmac100_init_hw() writes the low half to the legacy
register and the high half to the new one:

	iowrite32(lower_32_bits(priv->rxdes_dma), priv->base + FTGMAC100_OFFSET_RXR_BADR);
	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
		iowrite32(upper_32_bits(priv->rxdes_dma),
			  priv->base + FTGMAC100_OFFSET_RXR_BADDR_HIGH);

The TX ring is set up the same way, using FTGMAC100_OFFSET_NPTXR_BADR
and FTGMAC100_OFFSET_TXR_BADDR_HIGH.

Does AST2700 combine the legacy 0x24/0x20 registers with 0x18c/0x17c,
rather than using separate LOW registers at 0x188/0x178?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-support_ast2700-v6-0-238020bf46cf%40aspeedtech.com

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

* Re: [PATCH net-next v6 7/7] net: ftgmac100: Allow building on ARM64
  2026-11-12  8:39 ` [PATCH net-next v6 7/7] net: ftgmac100: Allow building on ARM64 Jacky Chou
@ 2026-11-16 13:54   ` netdev-bot+sashiko
  0 siblings, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-11-16 13:54 UTC (permalink / raw)
  To: jacky_chou
  Cc: andrew+netdev, davem, kuba, pabeni, robh, krzk+dt, conor+dt,
	ratbert, edumazet, hkallweit1, linux, netdev, devicetree,
	linux-kernel, andrew

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 2

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] On AST2700 (FTGMAC100_QUIRK_DMA_35BIT) the driver keeps no
  software copy of buffer DMA addresses.
- [Low] The commit message gives the wrong reason for dropping `depends
  on !64BIT || BROKEN` from FTGMAC100…
- [Low] The new MDIO_ASPEED help text in drivers/net/mdio/Kconfig (lines
  58-62) reads like a changelog, not like help text that stays in the…

--

net: ftgmac100: Allow building on ARM64

This commit lets the Faraday vendor menu and the FTGMAC100 driver be
selected on ARM64 for AST2700, and drops the !64BIT || BROKEN restriction.
It also changes the MDIO_ASPEED select condition from MACH_ASPEED_G6 to
ARCH_ASPEED and updates the MDIO_ASPEED help text.

> diff --git a/drivers/net/ethernet/faraday/Kconfig b/drivers/net/ethernet/faraday/Kconfig
> index 474073c7f94d7..9acc2d260c1f9 100644
> --- a/drivers/net/ethernet/faraday/Kconfig
> +++ b/drivers/net/ethernet/faraday/Kconfig

[ ... ]

> @@ -28,11 +28,10 @@ config FTMAC100
>  
>  config FTGMAC100
>  	tristate "Faraday FTGMAC100 Gigabit Ethernet support"
> -	depends on ARM || COMPILE_TEST
> -	depends on !64BIT || BROKEN
> +	depends on ARM || ARM64 || COMPILE_TEST

[Severity: Low]

The commit message says:

  The driver now programs the upper DMA address fields, so it no longer
  needs to be marked BROKEN for 64-bit builds.

Is that why the restriction was there in the first place? The
!64BIT || BROKEN dependency arrived in eac8173e7b99 ("net: faraday add
nds32 support."), together with COMPILE_TEST, on both FTMAC100 and
FTGMAC100. It looks like a general "not 64-bit clean" marker and has
nothing to do with DMA address width.

The upper address programming is also only done under
FTGMAC100_QUIRK_DMA_35BIT, and only the AST2700 match data sets that
quirk. For example, ftgmac100_init_hw():

	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
		iowrite32(upper_32_bits(priv->rxdes_dma),
			  priv->base + FTGMAC100_OFFSET_RXR_BADDR_HIGH);

and ftgmac100_probe():

	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT) {
		err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(35));

The other compatibles never program the high fields. They work on a
64-bit kernel only because they keep the default 32-bit DMA mask.

Also, with no 64BIT restriction left, this line lets the driver build on
every 64-bit architecture under COMPILE_TEST (x86_64, riscv64, and so on),
not only on ARM64 as the subject says.

Could the commit message describe both of these points?

[Severity: Medium]

This change makes the 35-bit DMA path reachable on real AST2700 hardware.
On that path the driver keeps no software copy of the buffer DMA
addresses. It stores the upper bits only in the device-owned descriptor,
in ftgmac100_alloc_rx_buf():

	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
		rxdes->rxdes2 = cpu_to_le32(FIELD_PREP(FTGMAC100_RXDES2_RXBUF_BADR_HI,
						       upper_32_bits(map)));
	rxdes->rxdes3 = cpu_to_le32(lower_32_bits(map));

After the MAC completes the descriptor, ftgmac100_rx_packet() rebuilds
the handle from rxdes2 and passes it to dma_unmap_single():

	map = le32_to_cpu(rxdes->rxdes3);
	if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
		map |= (u64)FIELD_GET(FTGMAC100_RXDES2_RXBUF_BADR_HI,
				     le32_to_cpu(rxdes->rxdes2)) << 32;

ftgmac100_free_buffers() rebuilds it the same way. ftgmac100_free_tx_packet()
does the same with txdes2.

The header describes rxdes2 as a word the device writes:

	__le32	rxdes2; /* length/type on AST2500 */

Does the AST2700 MAC leave bits 18:16 of rxdes2 (and txdes2) untouched
when it writes the descriptor back?

If it rewrites the whole word, every buffer mapped above 4 GiB would be
unmapped with the wrong DMA address. With dma-direct on arm64 that means
cache maintenance on the wrong physical range. With swiotlb or an IOMMU it
means the wrong bounce buffer or IOVA.

Neither the code nor the commit message says whether these bits are
preserved. If that is not guaranteed, would it be safer to keep the DMA
handles in a software array next to rx_skbs and tx_skbs?

>  	select PHYLIB
>  	select FIXED_PHY
> -	select MDIO_ASPEED if MACH_ASPEED_G6
> +	select MDIO_ASPEED if ARCH_ASPEED
>  	select CRC32
>  	help
>  	  This driver supports the FTGMAC100 Gigabit Ethernet controller
> diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig
> index 6f272fae4bb55..ec1794cc64b09 100644
> --- a/drivers/net/mdio/Kconfig
> +++ b/drivers/net/mdio/Kconfig
> @@ -50,12 +50,16 @@ config MDIO_ASPEED
>  	depends on OF_MDIO && HAS_IOMEM
>  	help
>  	  This module provides a driver for the independent MDIO bus
> -	  controllers found in the ASPEED AST2600 SoC. This is a driver for the
> -	  third revision of the ASPEED MDIO register interface - the first two
> -	  revisions are the "old" and "new" interfaces found in the AST2400 and
> -	  AST2500, embedded in the MAC. For legacy reasons, FTGMAC100 driver
> -	  continues to drive the embedded MDIO controller for the AST2400 and
> -	  AST2500 SoCs, so say N if AST2600 support is not required.
> +	  controllers found in the ASPEED AST2600 and AST2700 SoCs. This is a
> +	  driver for the third revision of the ASPEED MDIO register interface -
> +	  the first two revisions are the "old" and "new" interfaces found in
> +	  the AST2400 and AST2500, embedded in the MAC. For legacy reasons,
> +	  FTGMAC100 driver continues to drive the embedded MDIO controller for
> +	  the AST2400 and AST2500 SoCs. AST2700 has no dedicated MACH_ASPEED_G7
> +	  symbol and is only gated by ARCH_ASPEED, so FTGMAC100 now
> +	  unconditionally selects this driver on every ARCH_ASPEED platform,
> +	  including the older AST2400/AST2500 SoCs where it has no MDIO node to
> +	  bind to.

[Severity: Low]

This isn't a bug, but this help text reads like a changelog. The word
"now" only makes sense relative to this patch, and the sentence is about
Kconfig internals rather than what the option does.

"unconditionally" is also not quite accurate. The select is:

	select MDIO_ASPEED if ARCH_ASPEED

inside config FTGMAC100, so it only applies when FTGMAC100 is enabled on
an ARCH_ASPEED kernel.

The old advice ("say N if AST2600 support is not required") is removed and
nothing replaces it, even though the prompt is still visible to users.
Could the text say instead that saying N has no effect when FTGMAC100 is
enabled on ARCH_ASPEED, and when N is a sensible answer?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-support_ast2700-v6-0-238020bf46cf%40aspeedtech.com

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

end of thread, other threads:[~2026-11-16 13:54 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12  8:39 [PATCH net-next v6 0/7] net: ftgmac100: Add AST2700 support Jacky Chou
2026-11-12  8:39 ` [PATCH net-next v6 1/7] dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone Jacky Chou
2026-11-12 18:43   ` Conor Dooley
2026-11-16 13:54   ` netdev-bot+sashiko
2026-11-12  8:39 ` [PATCH net-next v6 2/7] dt-bindings: net: ftgmac100: Add AST2700 compatible Jacky Chou
2026-11-12 18:44   ` Conor Dooley
2026-11-16 13:54   ` netdev-bot+sashiko
2026-11-12  8:39 ` [PATCH net-next v6 3/7] net: ftgmac100: Add AST2700 compatible support Jacky Chou
2026-11-16 13:54   ` netdev-bot+sashiko
2026-11-12  8:39 ` [PATCH net-next v6 4/7] net: ftgmac100: Enable AST2700 RMII support Jacky Chou
2026-11-16 13:54   ` netdev-bot+sashiko
2026-11-12  8:39 ` [PATCH net-next v6 5/7] net: ftgmac100: Require phy-mode for AST2700 Jacky Chou
2026-11-16 13:54   ` netdev-bot+sashiko
2026-11-12  8:39 ` [PATCH net-next v6 6/7] net: ftgmac100: Add AST2700 upper DMA address support Jacky Chou
2026-11-16 13:54   ` netdev-bot+sashiko
2026-11-12  8:39 ` [PATCH net-next v6 7/7] net: ftgmac100: Allow building on ARM64 Jacky Chou
2026-11-16 13:54   ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox