On the High point (csr_clk_mhz == 0):
> What happens on platforms that request tmouten but have no stmmac_clk,
> or whose stmmac_clk runs below 1 MHz? In that case csr_clk_mhz stays 0.
Nothing changes for those platforms: NTMRMD is left at 0, exactly as it is
today, so the checker stays disabled there and the patch is a strict
improvement (it arms the timer where a CSR clock is available and is a
no-op elsewhere). Falling back to plat->clk_csr is not viable because
clk_csr is a frequency *band* index (STMMAC_CSR_250_300M and friends), not
a rate, so it cannot produce the exact TMR value (CSR clocks per 1us).
Leaving TMOUTEN off when the clock is missing would be a behavioural change
for platforms that already request it, which is worse than the status quo;
Maxime already agreed that ASP without a CSR clock is legitimate (e.g. the
GMAC5 PCI device). The separate observation that stmmac_clk is not always
the CSR clock is theoretical -- as the review notes, no in-tree platform
hits it (Intel has tmouten = 0 and no XGMAC).
On the Medium point (4s timeout and the resulting reset):
A safety timeout is an uncorrectable error by design, so the full reset via
stmmac_global_err() is the existing intended safety response, not something
this patch adds; "reported" in the commit message refers to the safety
interrupt now firing. The 4s value was chosen to exceed a single
maximum-quanta PAUSE frame (~3.36s at 10 Mb/s) with margin. Whether
back-to-back PAUSE frames keep the FSM "active" and thereby suppress the
timeout is undocumented hardware behaviour that cannot be confirmed from
the databook, so longer encodings only shift the threshold and add
detection latency. 4s was acked by Maxime.
The XGMAC side programs the timer whenever csr_clk_mhz is non-zero, without
checking tmouten; that matches how dwxgmac3_safety_feat_config() already
sets XGMAC_PRTYEN and XGMAC_TMOUTEN unconditionally.
Regards,
Zxyan