DORMANTno replies

[RFC PATCH] net: stmmac: dwmac-generic: add ACPI support for Phytium FT-2000/4 and D2000

From: yueqiang_fan <hidden>
Date: 2026-08-11 03:56:40

Hi all,

The Phytium FT-2000/4 and D2000 SoCs integrate a DesignWare GMAC that
is exposed to ACPI as "FTGM0001" / "PHYT0004".  The generic dwmac
platform driver only supports DT and legacy platform data, so on ACPI
(UEFI) firmware the MACs are never probed and there is no network
device.  Kylin ships a vendor patch for this; this RFC proposes an
upstream version.

Patch (also available at):
https://github.com/Bitllion/phytium-d2000-netfix/blob/main/upstream/0001-net-stmmac-dwmac-generic-ACPI-support-for-Phytium.patch

Summary of the change to drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c:

- Add an ACPI device ID table (FTGM0001 / PHYT0004).
- Add dwmac_generic_acpi_probe_config(): mirrors the generic
  "snps,dwmac" DT defaults, with values from the vendor (Kylin)
  firmware DTB:
  * phy-mode rgmii-txid.  Both SoC MACs share the same two RTL8211F
    PHYs on a common MDIO wiring (each bus sees both PHYs at addr 0
    and 7), so pin each MAC to its own PHY address (0 for instance
    :00, 7 for :01) instead of scanning.
  * single DMA channel (dwmac1000-compatible core): use one TX/RX
    queue.  The netdev is always allocated with MTL_MAX_TX/RX_QUEUES
    queues, but the per-queue DMA arrays are only set up for
    tx/rx_queues_to_use queues and stmmac_xmit() has no
    queue >= tx_queues_to_use guard.  With real_num_tx_queues = 1,
    stmmac_select_queue() reduces every frame to queue 0, so the
    missing guard is never hit.
  * has_gmac (dwmac1000 hwif; the dwmac4 hwif fails MDIO on this
    core), AXI burst lengths 16/8/4, pbl 16 with fixed burst, FIFO
    sizes 0x1000.
- All values can be overridden through ACPI _DSD properties
  (phy-mode, phy-addr, tx/rx-queues-to-use, snps,pbl).

Tested on a Phytium D2000 board (JWIPC IF24TH01) with Ubuntu 24.04 /
kernel 6.8.0: both MACs probe (PHYT0004:00/01), interfaces
enaphyt4i0/1 are created, and cable link-up + DHCP work with no
transmit watchdog and no kernel panic.

Two questions for the list:
1. Is an ACPI match table + hardcoded platform defaults acceptable for
   dwmac-generic, or would a separate dwmac-phytium.c (like
   dwmac-intel.c) be preferred?
2. The missing queue >= tx_queues_to_use guard in stmmac_xmit() looks
   like a generic bug (regression since 6.8 removed the guard; any
   dwmac platform with tx_queues_to_use < 8 can dereference NULL
   tx_skbuff on non-GSO frames hashed to a high queue).  Should I
   prepare a separate fix for stmmac_main.c?

Signed-off-by: Yueqiang Fan <redacted>

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help