mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-10 20:48:12 +00:00
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 <przemyslaw.korba@intel.com> Signed-off-by: Grzegorz Nitka <grzegorz.nitka@intel.com> Tested-by: Alexander Nowlin <alexander.nowlin@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
parent
e72d09173c
commit
41dfc37886
6 changed files with 424 additions and 50 deletions
Loading…
Add table
Add a link
Reference in a new issue