> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf Of 
> Grzegorz Nitka
> Sent: Monday, August 3, 2026 4:35 AM
> To: [email protected]
> Cc: Kitszel, Przemyslaw <[email protected]>; 
> [email protected]; [email protected]; Kubalewski, Arkadiusz 
> <[email protected]>; Korba, Przemyslaw 
> <[email protected]>; [email protected]; [email protected]; 
> Nguyen, Anthony L <[email protected]>; [email protected]; 
> [email protected]; [email protected]; [email protected]
> Subject: [Intel-wired-lan] [PATCH v3 iwl-next 2/3] ice: add TSPLL DPLL device 
> and TIME_REF pin for E825
> 
> This extends the E825 advanced sync-timing support introduced by the tx-clk 
> series, which added the TXC DPLL device for TX reference clock control. The 
> TSPLL, the source timer PLL, is now also exposed through > the dpll subsystem 
> so that its lock status and clock source selection are visible and 
> controllable from userspace.
> 
> On E825 devices the TSPLL is the source timer PLL, distinct from the EEC and 
> PPS DPLLs used on E810. Register it as a DPLL_TYPE_GENERIC device for owner 
> PFs.
> 
> Add struct ice_dplls::tspll_in, a fwnode-backed input pin named "time_ref". 
> The state_on_dpll_get callback queries ICE_CGU_R23 via
> ice_tspll_get_clk_src() and returns CONNECTED when TIME_REF is selected as 
> clock source, DISCONNECTED otherwise. The state_on_dpll_set callback switches 
> the source between TIME_REF and TCXO via the new
> ice_tspll_set_cfg() helper. Registration is deferred via the dpll notifier 
> path if the pin is not yet visible in the subsystem at probe time.
> 
> Initialize TSPLL DPLL state from direct clock-source/lock reads so the first 
> published state reflects hardware and prev_dpll_state matches.
> During periodic polling, the DPLL worker consumes 
> READ_ONCE(pf->ptp.tspll_locked), maintained and recovered by the PTP periodic 
> worker. When the TSPLL clock source is TCXO (TIME_REF pin not selected), 
> UNLOCKED is reported unconditionally to reflect the free-running state of the 
> oscillator regardless of the raw lock bit.
> To avoid stale lock-status reads after synchronous source changes, the set 
> callback now refreshes tspll.dpll_state immediately and emits a DPLL change 
> notification when the cached state changed.
> 
> If a TSPLL reconfiguration is applied but the PLL has not yet re-acquired 
> lock, treat the internal -EAGAIN result as success so the PTP periodic worker 
> can complete recovery, while real -EBUSY failures from reset/SBQ paths still 
> propagate to userspace.
> 
> The TSPLL userspace reconfiguration path (state_on_dpll_set) and the PTP 
> periodic worker (ice_ptp_tspll_monitor) both read TSPLL HW state and write 
> the pf->ptp.tspll_locked cache consumed by the DPLL worker.
> Serialize both with pf->dplls.lock across their HW-read -> cache-write 
> sequence; otherwise a preempted monitor could overwrite an accurate cache 
> update from the DPLL callback with stale HW state. The mutex > lifetime is 
> lifted to PF-features scope (initialized in
> ice_init_features() before ice_ptp_init(), destroyed in
> ice_deinit_features() after ice_ptp_release()) so the PTP monitor can take it 
> unconditionally regardless of DPLL init state.
> 
> Extend ice_dpll_deinit_txclk_pins() with a "flush" parameter so the
> E825 init error path for the TSPLL fwnode pin can tear down TXCLK pins 
> without flushing pf->dplls.wq. If the flush ran here, notifier work items 
> queued during earlier init steps would be blocked on
> pf->dplls.dpll_init, which is only completed at the unregister_pins
> label reached after this teardown. destroy_workqueue() at that label drains 
> the queued items safely. Existing full-teardown callers pass flush=true and 
> keep current behavior.
> 
> Reviewed-by: Przemyslaw Korba <[email protected]>
> Signed-off-by: Grzegorz Nitka <[email protected]>
> ---
>  drivers/net/ethernet/intel/ice/ice_dpll.c  | 420 ++++++++++++++++++---
>  drivers/net/ethernet/intel/ice/ice_dpll.h  |   4 +
>  drivers/net/ethernet/intel/ice/ice_main.c  |   9 +
>  drivers/net/ethernet/intel/ice/ice_ptp.c   |  12 +
>  drivers/net/ethernet/intel/ice/ice_tspll.c |  34 +-
>  drivers/net/ethernet/intel/ice/ice_tspll.h |   2 +
>  6 files changed, 426 insertions(+), 55 deletions(-)

Tested-by: Alexander Nowlin <[email protected]>

Reply via email to