mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Telaak via B4 Relay <devnull+joseph.telaak.dev@kernel.org>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,  Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	 Richard Cochran <richardcochran@gmail.com>,
	 Alexandre Torgue <alexandre.torgue@foss.st.com>,
	 Jose Abreu <joabreu@synopsys.com>,
	 Maxime Chevallier <maxime.chevallier@bootlin.com>,
	 Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Chuanhong Guo <gch981213@gmail.com>,
	 Russell King <linux@armlinux.org.uk>,
	linux-mips@vger.kernel.org,  netdev@vger.kernel.org,
	devicetree@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 Joseph Telaak <joseph@telaak.dev>
Subject: [PATCH net-next v2 0/3] net: stmmac: Add the Siflower SF19A2890 glue
Date: Tue, 01 Dec 2026 02:00:24 -0500	[thread overview]
Message-ID: <20261201-sf19a2890-gmac-v2-0-8d2c513db496@telaak.dev> (raw)

The Siflower SF19A2890, a MIPS SoC for home routers, has a DesignWare
GMAC 3.73a. Its interface type and RGMII clock delays are set in a small
configuration block next to its clock and reset manager. This series
adds a binding and the glue.

The SoC support itself (MACH_SIFLOWER_MIPS) comes through the MIPS or
the clk tree, both of which carry its patch; until then the glue builds
with COMPILE_TEST.

v1 took the delays in picoseconds from rx-internal-delay-ps and
tx-internal-delay-ps. Andrew asked whether a TX delay of 0 really adds
nothing, and that cannot be established: the TX delay line has no
bypass, Siflower publishes no timing for the SoC, and its own material
gives 40 ps per step where a sweep measures 55 ps. So v2 does what
Siflower's and GL.iNet's firmware and Chuanhong Guo's driver, which this
glue is based on, do. Siflower calibrates both delay lines of each unit
at the factory and stores the settings, in the lines' own steps, in the
factory partition; the glue programs them from that nvmem cell, and
without one it leaves the lines as the bootloader set them. Nothing in
picoseconds enters the binding, which rejects rx-internal-delay-ps and
tx-internal-delay-ps.

Andrew also suggested making the glue depend on BROKEN, so that device
trees could be broken once the delays are understood. v2 does not,
because the device tree no longer holds a delay value: the board's tree
says only where the unit's calibration is stored. If the delays later
need handling differently, only the glue changes, and existing device
trees keep working.

Patch 1 lets ethernet-controller.yaml take a second nvmem cell after
mac-address, named by the device's own binding. Today it allows only
mac-address, and every MAC binding includes it, so no binding can add a
calibration cell.

The measurements behind this, on the GL.iNet GL-SFT1200, where the GMAC
is the CPU port of a MaxLinear GSW150 switch over RGMII:

- Sweeping each delay register over 0-255 at 1000 Mb/s, the working
  windows repeat every 145 steps (TX) and 144.5 steps (RX), one 8 ns
  period of the RGMII clock, so a step is about 55 ps. The TX eye is
  about 3.1 ns wide and the RX eye about 1.75 ns.
- With every programmed delay at 0 the link passes traffic, at the early
  edge of both eyes. Sweeping the switch's own delays with the MAC's at
  0, switch to MAC works with 0 to 1.5 ns added and fails from 2 ns, and
  MAC to switch works with 0 to 2 ns and fails from 2.5 ns. The RX delay
  line at step 0 adds at most about 0.25 ns over its bypass.
- The GSW150 datasheet, which is public, says that with its delay
  register at 0 the switch transmits with clock and data aligned to
  within 0.5 ns and needs the clock 1.0 to 2.6 ns after the data. So the
  MAC's input samples about 1.1 to 1.3 ns earlier than an RGMII v1.3
  receiver, and the RX delay it needs, about 0.7 ns, is its own. For TX
  the datasheet only bounds the MAC's step-0 delay, its output skew and
  the board together to -0.24 to +1.23 ns.
- The two units I have read 0x11/0x0a and 0x10/0x09 from their
  calibration cells. GL.iNet's bootloader programs 0x17 for both lines
  on every boot, which leaves RX about 0.25 ns inside the edge of the
  measured window, so the calibration is worth taking.

Tested on a GL-SFT1200 with the GSW150 driver:
- each of WAN, LAN 1 and LAN 2 links at 1000 Mb/s full duplex and
  passes iperf3 both ways (160-205 Mb/s out, 262-273 Mb/s in, well
  under line rate; I have not looked into where the limit is);
- 10 GB each way through LAN 1, after which every CRC, alignment,
  error, drop, overflow and underflow counter on eth0 and lan1 is 0;
- 50 link down/up cycles, after which the link and traffic recover;
- the MAC address from the factory partition, and ethtool reporting the
  link without the STMMAC_FLAG_HAS_INTEGRATED_PCS that the OpenWrt
  driver needed;
- v2 on a second GL-SFT1200, whose bootloader leaves both delay
  registers at 0x17: the glue programs the unit's calibration, 0x10 and
  0x09; 50 of 50 pings of 1400 bytes; iperf3 201 Mb/s out and 288 Mb/s
  in with no retransmits; and every CRC, error and drop counter at 0.

---
Changes in v2:
- Patch 1 (new): let ethernet-controller.yaml take a device-specific
  nvmem cell after mac-address.
- Patches 2 and 3 were patches 1 and 2 in v1.
- Take the RGMII delays from the unit's factory calibration, the
  rgmii-delay nvmem cell, in the delay lines' own steps, instead of
  rx-internal-delay-ps and tx-internal-delay-ps, which the binding now
  rejects (Andrew).
- Do not depend on BROKEN: the device tree holds no delay value, so
  later changes stay in the glue (Andrew).
- Pass the device to the delay helper instead of storing it (Maxime).
- Add a MAINTAINERS entry for the glue and its binding (Maxime).
- Set has_internal_tx_delay and has_internal_rx_delay where the MAC adds
  the delays, so the same delays are not asked of the PHY.
- Probe with devm_stmmac_pltfr_probe() and drop .remove.
- Say in a comment that the RX delay line is bypassed while RX_DELAY_EN
  is clear (Andrew).
- Describe the measured delays and what the GSW150 datasheet and
  Siflower's firmware say about them.
- Link to v1: https://patch.msgid.link/20261104-sf19a2890-gmac-v1-0-a15965a49574@telaak.dev

---
Joseph Telaak (3):
      dt-bindings: net: ethernet-controller: Allow a device-specific nvmem cell
      dt-bindings: net: Add Siflower SF19A2890 GMAC
      net: stmmac: Add Siflower SF19A2890 glue

 .../bindings/net/ethernet-controller.yaml          |  11 +-
 .../bindings/net/siflower,sf19a2890-gmac.yaml      | 119 +++++++++++++++
 .../devicetree/bindings/net/snps,dwmac.yaml        |   1 +
 MAINTAINERS                                        |   7 +
 drivers/net/ethernet/stmicro/stmmac/Kconfig        |  12 ++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |   1 +
 .../net/ethernet/stmicro/stmmac/dwmac-sf19a2890.c  | 167 +++++++++++++++++++++
 7 files changed, 315 insertions(+), 3 deletions(-)
---
base-commit: d35a725a7c96504f7deece4dfaa83bee6a98fe0e
change-id: 20261102-sf19a2890-gmac-4fb4808f869c

Best regards,
--  
Joseph Telaak <joseph@telaak.dev>



             reply	other threads:[~2026-12-01  7:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  7:00 Joseph Telaak via B4 Relay [this message]
2026-12-01  7:00 ` [PATCH net-next v2 1/3] dt-bindings: net: ethernet-controller: Allow a device-specific nvmem cell Joseph Telaak via B4 Relay
2026-12-01  7:00 ` [PATCH net-next v2 2/3] dt-bindings: net: Add Siflower SF19A2890 GMAC Joseph Telaak via B4 Relay
2026-12-01  7:00 ` [PATCH net-next v2 3/3] net: stmmac: Add Siflower SF19A2890 glue Joseph Telaak via B4 Relay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201-sf19a2890-gmac-v2-0-8d2c513db496@telaak.dev \
    --to=devnull+joseph.telaak.dev@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@kernel.org \
    --cc=gch981213@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=joseph@telaak.dev \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®