net: dsa: microchip: let the board state its reset timing
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | dt-bindings: net: dsa: microchip: add reset timing propertiesDocumentation/ | +12 | 2 replies | |
| 2/2 | net: dsa: microchip: take the reset timings from the device treedrivers/ | +18 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH net-next 0/2] net: dsa: microchip: let the board state its reset timing
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
Signature · 1 line
2.43.0