mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: dsa: microchip: let the board state its reset timing
@ 2026-10-02 13:55 Rodolfo Giometti
  2026-10-02 13:55 ` [PATCH net-next 1/2] dt-bindings: net: dsa: microchip: add reset timing properties Rodolfo Giometti
  2026-10-02 13:55 ` [PATCH net-next 2/2] net: dsa: microchip: take the reset timings from the device tree Rodolfo Giometti
  0 siblings, 2 replies; 3+ messages in thread
From: Rodolfo Giometti @ 2026-10-02 13:55 UTC (permalink / raw)
  To: Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Marek Vasut, netdev, devicetree, linux-kernel, Rodolfo Giometti

ksz_switch_register() waits a fixed 100ms after releasing the reset
line before it reads the chip ID. That figure comes from commit
1c45ba93d34c ("net: dsa: microchip: Adjust reset release timing to match
reference reset circuit"), which derives it from the reset circuit the
datasheet recommends: about 95ms for a 10k pull-up and a 10uF
capacitor. It is the timing of a reference board, and on one of our
boards it turns out to be too short.

The board is an i.MX93 with a KSZ9897 on LPSPI6 at 500kHz. Every boot
ended with

  ksz-switch spi0.0: unsupported switch detected ffffff00)

and no user ports, while a second board of the same family running the
very same image came up fine.

The bus is not at fault. With the switch already out of reset, reading
the chip ID through spidev on the failing board returns the expected
0x00989700, at the same speed and mode the driver uses. What differs is
how soon the part is ready. Driving the reset line by hand and polling
the chip ID every 11ms gives, on the failing board:

  reset asserted for 10ms  ->  answers 95-120ms after the rising edge
  reset asserted for  1s   ->  answers    ~160ms after the rising edge

So a probe that reads at 100ms is at best a coin flip there, and never
succeeds when the part comes out of a long reset. The board that works
is simply on the right side of the same margin, which is why one image
behaves differently on two boards.

Since this is a property of the board rather than of the driver, take
the delays from the device tree instead of hardcoding them, reusing
reset-assert-us and reset-deassert-us, which already carry exactly this
meaning for MDIO devices. The defaults keep the current behaviour, so
boards that do not set them are unaffected.

Tested on both boards with a 6.18-based NXP kernel, powered up from
cold, with the failing one given reset-deassert-us = <250000>. It now
detects the switch at every boot, and the one that already worked is
unchanged: same detection, no SPI errors or timeouts. On both, the
probe lands ~150ms later than before, which is the added wait showing
up where it should. On net-next the series was built, not run on
hardware.

Rodolfo Giometti (2):
  dt-bindings: net: dsa: microchip: add reset timing properties
  net: dsa: microchip: take the reset timings from the device tree

 .../bindings/net/dsa/microchip,ksz.yaml       | 12 +++++++++++
 drivers/net/dsa/microchip/ksz_common.c        | 20 +++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)


base-commit: 071876fd50482a68603a9460d80dd6dd58827ee1
-- 
2.43.0


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

end of thread, other threads:[~2026-10-02 13:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-02 13:55 [PATCH net-next 0/2] net: dsa: microchip: let the board state its reset timing Rodolfo Giometti
2026-10-02 13:55 ` [PATCH net-next 1/2] dt-bindings: net: dsa: microchip: add reset timing properties Rodolfo Giometti
2026-10-02 13:55 ` [PATCH net-next 2/2] net: dsa: microchip: take the reset timings from the device tree Rodolfo Giometti

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®