dpll/ice: Add generic DPLL type and full TX reference clock control for E825
Subsystems (5)
v10 cover dpll/ice: Add generic DPLL type and full TX reference clock control for E825
NOTE: This series is intentionally submitted on net-next (not intel-wired-lan) as early feedback of DPLL subsystem changes is welcomed. In the past possible approaches were discussed in [1].
This series adds TX reference clock support for E825 devices and exposes TX clock selection and synchronization status via the Linux DPLL subsystem.
Here is the high-level connection diagram for E825 device:
+------------------------------------------------------------------+ | | | +-----------------------------+ | | | | | | | MAC | | | |+------------+-----+ | | | ||RX/1588 |PHC|tspll<----\ | | +---+----+ ||MUX +---+-^---| | | | | E | RX >---------------------> | >--\ | | | | T | | /----------------> | >-\| | | | | H |----+ | |+---------+----^---+ || | | | | 1 | TX <----|----------------+TX MUX < OCXO | || | | | | |PLL | | || |--------| || | | | +---+----+ | /----+ <-ext_ref<-||-|----|------ext_ref | E | RX >----/ | || |--------+ || | | | | T | | | || < SyncE | || | | | | H |----+ | |+-----------^------+ || | | | | 2 | TX <----------------/ | | /------||-/ | | | |PLL | +------------|-|------||------+ | +---+----+ /--/ | || | | . | RX >--- | | || | | . | | +----------|----|------||--+ | | . |----+ | +-^-+--^+ || | | | | TX <--- | |EEC|PPS| || | | | |PLL | | +-------+ || | | +---+----+ | | <-CLK0/| | | | E | RX >--- | | DPLL | | | | | T | | | | <-CLK1-/ | | | H |----+ | | | | | | X | TX <--- | | <---SMA---< | | |PLL | | | | | | +---+----+ | | <---GPS---< | | | | | | | | | | <---...---< | | | | | | | | | +-------+ | | | | External timing module | | | +--------------------------+ | +------------------------------------------------------------------+
E825 hardware contains a dedicated TX clock domain with per-port source selection behavior that is distinct from PPS handling and from board-level EEC distribution. TX reference clock selection is device-wide, shared across ports, and mediated by firmware as part of link bring-up. As a result, TX clock selection intent may differ from effective hardware configuration, and software must verify outcome after link-up.
To support this, the series extends the DPLL core and the ice driver incrementally. The series also introduces DPLL_TYPE_GENERIC as a broad UAPI class for DPLL instances outside PPS/EEC categories. The intent is to keep type naming reusable and scalable across different ASIC topologies while preserving functional discoverability via driver/device context and pin topology.
This follows netdev discussion guidance that UAPI type naming should avoid location-specific or vendor-specific taxonomy, because such labels do not scale across different ASIC designs. The function of a given DPLL instance is already discoverable from driver/device context and pin topology, and does not require an additional narrow type identifier in UAPI.
At the same time, a separate DPLL object is still needed for E825 TX clock control/reporting semantics. Using DPLL_TYPE_GENERIC provides a reusable class for devices outside PPS/EEC without overfitting UAPI naming to one topology.
The relevant discussion is in [2].
Series content
- add a new generic DPLL type for devices outside PPS/EEC classes;
- relax DPLL pin registration rules for firmware-described shared pins and extend pin notifications with a source identifier;
- allow dynamic state control of SyncE reference pins where hardware supports it;
- add CPI infrastructure for PHY-side TX clock control on E825C;
- introduce a TX-clock DPLL device and TX reference clock pins (EXT_EREF0 and SYNCE) in the ice driver;
- extend the Restart Auto-Negotiation command to carry a TX reference clock index;
- implement hardware-backed TX reference clock switching, post-link verification, and TX synchronization reporting.
TXCLK pins report TX reference topology only. Actual synchronization success is reported via DPLL lock status, updated after hardware
verification: external TX references report LOCKED, while the internal ENET/TXCO source reports UNLOCKED.
This provides reliable TX reference selection and observability on E825 devices using standard DPLL interfaces, without conflating user intent with effective hardware behavior.
[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/
Changes in v10:
- rebased
Addressed AI review (Sashiko) concerns (all in patch 8/8):
- moved INIT_WORK(txclk_work) and added init_rwsem(txclk_notify_rwsem) next to mutex_init(&d->lock) in ice_dpll_init_e825() so both are initialized before any path that can fail and trigger ice_dpll_deinit()
- added struct rw_semaphore txclk_notify_rwsem to struct ice_dplls and used it (down_read across the whole critical region of ice_txclk_update_and_notify(), including the out-of-lock dpll_*_change_ntf() calls; down_write/up_write barrier in ice_dpll_deinit() to drain in-flight notifiers before pins and the TXC DPLL device are freed) - closes a use-after-free window on rmmod
- ice_dpll_txclk_state_on_dpll_set(): reject pin states other than CONNECTED/DISCONNECTED with -EINVAL and NL_SET_ERR_MSG() instead of silently treating them as a connect request
- ice_dpll_txclk_work(): on a failed switch, capture old/new pin pointers under the lock and emit dpll_pin_change_ntf() after dropping it, so userspace sees the requested pin flip back to DISCONNECTED and the effective pin to CONNECTED
- ice_dpll_txclk_work(): only clear txclk_switch_requested / roll back tx_clk_req when no newer request arrived while the lock was dropped, so a re-queued worker run picks up the updated value
- ice_txclk_update_and_notify(): replaced the
pf->dplls.txc.dpll = ERR_PTR(-ENODEV) "suppress notification" hack with an explicit local bool notify_dpll; the dpll_state update and the notification decision are made under the lock, the notification itself is emitted after unlock
- ice_ptp_setup_pf(): seed the per-PHY Tx reference clock usage map only on E825 and explained the "no locking needed" invariant in a comment (runs before pf->dplls.lock exists and before any link event or DPLL callback can observe the map)
- moved port_num/phy and tx_ref_clk locals into the E825-only branches where they are actually used
- ice_txclk_enable_peer(): use ice_pf_to_dev(pf) for dev_err() to match the rest of the file (was ice_hw_to_dev(&pf->hw))
- extended ctrl_pf->dplls.lock coverage in ice_txclk_set_clk() and ice_txclk_enable_peer() across both the usage check and the ice_cpi_ena_dis_clk_ref() AQ command so two PFs racing to switch to the same (phy, clk) cannot both observe clk_in_use == false and issue duplicate enables
Other:
- replaced ternary-for-statement-effect (`(clk == i) ? set_bit() :
clear_bit();`) with plain if/else in the two tx_refclks bitmap loops
- dropped 15 unused CFG_*/CFG_RESERVED* SERDES field defines in ice_ptp_hw.h; kept only CFG_ICTL_PCS_REF_SEL_RX_NT, CFG_ICTL_PCS_REF_SEL_TX_NT and REF_SEL_NT_ENET/EREF0/SYNCE which are actually consumed
- updated kernel-doc for struct ice_dpll
Patch 7/8:
- cosmetic: removed a stray double space in the ice_aq_set_link_restart_an() prototype
Patches 1-6: unchanged
Changes in v9:
- rebased
- fixed kernel-doc: member 'module_name' not described in 'dpll_pin' (patch 2/8) Addressed AI review concerns:
- reworded commit message to use 'src_clock_id' instead 'src_id' (patch 3/8)
- use rclk.num_parents when setting is_rclk_parent (patch 5/8)
- fixed retry mechanism in ice_cpi_wait_ack (patch 6/8)
- fixed txclk_switch_requested, tx_clk, tx_clk_req settings on HW failure (patch 8/8)
- use cancel_work_sync instead flush_work (patch 8/8)
- protect clearing ICE_FLAG_DPLL flag with mitex on DPLL
deinit (patch 8/8)
- dpll_state update and the notify_dpll decision are made inside the lock (patch 8/8)
Changes in v8:
- rebased
Addressed AI review concerns:
- caching the module name in the pin object at allocation time and using the cached string in netlink paths (patch 2/8)
- dropped references to netlink in the commit message for (patch 3/8, it's internal notification only)
- replaced the commit 4/8 with the new one (relax the capability check in dpll_pin_state_set)
- resolved potential teradown race between ice_dpll_deinit_txclk_pins and ice_dpll_pin_notify_work() that is about to register the SYNCE pin (patch 5/8)
- resolved potential path deadlock during driver probe and error path (patch 5/8)
- relaxed kernel-doc regarding cpi mutex usage (patch 6/8)
- fixed ice_cpi.c header (patch 6/8)
- fix retry mechanism in ice_cpi_wait_req0_ack0 (patch 6/8)
- fix potrntial leaving LM.REQ stuck asserted on the hardware (patch 6/8)
- fix kernel-doc for ice_cpi_ena_dis_clk_ref
- removed unused CPI definitions (patch 6/8)
- fix header inclusion (patch 6/8)
- addressed Sashiko issues for patch (8/8)
Changes in v7:
- rebased
- replace TXC-specific DPLL type with DPLL_TYPE_GENERIC (patch 1/8)
- update TXC framework to use DPLL_TYPE_GENERIC instead of DPLL_TYPE_GENERIC (patch 5/8)
- AI-review: added short trailing comment to the local mutex declaration to satisfy checkpatch report (patch 6/8)
Changes in v6:
- rebased
- AI-review: fix unprotected concurrent access to shared clock bitmap (patch 8/8)
- AI-review: fix potential issue in tx-clk pin state request handling ('already set' early-exit based now on tx_clk_req comparison, patch 8/8)
- AI-review: CPI transaction serialization (patch 6/8)
Changes in v5:
- rebased
- reworded cover letter
- replace 'ntfy_src' new argument name with 'src_clk_id' and use it consistently in DPLL notification calls (patch 3/8)
- reworded commit message (patch 5/8)
- use FIELD_PREP/GENMSK macros instead of struct bitfields (patch 6/8)
- reworded commit message (patch 5/8, patch 8/8)
- refactor the code to avoid sleeping while DPLL mutex is held (using work_queue, patch 8/8)
- added TXCLK pins and TXC DPLL notifications (patch 8/8)
- removed 'unused clock disable' mechanism from the scope of this series
Changes in v4:
- rebased
- edited, shortened the commit message in 3/8 patch
- moved ice_get_ctrl_pf to the header file (patch 8/8) and removed duplicated static definitions from ice_ptp and ice_txlck modules
- add NULL/invalid pointer checker for returned pointer from ice_get_ctrl_pf (patch 8/8)
- edited error message in case AN restart failure (patch 8/8)
Changes in v3:
- improved commit message (patch 1/8, AI review comment)
- improved deinitialization path in ice_dpll_deinit_txclk_pins to avoid potential NULL dereference. NULL checking moved to ice_dpll_unregister_pins (patch 5/8, found by AI review)
- removed redundant semicolon (patch 6/8)
Changes in v2:
- rebased
- added autogenerated DPLL files (patch 1/8)
- fixed checkpatch 'parenthesis alignment' warning (patch 2/8)
- fixed error path in ice_dpll_init_txclk_pins (AI warning, patch 5/8)
- fixed kdoc warnings (patch 6/8, patch 8/8)
Grzegorz Nitka (8):
dpll: add generic DPLL type
dpll: allow registering FW-identified pin with a different DPLL
dpll: extend pin notifier with notification source ID
dpll: allow fwnode pins to attempt state change without capability bit
ice: introduce TXC DPLL device and TX ref clock pin framework for E825
ice: implement CPI support for E825C
ice: add Tx reference clock index handling to AN restart command
ice: implement E825 TX ref clock control and TXC hardware sync status
Documentation/netlink/specs/dpll.yaml | 3 + drivers/dpll/dpll_core.c | 34 +- drivers/dpll/dpll_core.h | 5 +- drivers/dpll/dpll_netlink.c | 26 +- drivers/dpll/dpll_netlink.h | 4 +- drivers/dpll/dpll_nl.c | 2 +- drivers/net/ethernet/intel/ice/Makefile | 2 +- drivers/net/ethernet/intel/ice/ice.h | 12 + drivers/net/ethernet/intel/ice/ice_adapter.c | 4 + drivers/net/ethernet/intel/ice/ice_adapter.h | 7 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 2 + drivers/net/ethernet/intel/ice/ice_common.c | 5 +- drivers/net/ethernet/intel/ice/ice_common.h | 2 +- drivers/net/ethernet/intel/ice/ice_cpi.c | 362 ++++++++++++++ drivers/net/ethernet/intel/ice/ice_cpi.h | 58 +++ drivers/net/ethernet/intel/ice/ice_dpll.c | 468 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_dpll.h | 36 +- drivers/net/ethernet/intel/ice/ice_lib.c | 3 +- drivers/net/ethernet/intel/ice/ice_ptp.c | 37 +- drivers/net/ethernet/intel/ice/ice_ptp.h | 7 + drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 37 ++ drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 17 + drivers/net/ethernet/intel/ice/ice_sbq_cmd.h | 5 +- drivers/net/ethernet/intel/ice/ice_txclk.c | 320 ++++++++++++ drivers/net/ethernet/intel/ice/ice_txclk.h | 40 ++ drivers/net/ethernet/intel/ice/ice_type.h | 2 + include/linux/dpll.h | 1 + include/uapi/linux/dpll.h | 2 + 28 files changed, 1442 insertions(+), 61 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.c create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.h create mode 100644 drivers/net/ethernet/intel/ice/ice_txclk.c create mode 100644 drivers/net/ethernet/intel/ice/ice_txclk.h
base-commit: 794cd1c77f53309f5eb8c05b4b833ad3723eccff
Signature · 1 line
2.39.3
PATCH v10 1/8 dpll: add generic DPLL type
Add DPLL_TYPE_GENERIC to represent DPLL devices which do not fit the existing PPS or EEC classes.
The UAPI type is intentionally generic. During netdev discussion, maintainers pointed out that introducing identifiers tied to a specific placement or single design does not scale across ASICs and vendors. The role of a DPLL is already inferable from the spawning driver, bus device, and pin topology, without encoding additional purpose-specific taxonomy in the type name.
Using a generic type keeps the UAPI extensible and avoids premature naming that may become incorrect as new hardware topologies are exposed through the DPLL subsystem.
Expose the new type through UAPI and netlink specification as "generic".
--- Documentation/netlink/specs/dpll.yaml | 3 +++ drivers/dpll/dpll_nl.c | 2 +- include/uapi/linux/dpll.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-)
Documentation/netlink/specs/dpll.yaml +3 -0
@@ -138,6 +138,9 @@ definitions: - name: eec doc: dpll drives the Ethernet Equipment Clock + - + name: generic + doc: generic dpll type for devices outside PPS/EEC classes render-max: true - type: enum
drivers/dpll/dpll_nl.c +1 -1
@@ -37,7 +37,7 @@ const struct nla_policy dpll_reference_sync_nl_policy[DPLL_A_PIN_STATE + 1] = {static const struct nla_policy dpll_device_id_get_nl_policy[DPLL_A_TYPE +1 ] = { [DPLL_A_MODULE_NAME ] = { .type =NLA_NUL_STRING , }, [DPLL_A_CLOCK_ID ] = { .type =NLA_U64 , }, - [DPLL_A_TYPE ] =NLA_POLICY_RANGE (NLA_U32 ,1 ,2 ), + [DPLL_A_TYPE ] =NLA_POLICY_RANGE (NLA_U32 ,1 ,3 ), };/* DPLL_CMD_DEVICE_GET - do */
include/uapi/linux/dpll.h +2 -0
@@ -109,10 +109,12 @@ enum dpll_clock_quality_level {* enum dpll_type - type of dpll, valid values for DPLL_A_TYPE attribute * @DPLL_TYPE_PPS: dpll produces Pulse-Per-Second signal * @DPLL_TYPE_EEC: dpll drives the Ethernet Equipment Clock +* @DPLL_TYPE_GENERIC: generic dpll type for devices outside PPS/EEC classes */ enum dpll_type {DPLL_TYPE_PPS =1 ,DPLL_TYPE_EEC , +DPLL_TYPE_GENERIC ,/* private: */ __DPLL_TYPE_MAX,
Signature · 1 line
2.39.3
PATCH v10 2/8 dpll: allow registering FW-identified pin with a different DPLL
In reply to Grzegorz NitkaRelax the (module, clock_id) equality requirement when registering a pin identified by firmware (pin->fwnode). Some platforms associate a FW-described pin with a DPLL instance that differs from the pin's (module, clock_id) tuple. For such pins, permit registration without requiring the strict match. Non-FW pins still require equality.
Keep netlink pin module reporting/filtering safe for this relaxed registration model by caching the module name in the pin object at allocation time and using the cached string in netlink paths. This avoids dereferencing pin->module after provider module teardown.
--- drivers/dpll/dpll_core.c | 20 ++++++++++++++++---- drivers/dpll/dpll_core.h | 2 ++ drivers/dpll/dpll_netlink.c | 6 +++--- 3 files changed, 21 insertions(+), 7 deletions(-)
drivers/dpll/dpll_core.c +16 -4
@@ -11,6 +11,7 @@#include <linux/device.h> #include <linux/err.h> #include <linux/idr.h> +#include <linux/module.h> #include <linux/property.h> #include <linux/slab.h> #include <linux/string.h>
@@ -652,6 +653,7 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module, pin->pin_idx = pin_idx; pin->clock_id = clock_id; pin->module = module; +strscpy (pin->module_name,module_name (module));if (WARN_ON (prop->type <DPLL_PIN_TYPE_MUX || prop->type >DPLL_PIN_TYPE_MAX )) { ret = -EINVAL ;
@@ -884,11 +886,21 @@ dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,return -EINVAL ;mutex_lock (&dpll_lock); -if (WARN_ON (!(dpll->module == pin->module && - dpll->clock_id == pin->clock_id))) + +/* +* For pins identified via firmware (pin->fwnode), allow registration +* even if the pin's (module, clock_id) differs from the target DPLL. +* For non-fwnode pins, require a strict (module, clock_id) match. +*/ +if (!pin->fwnode && +WARN_ON_ONCE (dpll->module != pin->module || + dpll->clock_id != pin->clock_id)) { ret = -EINVAL ; -else - ret =__dpll_pin_register (dpll, pin, ops, priv,NULL ); + goto out_unlock; + } + + ret =__dpll_pin_register (dpll, pin, ops, priv,NULL ); +out_unlock:mutex_unlock (&dpll_lock);return ret;
drivers/dpll/dpll_core.h +2 -0
@@ -45,6 +45,7 @@ struct dpll_device {* @pin_idx: index of a pin given by dev driver * @clock_id: clock_id of creator * @module: module of creator +* @module_name: module name of creator * @fwnode: optional reference to firmware node * @dpll_refs: hold referencees to dplls pin was registered with * @parent_refs: hold references to parent pins pin was registered with
@@ -59,6 +60,7 @@ struct dpll_pin {u32 pin_idx;u64 clock_id;struct module *module; +char module_name[MODULE_NAME_LEN ];struct fwnode_handle *fwnode;struct xarray dpll_refs;struct xarray parent_refs;
drivers/dpll/dpll_netlink.c +3 -3
@@ -714,7 +714,7 @@ dpll_cmd_pin_get_one(struct sk_buff *msg, struct dpll_pin *pin,if (ret)return ret;if (nla_put_string (msg,DPLL_A_PIN_MODULE_NAME , -module_name (pin->module))) + pin->module_name))return -EMSGSIZE ;if (nla_put_64bit (msg,DPLL_A_PIN_CLOCK_ID ,sizeof (pin->clock_id), &pin->clock_id,DPLL_A_PIN_PAD ))
@@ -1652,9 +1652,9 @@ dpll_pin_find(u64 clock_id, struct nlattr *mod_name_attr,xa_for_each_marked (&dpll_pin_xa, i, pin,DPLL_REGISTERED ) { prop = &pin->prop; cid_match = clock_id ? pin->clock_id == clock_id : true; - mod_match = mod_name_attr &&module_name (pin->module) ? + mod_match = mod_name_attr && pin->module_name[0 ] ? !nla_strcmp (mod_name_attr, -module_name (pin->module)) : true; + pin->module_name) : true; type_match = type ? prop->type == type : true; board_match = board_label ? (prop->board_label ? !nla_strcmp(board_label, prop->board_label) : false) :
Signature · 1 line
2.39.3
PATCH v10 3/8 dpll: extend pin notifier with notification source ID
In reply to Grzegorz NitkaExtend the DPLL pin notification API to include a source identifier indicating where the notification originates. This allows notifier consumers to distinguish between notifications coming from an associated DPLL instance, a parent pin, or the pin itself.
A new field, src_clock_id, is added to struct dpll_pin_notifier_info and is passed through all pin-related notification paths. Callers of dpll_pin_notify() are updated to provide a meaningful source identifier based on their context:
- pin registration/unregistration uses the DPLL's clock_id,
- pin-on-pin operations use the parent pin's clock_id,
- pin changes use the pin's own clock_id.
As introduced in the commit ("dpll: allow registering FW-identified pin with a different DPLL"), it is possible to share the same physical pin via firmware description (fwnode) with DPLL objects from different kernel modules. This means that a given pin can be registered multiple times.
Driver such as ICE (E825 devices) rely on this mechanism when listening for the event where a shared-fwnode pin appears, while avoiding reacting to events triggered by their own registration logic.
This change only extends the notification metadata and does not alter existing semantics for drivers that do not use the new field.
--- drivers/dpll/dpll_core.c | 14 ++++++++------ drivers/dpll/dpll_core.h | 3 ++- drivers/dpll/dpll_netlink.c | 10 +++++----- drivers/dpll/dpll_netlink.h | 4 ++-- include/linux/dpll.h | 1 + 5 files changed, 18 insertions(+), 14 deletions(-)
drivers/dpll/dpll_core.c +8 -6
@@ -72,7 +72,8 @@ void dpll_device_notify(struct dpll_device *dpll, unsigned long action)call_dpll_notifiers (action, &info); } -void dpll_pin_notify (struct dpll_pin *pin,unsigned long action) +void dpll_pin_notify (struct dpll_pin *pin,u64 src_clock_id, +unsigned long action) {struct dpll_pin_notifier_info info = { .pin = pin,
@@ -81,6 +82,7 @@ void dpll_pin_notify(struct dpll_pin *pin, unsigned long action) .clock_id = pin->clock_id, .fwnode = pin->fwnode, .prop = &pin->prop, + .src_clock_id = src_clock_id, };call_dpll_notifiers (action, &info);
@@ -849,7 +851,7 @@ __dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,if (ret) goto ref_pin_del;xa_set_mark (&dpll_pin_xa, pin->id,DPLL_REGISTERED ); -dpll_pin_create_ntf (pin); +dpll_pin_create_ntf (pin, dpll->clock_id);return ret;
@@ -952,7 +954,7 @@ void dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin,return ;mutex_lock (&dpll_lock); -dpll_pin_delete_ntf (pin); +dpll_pin_delete_ntf (pin, dpll->clock_id);__dpll_pin_unregister (dpll, pin, ops, priv,NULL );mutex_unlock (&dpll_lock); }
@@ -998,7 +1000,7 @@ int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin, stop = i; goto dpll_unregister; } -dpll_pin_create_ntf (pin); +dpll_pin_create_ntf (pin, parent->clock_id); }mutex_unlock (&dpll_lock);
@@ -1009,7 +1011,7 @@ int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin,if (i < stop) {__dpll_pin_unregister (ref->dpll, pin, ops, priv, parent); -dpll_pin_delete_ntf (pin); +dpll_pin_delete_ntf (pin, parent->clock_id); }dpll_xa_ref_pin_del (&pin->parent_refs, parent, ops, priv, pin); unlock:
@@ -1035,7 +1037,7 @@ void dpll_pin_on_pin_unregister(struct dpll_pin *parent, struct dpll_pin *pin,unsigned long i;mutex_lock (&dpll_lock); -dpll_pin_delete_ntf (pin); +dpll_pin_delete_ntf (pin, parent->clock_id);dpll_xa_ref_pin_del (&pin->parent_refs, parent, ops, priv, pin);xa_for_each (&pin->dpll_refs, i, ref)__dpll_pin_unregister (ref->dpll, pin, ops, priv, parent);
drivers/dpll/dpll_core.h +2 -1
@@ -100,6 +100,7 @@ extern struct xarray dpll_pin_xa;extern struct mutex dpll_lock;void dpll_device_notify (struct dpll_device *dpll,unsigned long action); -void dpll_pin_notify (struct dpll_pin *pin,unsigned long action); +void dpll_pin_notify (struct dpll_pin *pin,u64 src_clock_id, +unsigned long action);#endif
drivers/dpll/dpll_netlink.c +5 -5
@@ -917,15 +917,15 @@ dpll_pin_event_send(enum dpll_cmd event, struct dpll_pin *pin)return ret; } -int dpll_pin_create_ntf (struct dpll_pin *pin) +int dpll_pin_create_ntf (struct dpll_pin *pin,u64 src_clock_id) { -dpll_pin_notify (pin,DPLL_PIN_CREATED ); +dpll_pin_notify (pin, src_clock_id,DPLL_PIN_CREATED );return dpll_pin_event_send (DPLL_CMD_PIN_CREATE_NTF , pin); } -int dpll_pin_delete_ntf (struct dpll_pin *pin) +int dpll_pin_delete_ntf (struct dpll_pin *pin,u64 src_clock_id) { -dpll_pin_notify (pin,DPLL_PIN_DELETED ); +dpll_pin_notify (pin, src_clock_id,DPLL_PIN_DELETED );return dpll_pin_event_send (DPLL_CMD_PIN_DELETE_NTF , pin); }
@@ -940,7 +940,7 @@ int dpll_pin_delete_ntf(struct dpll_pin *pin)int __dpll_pin_change_ntf (struct dpll_pin *pin) {lockdep_assert_held (&dpll_lock); -dpll_pin_notify (pin,DPLL_PIN_CHANGED ); +dpll_pin_notify (pin, pin->clock_id,DPLL_PIN_CHANGED );return dpll_pin_event_send (DPLL_CMD_PIN_CHANGE_NTF , pin); }EXPORT_SYMBOL_GPL (__dpll_pin_change_ntf);
drivers/dpll/dpll_netlink.h +2 -2
@@ -8,6 +8,6 @@ int dpll_device_create_ntf(struct dpll_device *dpll);int dpll_device_delete_ntf (struct dpll_device *dpll); -int dpll_pin_create_ntf (struct dpll_pin *pin); +int dpll_pin_create_ntf (struct dpll_pin *pin,u64 src_clock_id); -int dpll_pin_delete_ntf (struct dpll_pin *pin); +int dpll_pin_delete_ntf (struct dpll_pin *pin,u64 src_clock_id);
include/linux/dpll.h +1 -0
@@ -232,6 +232,7 @@ struct dpll_pin_notifier_info {u64 clock_id;const struct fwnode_handle *fwnode;const struct dpll_pin_properties *prop; +u64 src_clock_id; };#if IS_ENABLED (CONFIG_DPLL )
Signature · 1 line
2.39.3
PATCH v10 4/8 dpll: allow fwnode pins to attempt state change without capability bit
In reply to Grzegorz NitkaPins registered with an fwnode may have .state_on_dpll_set implemented without advertising DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE upfront. Requiring the bit for fwnode pins ties firmware description to driver implementation details unnecessarily.
Relax the capability check in dpll_pin_state_set() and dpll_pin_on_pin_state_set(): when a pin has an associated fwnode, bypass the capability gate and let the ops layer decide, returning -EOPNOTSUPP if .state_on_dpll_set is absent. Non-fwnode pins retain the original strict behavior.
This is used later in the series by the SyncE_Ref output pin, which relies on the fwnode path for state control.
--- drivers/dpll/dpll_netlink.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/dpll/dpll_netlink.c +8 -2
@@ -1327,8 +1327,11 @@ dpll_pin_on_pin_state_set(struct dpll_pin *pin, u32 parent_idx,unsigned long i;int ret; +/* fwnode pins may not set the capability bit upfront; let the ops +* layer return -EOPNOTSUPP if the operation is unsupported. +*/ if (!(DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE & - pin->prop.capabilities)) { + pin->prop.capabilities) && !pin->fwnode) {NL_SET_ERR_MSG (extack,"state changing is not allowed" );return -EOPNOTSUPP ; }
@@ -1363,8 +1366,11 @@ dpll_pin_state_set(struct dpll_device *dpll, struct dpll_pin *pin,struct dpll_pin_ref *ref;int ret; +/* fwnode pins may not set the capability bit upfront; let the ops +* layer return -EOPNOTSUPP if the operation is unsupported. +*/ if (!(DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE & - pin->prop.capabilities)) { + pin->prop.capabilities) && !pin->fwnode) {NL_SET_ERR_MSG (extack,"state changing is not allowed" );return -EOPNOTSUPP ; }
Signature · 1 line
2.39.3
RE: [Intel-wired-lan] [PATCH v10 net-next 4/8] dpll: allow fwnode pins to attempt state change without capability bit
Quoted 72 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Grzegorz Nitka
Sent: Wednesday, May 20, 2026 11:36 AM
To: [email protected]
Cc: Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; Kubalewski, Arkadiusz <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]
Subject: [Intel-wired-lan] [PATCH v10 net-next 4/8] dpll: allow fwnode pins to attempt state change without capability bitPins registered with an fwnode may have .state_on_dpll_set implemented without advertising
DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGEupfront. Requiring the bit for fwnode pins ties firmware description to driver implementation details unnecessarily.Relax the capability check in
dpll_pin_state_set()anddpll_pin_on_pin_state_set(): when a pin has an associated fwnode, bypass the capability gate and let the ops layer decide, returning - EOPNOTSUPP if .state_on_dpll_set is absent. Non-fwnode pins retain the original strict behavior.This is used later in the series by the
SyncE_Refoutput pin, which relies on the fwnode path for state control.Signed-off-by Grzegorz Nitka <[email protected]>--- drivers/dpll/dpll_netlink.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/dpll/dpll_netlink.c +1
-0@@ -1327,8 +1327,11 @@ dpll_pin_on_pin_state_set(struct dpll_pin *pin,u32 parent_idx, unsigned long i;int ret; +/* fwnode pins may not set the capability bit upfront; let the ops
drivers/dpll/dpll_netlink.c +4
-1+* layer return -EOPNOTSUPP if the operation is unsupported. +*/ if (!(DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE & - pin->prop.capabilities)) { + pin->prop.capabilities) && !pin->fwnode) {NL_SET_ERR_MSG (extack,"state changing is not allowed" );return -EOPNOTSUPP ; }@@ -1363,8 +1366,11 @@ dpll_pin_state_set(struct dpll_device *dpll,struct dpll_pin *pin, struct dpll_pin_ref *ref;int ret; +/* fwnode pins may not set the capability bit upfront; let the ops
drivers/dpll/dpll_netlink.c +3
-2+* layer return -EOPNOTSUPP if the operation is unsupported. +*/ if (!(DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE & - pin->prop.capabilities)) { + pin->prop.capabilities) && !pin->fwnode) {NL_SET_ERR_MSG (extack,"state changing is not allowed" );return -EOPNOTSUPP ; } --
Quoted 1 line
2.39.3
PATCH v10 5/8 ice: introduce TXC DPLL device and TX ref clock pin framework for E825
In reply to Grzegorz NitkaE825 devices provide a dedicated TX clock (TXC) domain which may be driven by multiple reference clock sources, including external board references and port-derived SyncE. To support future TX clock control and observability through the Linux DPLL subsystem, introduce a separate TXC DPLL device (of DPLL_TYPE_GENERIC) and a framework for representing TX reference clock inputs.
This change adds a new internal DPLL pin type (TXCLK) and registers TX reference clock pins for E825-based devices:
- EXT_EREF0: a board-level external electrical reference
- SYNCE: a port-derived SyncE reference described via firmware nodes
The TXC DPLL device is created and managed alongside the existing PPS and EEC DPLL instances. TXCLK pins are registered directly or deferred via a notifier when backed by fwnode-described pins. A per-pin attribute encodes the TX reference source associated with each TXCLK pin.
At this stage, TXCLK pin state callbacks and TXC DPLL lock status reporting are implemented as placeholders. Pin state getters always return DISCONNECTED, and the TXC DPLL is initialized in the UNLOCKED state. No hardware configuration or TX reference switching is performed yet.
This patch establishes the structural groundwork required for hardware-backed TX reference selection, verification, and synchronization status reporting, which will be implemented in subsequent patches.
--- drivers/net/ethernet/intel/ice/ice_dpll.c | 322 ++++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_dpll.h | 6 + drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 7 + 3 files changed, 310 insertions(+), 25 deletions(-)
drivers/net/ethernet/intel/ice/ice_dpll.c +297 -25
@@ -19,6 +19,11 @@#define ICE_DPLL_SW_PIN_INPUT_BASE_QSFP 6#define ICE_DPLL_SW_PIN_OUTPUT_BASE 0 +#define E825_EXT_EREF_PIN_IDX 0 +#define E825_EXT_SYNCE_PIN_IDX 1 +#define E825_RCLK_PARENT_0_PIN_IDX 0 +#define E825_RCLK_PARENT_1_PIN_IDX 1 +#define ICE_DPLL_PIN_SW_INPUT_ABS (in_idx) \ (ICE_DPLL_SW_PIN_INPUT_BASE_SFP + (in_idx))
@@ -57,6 +62,7 @@* @ICE_DPLL_PIN_TYPE_OUTPUT: output pin * @ICE_DPLL_PIN_TYPE_RCLK_INPUT: recovery clock input pin * @ICE_DPLL_PIN_TYPE_SOFTWARE: software controlled SMA/U.FL pins +* @ICE_DPLL_PIN_TYPE_TXCLK: transmit clock reference input pin */ enum ice_dpll_pin_type {ICE_DPLL_PIN_INVALID ,
@@ -64,6 +70,7 @@ enum ice_dpll_pin_type {ICE_DPLL_PIN_TYPE_OUTPUT ,ICE_DPLL_PIN_TYPE_RCLK_INPUT ,ICE_DPLL_PIN_TYPE_SOFTWARE , + ICE_DPLL_PIN_TYPE_TXCLK, }; static const char * const pin_type_name[] = {
@@ -71,10 +78,13 @@ static const char * const pin_type_name[] = { [ICE_DPLL_PIN_TYPE_OUTPUT] = "output", [ICE_DPLL_PIN_TYPE_RCLK_INPUT] = "rclk-input", [ICE_DPLL_PIN_TYPE_SOFTWARE] = "software", + [ICE_DPLL_PIN_TYPE_TXCLK] = "txclk-input", };static const char *const ice_dpll_sw_pin_sma[] = {"SMA1" ,"SMA2" };static const char *const ice_dpll_sw_pin_ufl[] = {"U.FL1" ,"U.FL2" }; +static const char *const ice_dpll_ext_eref_pin ="EXT_EREF0" ; +static const char *const ice_dpll_fwnode_ext_synce ="clk_ref_synce" ;static const struct dpll_pin_frequency ice_esync_range[] = {DPLL_PIN_FREQUENCY_RANGE (0 ,DPLL_PIN_FREQUENCY_1_HZ ),
@@ -2605,12 +2615,75 @@ ice_dpll_rclk_state_on_pin_get(const struct dpll_pin *pin, void *pin_priv,return ret; } +/** +* ice_dpll_txclk_state_on_dpll_set - set a state on TX clk pin +* @pin: pointer to a pin +* @pin_priv: private data pointer passed on pin registration +* @dpll: registered dpll pointer +* @dpll_priv: private data pointer passed on dpll registration +* @state: state to be set on pin +* @extack: error reporting +* +* Dpll subsystem callback, set a state of a Tx reference clock pin +* +* Return: +* * negative - failure +*/ +static int +ice_dpll_txclk_state_on_dpll_set (const struct dpll_pin *pin,void *pin_priv, +const struct dpll_device *dpll, +void *dpll_priv,enum dpll_pin_state state, +struct netlink_ext_ack *extack) +{ +/* +* TODO: set HW accordingly to selected TX reference clock. +* To be added in the follow up patches. +*/ +return -EOPNOTSUPP ; +} + +/** +* ice_dpll_txclk_state_on_dpll_get - get a state of Tx clk reference pin +* @pin: pointer to a pin +* @pin_priv: private data pointer passed on pin registration +* @dpll: registered dpll pointer +* @dpll_priv: private data pointer passed on dpll registration +* @state: on success holds pin state on parent pin +* @extack: error reporting +* +* dpll subsystem callback, get a state of a TX clock reference pin. +* +* Return: +* * 0 - success +*/ +static int +ice_dpll_txclk_state_on_dpll_get (const struct dpll_pin *pin,void *pin_priv, +const struct dpll_device *dpll, +void *dpll_priv, +enum dpll_pin_state *state, +struct netlink_ext_ack *extack) +{ +/* +* TODO: query HW status to determine if the TX reference is selected. +* To be added in the follow up patches. +*/ + *state =DPLL_PIN_STATE_DISCONNECTED ; + +return 0 ; +} +static const struct dpll_pin_ops ice_dpll_rclk_ops = { .state_on_pin_set = ice_dpll_rclk_state_on_pin_set, .state_on_pin_get = ice_dpll_rclk_state_on_pin_get, .direction_get = ice_dpll_input_direction, }; +static const struct dpll_pin_ops ice_dpll_txclk_ops = { + .state_on_dpll_set = ice_dpll_txclk_state_on_dpll_set, + .state_on_dpll_get = ice_dpll_txclk_state_on_dpll_get, + .direction_get = ice_dpll_input_direction, +}; +static const struct dpll_pin_ops ice_dpll_pin_sma_ops = { .state_on_dpll_set = ice_dpll_sma_pin_state_set, .state_on_dpll_get = ice_dpll_sw_pin_state_get,
@@ -3133,9 +3206,13 @@ ice_dpll_unregister_pins(struct dpll_device *dpll, struct ice_dpll_pin *pins, {int i; -for (i =0 ; i < count; i++) -if (!pins[i].hidden) -dpll_pin_unregister (dpll, pins[i].pin, ops, &pins[i]); +for (i =0 ; i < count; i++) { +if (pins[i].hidden) +continue ; +if (IS_ERR_OR_NULL (pins[i].pin)) +continue ; +dpll_pin_unregister (dpll, pins[i].pin, ops, &pins[i]); + } }/**
@@ -3309,19 +3386,42 @@ static bool ice_dpll_is_fwnode_pin(struct ice_dpll_pin *pin)return !IS_ERR_OR_NULL (pin->fwnode); } +static bool ice_dpll_fwnode_eq (const struct fwnode_handle *a, +const struct fwnode_handle *b) +{ +return a && a == b; +} +static void ice_dpll_pin_notify_work (struct work_struct *work) {struct ice_dpll_pin_work *w =container_of (work, struct ice_dpll_pin_work, work);struct ice_dpll_pin *pin, *parent = w->pin; +bool is_tx_synce_parent = false;struct ice_pf *pf = parent->pf; +bool is_rclk_parent = false;int ret;wait_for_completion (&pf->dplls.dpll_init);if (!test_bit (ICE_FLAG_DPLL , pf->flags)) goto out;/* DPLL initialization failed */ +/* Decide which parent we are handling, defensively checking FWNs */ +for (int i =0 ; i < pf->dplls.rclk.num_parents; i++) { +if (ice_dpll_fwnode_eq (parent->fwnode, + pf->dplls.inputs[i].fwnode)) { + is_rclk_parent = true; +break ; + } + } + + is_tx_synce_parent = +ice_dpll_fwnode_eq (parent->fwnode, + pf->dplls.txclks[E825_EXT_SYNCE_PIN_IDX ].fwnode); +if (!is_rclk_parent && !is_tx_synce_parent) + goto out; +switch (w->action) {case DPLL_PIN_CREATED :if (!IS_ERR_OR_NULL (parent->pin)) {
@@ -3338,16 +3438,28 @@ static void ice_dpll_pin_notify_work(struct work_struct *work) goto out; } -/* Register rclk pin */ - pin = &pf->dplls.rclk; - ret =dpll_pin_on_pin_register (parent->pin, pin->pin, - &ice_dpll_rclk_ops, pin); -if (ret) { -dev_err (ice_pf_to_dev (pf), -"Failed to register pin: %pe\n" ,ERR_PTR (ret)); -dpll_pin_put (parent->pin, &parent->tracker); - parent->pin =NULL ; - goto out; +if (is_rclk_parent) { +/* Register rclk pin via on-pin relationship */ + pin = &pf->dplls.rclk; + ret =dpll_pin_on_pin_register (parent->pin, pin->pin, + &ice_dpll_rclk_ops, pin); +if (ret) { +dev_err (ice_pf_to_dev (pf), +"RCLK pin register failed: %pe\n" , +ERR_PTR (ret)); + goto drop_parent_ref; + } + }else if (is_tx_synce_parent) { +/* Register TX-CLK SYNCE pin directly to TXC DPLL */ + pin = &pf->dplls.txclks[E825_EXT_SYNCE_PIN_IDX ]; + ret =dpll_pin_register (pf->dplls.txc.dpll, pin->pin, + &ice_dpll_txclk_ops, pin); +if (ret) { +dev_err (ice_pf_to_dev (pf), +"TX SYNCE pin register failed: %pe\n" , +ERR_PTR (ret)); + goto drop_parent_ref; + } }break ;case DPLL_PIN_DELETED :
@@ -3356,11 +3468,18 @@ static void ice_dpll_pin_notify_work(struct work_struct *work) goto out; } -/* Unregister rclk pin */ - pin = &pf->dplls.rclk; -dpll_pin_on_pin_unregister (parent->pin, pin->pin, - &ice_dpll_rclk_ops, pin); - +if (is_rclk_parent) { +/* Unregister rclk pin */ + pin = &pf->dplls.rclk; +dpll_pin_on_pin_unregister (parent->pin, pin->pin, + &ice_dpll_rclk_ops, pin); + }else if (is_tx_synce_parent) { +/* Unregister TX-CLK SYNCE pin from TXC DPLL */ + pin = &pf->dplls.txclks[E825_EXT_SYNCE_PIN_IDX ]; +dpll_pin_unregister (pf->dplls.txc.dpll, pin->pin, + &ice_dpll_txclk_ops, pin); + } +drop_parent_ref:/* Drop fwnode pin reference */ dpll_pin_put (parent->pin, &parent->tracker); parent->pin =NULL ;
@@ -3386,6 +3505,12 @@ static int ice_dpll_pin_notify(struct notifier_block *nb, unsigned long action,if (pin->fwnode != info->fwnode)return NOTIFY_DONE ;/* Not this pin */ +/* Ignore notification which are the outcome of internal pin +* registration/unregistration calls - synce pin case. +*/ +if (info->src_clock_id == pin->pf->dplls.clock_id) +return NOTIFY_DONE ; + work =kzalloc_obj (*work);if (!work)return NOTIFY_DONE ;
@@ -3488,10 +3613,16 @@ ice_dpll_init_rclk_pin(struct ice_pf *pf, int start_idx, }static void -ice_dpll_deinit_fwnode_pin (struct ice_dpll_pin *pin) +ice_dpll_stop_fwnode_pin_activity (struct ice_dpll_pin *pin,bool flush) {unregister_dpll_notifier (&pin->nb); -flush_workqueue (pin->pf->dplls.wq); +if (flush) +flush_workqueue (pin->pf->dplls.wq); +} + +static void +ice_dpll_release_fwnode_pin (struct ice_dpll_pin *pin) +{if (!IS_ERR_OR_NULL (pin->pin)) {dpll_pin_put (pin->pin, &pin->tracker); pin->pin =NULL ;
@@ -3500,6 +3631,13 @@ ice_dpll_deinit_fwnode_pin(struct ice_dpll_pin *pin) pin->fwnode =NULL ; } +static void +ice_dpll_deinit_fwnode_pin (struct ice_dpll_pin *pin) +{ +ice_dpll_stop_fwnode_pin_activity (pin, true); +ice_dpll_release_fwnode_pin (pin); +} +static void ice_dpll_deinit_fwnode_pins (struct ice_pf *pf,struct ice_dpll_pin *pins,int start_idx)
@@ -3511,6 +3649,20 @@ ice_dpll_deinit_fwnode_pins(struct ice_pf *pf, struct ice_dpll_pin *pins,destroy_workqueue (pf->dplls.wq); } +static int ice_dpll_deinit_txclk_pins (struct ice_pf *pf) +{ +struct ice_dpll_pin *synce_pin = &pf->dplls.txclks[E825_EXT_SYNCE_PIN_IDX ]; +struct ice_dpll *dt = &pf->dplls.txc; + +ice_dpll_stop_fwnode_pin_activity (synce_pin, true); +ice_dpll_unregister_pins (dt->dpll, pf->dplls.txclks, + &ice_dpll_txclk_ops, +ARRAY_SIZE (pf->dplls.txclks)); +ice_dpll_release_pins (&pf->dplls.txclks[E825_EXT_EREF_PIN_IDX ],1 ); +ice_dpll_release_fwnode_pin (synce_pin); +return 0 ; +} +/** * ice_dpll_deinit_pins - deinitialize direct pins * @pf: board private structure
@@ -3530,8 +3682,10 @@ static void ice_dpll_deinit_pins(struct ice_pf *pf, bool cgu)struct ice_dpll *dp = &d->pps;ice_dpll_deinit_rclk_pin (pf); -if (pf->hw.mac_type ==ICE_MAC_GENERIC_3K_E825 ) +if (pf->hw.mac_type ==ICE_MAC_GENERIC_3K_E825 ) { +ice_dpll_deinit_txclk_pins (pf);ice_dpll_deinit_fwnode_pins (pf, pf->dplls.inputs,0 ); + }if (cgu) {ice_dpll_unregister_pins (dp->dpll, inputs, &ice_dpll_input_ops, num_inputs);
@@ -3662,6 +3816,64 @@ ice_dpll_init_fwnode_pins(struct ice_pf *pf, struct ice_dpll_pin *pins,return ret; } +static int ice_dpll_init_txclk_pins (struct ice_pf *pf,int start_idx) +{ +struct ice_dpll_pin *ref_pin = pf->dplls.txclks; +struct ice_dpll *txc = &pf->dplls.txc; +int ret; + +/* Configure EXT_EREF0 pin */ + ret =ice_dpll_get_pins (pf, ref_pin, start_idx,1 , pf->dplls.clock_id); +if (ret) +return ret; + ret =dpll_pin_register (txc->dpll, ref_pin->pin, &ice_dpll_txclk_ops, + ref_pin); +if (ret) + goto err_release_ext_eref; + +/* +* Configure EXT_SYNCE pin (fwnode-backed). +* The pin may not yet be available; in that case registration +* will be deferred via the notifier path. +*/ + ref_pin++; + ret =ice_dpll_init_fwnode_pin (ref_pin, ice_dpll_fwnode_ext_synce); +if (ret) + goto err_unregister_ext_eref; + +if (IS_ERR_OR_NULL (ref_pin->pin)) { +dev_dbg (ice_pf_to_dev (pf), +"Tx-clk SYNCE pin not registered yet\n" ); +return 0 ; + } + + ret =dpll_pin_register (txc->dpll, ref_pin->pin, &ice_dpll_txclk_ops, + ref_pin); +if (ret) + goto err_deinit_synce; + +return 0 ; + +err_deinit_synce: +/* +* Avoid deadlock against notifier workers blocked on dpll_init. +* The outer init error path will complete dpll_init and flush the +* shared workqueue before destroying it. +*/ +ice_dpll_stop_fwnode_pin_activity (ref_pin, false); +ice_dpll_release_fwnode_pin (ref_pin); +err_unregister_ext_eref: +dpll_pin_unregister (txc->dpll, + pf->dplls.txclks[E825_EXT_EREF_PIN_IDX ].pin, + &ice_dpll_txclk_ops, + &pf->dplls.txclks[E825_EXT_EREF_PIN_IDX ]); + +err_release_ext_eref: +ice_dpll_release_pins (&pf->dplls.txclks[E825_EXT_EREF_PIN_IDX ],1 ); + +return ret; +} +/** * ice_dpll_init_pins_e825 - init pins and register pins with a dplls * @pf: board private structure
@@ -3684,6 +3896,15 @@ static int ice_dpll_init_pins_e825(struct ice_pf *pf) ret =ice_dpll_init_rclk_pin (pf,DPLL_PIN_IDX_UNSPEC , &ice_dpll_rclk_ops); + +if (ret) + goto unregister_pins; + + ret =ice_dpll_init_txclk_pins (pf,0 ); +if (ret) +ice_dpll_deinit_rclk_pin (pf); + +unregister_pins:if (ret) {/* Inform DPLL notifier works that DPLL init was finished * unsuccessfully (ICE_DPLL_FLAG not set).
@@ -3802,7 +4023,7 @@ static int ice_dpll_init_pins(struct ice_pf *pf, bool cgu)static void ice_dpll_deinit_dpll (struct ice_pf *pf,struct ice_dpll *d,bool cgu) { -if (cgu) +if (cgu || pf->hw.mac_type ==ICE_MAC_GENERIC_3K_E825 )dpll_device_unregister (d->dpll, d->ops, d);dpll_device_put (d->dpll, &d->tracker); }
@@ -3837,12 +4058,13 @@ ice_dpll_init_dpll(struct ice_pf *pf, struct ice_dpll *d, bool cgu,return ret; } d->pf = pf; -if (cgu) { +if (cgu || pf->hw.mac_type ==ICE_MAC_GENERIC_3K_E825 ) {const struct dpll_device_ops *ops = &ice_dpll_ops;if (type ==DPLL_TYPE_PPS &&ice_dpll_is_pps_phase_monitor (pf)) ops = &ice_dpll_pom_ops; -ice_dpll_update_state (pf, d, true); +if (cgu) +ice_dpll_update_state (pf, d, true); ret =dpll_device_register (d->dpll, type, ops, d);if (ret) {dpll_device_put (d->dpll, &d->tracker);
@@ -4208,6 +4430,36 @@ static int ice_dpll_init_info_sw_pins(struct ice_pf *pf)return 0 ; } +/** +* ice_dpll_init_info_txclk_pins_e825c - initializes tx-clk pins information +* @pf: board private structure +* +* Init information for tx-clks pin, cache them in pf->dplls.txclks +* +* Return: +* * 0 - success +*/ +static int ice_dpll_init_info_txclk_pins_e825c (struct ice_pf *pf) +{ +struct ice_dpll_pin *tx_pin; + +for (int i =0 ; i <ICE_DPLL_TXCLK_NUM_MAX ; i++) { + tx_pin = &pf->dplls.txclks[i]; + tx_pin->prop.type =DPLL_PIN_TYPE_EXT ; + tx_pin->prop.capabilities |= +DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE ; + tx_pin->pf = pf; +if (i ==E825_EXT_EREF_PIN_IDX ) { + tx_pin->prop.board_label = ice_dpll_ext_eref_pin; + tx_pin->tx_ref_src =ICE_REF_CLK_EREF0 ; + }else if (i ==E825_EXT_SYNCE_PIN_IDX ) { + tx_pin->tx_ref_src =ICE_REF_CLK_SYNCE ; + } + } + +return 0 ; +} +/** * ice_dpll_init_pins_info - init pins info wrapper * @pf: board private structure
@@ -4233,6 +4485,9 @@ ice_dpll_init_pins_info(struct ice_pf *pf, enum ice_dpll_pin_type pin_type)return ice_dpll_init_info_rclk_pin (pf);case ICE_DPLL_PIN_TYPE_SOFTWARE :return ice_dpll_init_info_sw_pins (pf); + +case ICE_DPLL_PIN_TYPE_TXCLK : +return ice_dpll_init_info_txclk_pins_e825c (pf);default :return -EINVAL ; }
@@ -4266,11 +4521,15 @@ static void ice_dpll_deinit_info(struct ice_pf *pf)static int ice_dpll_init_info_e825c (struct ice_pf *pf) {struct ice_dplls *d = &pf->dplls; +struct ice_dpll *dt = &d->txc;int ret =0 ;int i; d->clock_id =ice_generate_clock_id (pf); d->num_inputs =ICE_SYNCE_CLK_NUM ; + dt->dpll_state =DPLL_LOCK_STATUS_UNLOCKED ; + dt->mode =DPLL_MODE_MANUAL ; + dt->dpll_idx = pf->ptp.port.port_num; d->inputs =kzalloc_objs (*d->inputs, d->num_inputs);if (!d->inputs)
@@ -4287,6 +4546,11 @@ static int ice_dpll_init_info_e825c(struct ice_pf *pf) ret =ice_dpll_init_pins_info (pf,ICE_DPLL_PIN_TYPE_RCLK_INPUT );if (ret) goto deinit_info; + + ret =ice_dpll_init_pins_info (pf,ICE_DPLL_PIN_TYPE_TXCLK ); +if (ret) + goto deinit_info; +dev_dbg (ice_pf_to_dev (pf),"%s - success, inputs: %u, outputs: %u, rclk-parents: %u\n" , __func__, d->num_inputs, d->num_outputs, d->rclk.num_parents);
@@ -4419,6 +4683,9 @@ void ice_dpll_deinit(struct ice_pf *pf)ice_dpll_deinit_dpll (pf, &pf->dplls.pps, cgu);if (!IS_ERR_OR_NULL (pf->dplls.eec.dpll))ice_dpll_deinit_dpll (pf, &pf->dplls.eec, cgu); +if (!IS_ERR_OR_NULL (pf->dplls.txc.dpll)) +ice_dpll_deinit_dpll (pf, &pf->dplls.txc, false); +ice_dpll_deinit_info (pf);mutex_destroy (&pf->dplls.lock); }
@@ -4444,14 +4711,19 @@ static void ice_dpll_init_e825(struct ice_pf *pf) err =ice_dpll_init_info_e825c (pf);if (err) goto err_exit; - err =ice_dpll_init_pins_e825 (pf); + err =ice_dpll_init_dpll (pf, &pf->dplls.txc, false,DPLL_TYPE_GENERIC );if (err) goto deinit_info; + err =ice_dpll_init_pins_e825 (pf); +if (err) + goto deinit_txclk;set_bit (ICE_FLAG_DPLL , pf->flags);complete_all (&d->dpll_init);return ; +deinit_txclk: +ice_dpll_deinit_dpll (pf, &pf->dplls.txc, false); deinit_info:ice_dpll_deinit_info (pf); err_exit:
drivers/net/ethernet/intel/ice/ice_dpll.h +6 -0
@@ -7,6 +7,7 @@#include "ice.h" #define ICE_DPLL_RCLK_NUM_MAX 4 +#define ICE_DPLL_TXCLK_NUM_MAX 2#define ICE_CGU_R10 0x28#define ICE_CGU_R10_SYNCE_CLKO_SEL GENMASK(8, 5)
@@ -79,6 +80,7 @@ struct ice_dpll_pin {u8 ref_sync;bool active;bool hidden; +enum ice_e825c_ref_clk tx_ref_src; };/** ice_dpll - store info required for DPLL control
@@ -127,9 +129,11 @@ struct ice_dpll {* @lock: locks access to configuration of a dpll * @eec: pointer to EEC dpll dev * @pps: pointer to PPS dpll dev +* @txc: pointer to TXC dpll dev * @inputs: input pins pointer * @outputs: output pins pointer * @rclk: recovered pins pointer +* @txclks: TX clock reference pins pointer * @num_inputs: number of input pins available on dpll * @num_outputs: number of output pins available on dpll * @cgu_state_acq_err_num: number of errors returned during periodic work
@@ -147,11 +151,13 @@ struct ice_dplls {struct completion dpll_init;struct ice_dpll eec;struct ice_dpll pps; +struct ice_dpll txc;struct ice_dpll_pin *inputs;struct ice_dpll_pin *outputs;struct ice_dpll_pin sma[ICE_DPLL_PIN_SW_NUM ];struct ice_dpll_pin ufl[ICE_DPLL_PIN_SW_NUM ];struct ice_dpll_pin rclk; +struct ice_dpll_pin txclks[ICE_DPLL_TXCLK_NUM_MAX ];u8 num_inputs;u8 num_outputs;u8 sma_data;
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +7 -0
@@ -265,6 +265,13 @@ struct ice_cgu_pin_desc {struct dpll_pin_frequency *freq_supp; }; +enum ice_e825c_ref_clk { +ICE_REF_CLK_ENET , +ICE_REF_CLK_SYNCE , +ICE_REF_CLK_EREF0 , +ICE_REF_CLK_MAX , +}; +#define E810C_QSFP_C827_0_HANDLE 2#define E810C_QSFP_C827_1_HANDLE 3
Signature · 1 line
2.39.3
PATCH v10 6/8 ice: implement CPI support for E825C
In reply to Grzegorz NitkaAdd full CPI (Converged PHY Interface) command handling required for E825C devices. The CPI interface allows the driver to interact with PHY-side control logic through the LM/PHY command registers, including enabling/disabling/selection of PHY reference clock.
This patch introduces:
- a new CPI subsystem (ice_cpi.c / ice_cpi.h) implementing the CPI request/acknowledge state machine, including REQ/ACK protocol, command execution, and response handling
- helper functions for reading/writing PHY registers over Sideband Queue
- CPI command execution API (ice_cpi_exec) and a helper for enabling or disabling Tx reference clocks (CPI 0xF1 opcode 'Config PHY clocking')
- assurance of CPI transaction serialization into the CPI core.
CPI REQ/ACK is a multi-step handshake and must be executed
atomically per PHY. Centralize the lock in ice_cpi_exec() and use adapter-scoped per-PHY mutexes, which match the hardware sharing model across PFs.
- addition of the non-posted write opcode (wr_np) to SBQ
- Makefile integration to build CPI support together with the PTP stack
This provides the infrastructure necessary to support PHY-side configuration flows on E825C and is required for advanced link control and Tx reference clock management.
--- drivers/net/ethernet/intel/ice/Makefile | 2 +- drivers/net/ethernet/intel/ice/ice_adapter.c | 4 + drivers/net/ethernet/intel/ice/ice_adapter.h | 7 + drivers/net/ethernet/intel/ice/ice_cpi.c | 362 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_cpi.h | 58 +++ drivers/net/ethernet/intel/ice/ice_sbq_cmd.h | 5 +- drivers/net/ethernet/intel/ice/ice_type.h | 2 + 7 files changed, 437 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.c create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.h
drivers/net/ethernet/intel/ice/Makefile +1 -1
@@ -54,7 +54,7 @@ ice-$(CONFIG_PCI_IOV) += \ ice_vf_mbx.o \ ice_vf_vsi_vlan_ops.o \ ice_vf_lib.o -ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o ice_tspll.o +ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o ice_tspll.o ice_cpi.o ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o
drivers/net/ethernet/intel/ice/ice_adapter.c +4 -0
@@ -62,6 +62,8 @@ static struct ice_adapter *ice_adapter_new(struct pci_dev *pdev) adapter->index =ice_adapter_index (pdev);spin_lock_init (&adapter->ptp_gltsyn_time_lock);spin_lock_init (&adapter->txq_ctx_lock); +for (int i =0 ; i <ARRAY_SIZE (adapter->cpi_phy_lock); i++) +mutex_init (&adapter->cpi_phy_lock[i]);refcount_set (&adapter->refcount,1 );mutex_init (&adapter->ports.lock);
@@ -73,6 +75,8 @@ static struct ice_adapter *ice_adapter_new(struct pci_dev *pdev)static void ice_adapter_free (struct ice_adapter *adapter) {WARN_ON (!list_empty (&adapter->ports.ports)); +for (int i =0 ; i <ARRAY_SIZE (adapter->cpi_phy_lock); i++) +mutex_destroy (&adapter->cpi_phy_lock[i]);mutex_destroy (&adapter->ports.lock);kfree (adapter);
drivers/net/ethernet/intel/ice/ice_adapter.h +7 -0
@@ -5,9 +5,12 @@#define _ICE_ADAPTER_H_#include <linux/types.h> +#include <linux/mutex.h> #include <linux/spinlock_types.h> #include <linux/refcount_types.h> +#include "ice_type.h" +struct pci_dev ;struct ice_pf ;
@@ -31,6 +34,8 @@ struct ice_port_list {* @ptp_gltsyn_time_lock: Spinlock protecting access to the GLTSYN_TIME * register of the PTP clock. * @txq_ctx_lock: Spinlock protecting access to the GLCOMM_QTX_CNTX_CTL register +* @cpi_phy_lock: Per-PHY mutex serializing CPI REQ/ACK transactions. +* Index 0 = PHY0, index 1 = PHY1. Used on E825C devices. * @ctrl_pf: Control PF of the adapter * @ports: Ports list * @index: 64-bit index cached for collision detection on 32bit systems
@@ -41,6 +46,8 @@ struct ice_adapter {spinlock_t ptp_gltsyn_time_lock;/* For access to GLCOMM_QTX_CNTX_CTL register */ spinlock_t txq_ctx_lock; +/* Serialize CPI REQ/ACK transactions per PHY (E825C only) */ +struct mutex cpi_phy_lock[ICE_E825_MAX_PHYS ];struct ice_pf *ctrl_pf;struct ice_port_list ports;
drivers/net/ethernet/intel/ice/ice_cpi.c new file +362 -0
362 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_cpi.h new file +58 -0
58 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_sbq_cmd.h +3 -2
@@ -54,8 +54,9 @@ enum ice_sbq_dev_id { };enum ice_sbq_msg_opcode { - ice_sbq_msg_rd =0x00 , - ice_sbq_msg_wr =0x01 + ice_sbq_msg_rd =0x00 , + ice_sbq_msg_wr =0x01 , + ice_sbq_msg_wr_np =0x02 };#define ICE_SBQ_MSG_FLAGS 0x40
drivers/net/ethernet/intel/ice/ice_type.h +2 -0
@@ -893,6 +893,8 @@ struct ice_ptp_hw {u8 ports_per_phy; }; +#define ICE_E825_MAX_PHYS 2 +/* Port hardware description */ struct ice_hw {u8 __iomem *hw_addr;
Signature · 1 line
2.39.3
RE: [Intel-wired-lan] [PATCH v10 net-next 6/8] ice: implement CPI support for E825C
Quoted 71 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Grzegorz Nitka
Sent: Wednesday, May 20, 2026 11:36 AM
To: [email protected]
Cc: Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; Kubalewski, Arkadiusz <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]
Subject: [Intel-wired-lan] [PATCH v10 net-next 6/8] ice: implement CPI support for E825CAdd full CPI (Converged PHY Interface) command handling required for E825C devices. The CPI interface allows the driver to interact with PHY-side control logic through the LM/PHY command registers, including enabling/disabling/selection of PHY reference clock.
This patch introduces:
- a new CPI subsystem (ice_cpi.c/ice_cpi.h) implementing the CPI request/acknowledge state machine, including REQ/ACK protocol, command execution, and response handling
- helper functions for reading/writing PHY registers over Sideband Queue
- CPI command execution API (ice_cpi_exec) and a helper for enabling
or
disabling Tx reference clocks (CPI0xF1opcode 'Config PHY
clocking')
- assurance of CPI transaction serialization into the CPI core.
CPI REQ/ACK is a multi-step handshake and must be executed
atomically per PHY. Centralize the lock inice_cpi_exec()and use adapter-scoped per-PHY mutexes, which match the hardware
sharing
model across PFs.
- addition of the non-posted write opcode (wr_np) to SBQ
-Makefileintegration to build CPI support together with the PTP
stackThis provides the infrastructure necessary to support PHY-side configuration flows on E825C and is required for advanced link control and Tx reference clock management.
Reviewed-by Arkadiusz Kubalewski <[email protected]>Signed-off-by Grzegorz Nitka <[email protected]>--- drivers/net/ethernet/intel/ice/Makefile | 2 +- drivers/net/ethernet/intel/ice/ice_adapter.c | 4 + drivers/net/ethernet/intel/ice/ice_adapter.h | 7 + drivers/net/ethernet/intel/ice/ice_cpi.c | 362 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_cpi.h | 58 +++ drivers/net/ethernet/intel/ice/ice_sbq_cmd.h | 5 +- drivers/net/ethernet/intel/ice/ice_type.h | 2 + 7 files changed, 437 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.c create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.hdrivers/net/ethernet/intel/ice/Makefile +0
-0@@ -54,7 +54,7 @@ ice-$(CONFIG_PCI_IOV) += \ ice_vf_mbx.o \ ice_vf_vsi_vlan_ops.o \ ice_vf_lib.o
...
Quoted 13 lines
drivers/net/ethernet/intel/ice/Makefile +12
-0+ +/** + * ice_cpi_set_cmd - execute CPI SET command + * @hw: pointer to the HW struct + * @opcode: CPI command opcode + * @phy: phy index CPI command is applied for + * @port_lane: ephy index CPI command is applied for + * @data: CPI opcode context specific data + * + * Return: 0 on success, negative error code on failure. + */ +static int ice_cpi_set_cmd(struct ice_hw *hw, u16 opcode, u8 phy, u8
port_lane,
drivers/net/ethernet/intel/ice/Makefile
Quoted 5 lines
drivers/net/ethernet/intel/ice/Makefile +5
-0+ u16 data) +{ + struct ice_cpi_resp cpi_resp = {0}; + struct ice_cpi_cmd cpi_cmd = { + .opcode = opcode,
Silent u16 to u8 truncation.
Quoted 7 lines
drivers/net/ethernet/intel/ice/Makefile +7
-0+ .set = true, + .port = port_lane, + .data = data, + }; + + return ice_cpi_exec(hw, phy, &cpi_cmd, &cpi_resp); } +
...
Quoted 5 lines
/* Port hardware description */
structice_hw{
u8__iomem*hw_addr;
--
2.39.3
RE: [Intel-wired-lan] [PATCH v10 net-next 6/8] ice: implement CPI support for E825C
Quoted 104 lines
-----Original Message-----
From: Loktionov, Aleksandr <[email protected]>
Sent: Wednesday, May 20, 2026 2:27 PM
To: Nitka, Grzegorz <[email protected]>; [email protected]
Cc: Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; Kubalewski, Arkadiusz <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]
Subject: RE: [Intel-wired-lan] [PATCH v10 net-next 6/8] ice: implement CPI support for E825CQuoted 5 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Grzegorz Nitka
Sent: Wednesday, May 20, 2026 11:36 AM
To: [email protected]Quoted 8 lines
Cc: Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; Kubalewski, Arkadiusz <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; [email protected];
Quoted 56 lines
Subject: [Intel-wired-lan] [PATCH v10 net-next 6/8] ice: implement CPI support for E825C
Add full CPI (Converged PHY Interface) command handling required for E825C devices. The CPI interface allows the driver to interact with PHY-side control logic through the LM/PHY command registers, including enabling/disabling/selection of PHY reference clock.
This patch introduces:
- a new CPI subsystem (ice_cpi.c/ice_cpi.h) implementing the CPI request/acknowledge state machine, including REQ/ACK protocol, command execution, and response handling
- helper functions for reading/writing PHY registers over Sideband Queue
- CPI command execution API (ice_cpi_exec) and a helper for enabling
or
disabling Tx reference clocks (CPI0xF1opcode 'Config PHY
clocking')
- assurance of CPI transaction serialization into the CPI core.
CPI REQ/ACK is a multi-step handshake and must be executed
atomically per PHY. Centralize the lock inice_cpi_exec()and use adapter-scoped per-PHY mutexes, which match the hardware
sharing
model across PFs.
- addition of the non-posted write opcode (wr_np) to SBQ
-Makefileintegration to build CPI support together with the PTP
stackThis provides the infrastructure necessary to support PHY-side configuration flows on E825C and is required for advanced link control and Tx reference clock management.
Reviewed-by Arkadiusz Kubalewski <[email protected]>Signed-off-by Grzegorz Nitka <[email protected]>--- drivers/net/ethernet/intel/ice/Makefile | 2 +- drivers/net/ethernet/intel/ice/ice_adapter.c | 4 + drivers/net/ethernet/intel/ice/ice_adapter.h | 7 + drivers/net/ethernet/intel/ice/ice_cpi.c | 362 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_cpi.h | 58 +++ drivers/net/ethernet/intel/ice/ice_sbq_cmd.h | 5 +- drivers/net/ethernet/intel/ice/ice_type.h | 2 + 7 files changed, 437 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.c create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.hdrivers/net/ethernet/intel/ice/Makefile +0
-0@@ -54,7 +54,7 @@ ice-$(CONFIG_PCI_IOV) += \ ice_vf_mbx.o \ ice_vf_vsi_vlan_ops.o \ ice_vf_lib.o...
Quoted 11 lines
drivers/net/ethernet/intel/ice/Makefile +11
-0+ +/** + * ice_cpi_set_cmd - execute CPI SET command + * @hw: pointer to the HW struct + * @opcode: CPI command opcode + * @phy: phy index CPI command is applied for + * @port_lane: ephy index CPI command is applied for + * @data: CPI opcode context specific data + * + * Return: 0 on success, negative error code on failure. + */
Quoted 9 lines
drivers/net/ethernet/intel/ice/Makefile
Quoted 7 lines
+static int ice_cpi_set_cmd(struct
ice_hw*hw, u16 opcode, u8 phy, u8port_lane,drivers/net/ethernet/intel/ice/Makefile +5
-0+ u16 data) +{ + struct ice_cpi_resp cpi_resp = {0}; + struct ice_cpi_cmd cpi_cmd = { + .opcode = opcode,Silent u16 to u8 truncation.
Yeah, it's 8 bit. Changed 'opcode' to u8 in v11.
Quoted 15 lines
Quoted 7 lines
drivers/net/ethernet/intel/ice/Makefile +7
-0+ .set = true, + .port = port_lane, + .data = data, + }; + + return ice_cpi_exec(hw, phy, &cpi_cmd, &cpi_resp); } +...
Quoted 5 lines
/* Port hardware description */
structice_hw{
u8__iomem*hw_addr;
--
2.39.3
RE: [Intel-wired-lan] [PATCH v10 net-next 6/8] ice: implement CPI support for E825C
In reply to Grzegorz NitkaQuoted 88 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Grzegorz Nitka
Sent: Wednesday, May 20, 2026 11:36 AM
To: [email protected]
Cc: Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; Kubalewski, Arkadiusz <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]
Subject: [Intel-wired-lan] [PATCH v10 net-next 6/8] ice: implement CPI support for E825CAdd full CPI (Converged PHY Interface) command handling required for E825C devices. The CPI interface allows the driver to interact with PHY-side control logic through the LM/PHY command registers, including enabling/disabling/selection of PHY reference clock.
This patch introduces:
- a new CPI subsystem (ice_cpi.c/ice_cpi.h) implementing the CPI request/acknowledge state machine, including REQ/ACK protocol, command execution, and response handling
- helper functions for reading/writing PHY registers over Sideband Queue
- CPI command execution API (ice_cpi_exec) and a helper for enabling
or
disabling Tx reference clocks (CPI0xF1opcode 'Config PHY
clocking')
- assurance of CPI transaction serialization into the CPI core.
CPI REQ/ACK is a multi-step handshake and must be executed
atomically per PHY. Centralize the lock inice_cpi_exec()and use adapter-scoped per-PHY mutexes, which match the hardware
sharing
model across PFs.
- addition of the non-posted write opcode (wr_np) to SBQ
-Makefileintegration to build CPI support together with the PTP
stackThis provides the infrastructure necessary to support PHY-side configuration flows on E825C and is required for advanced link control and Tx reference clock management.
Reviewed-by Arkadiusz Kubalewski <[email protected]>Signed-off-by Grzegorz Nitka <[email protected]>--- drivers/net/ethernet/intel/ice/Makefile | 2 +- drivers/net/ethernet/intel/ice/ice_adapter.c | 4 + drivers/net/ethernet/intel/ice/ice_adapter.h | 7 + drivers/net/ethernet/intel/ice/ice_cpi.c | 362 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_cpi.h | 58 +++ drivers/net/ethernet/intel/ice/ice_sbq_cmd.h | 5 +- drivers/net/ethernet/intel/ice/ice_type.h | 2 + 7 files changed, 437 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.c create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.hdrivers/net/ethernet/intel/ice/Makefile +0
-1@@ -54,7 +54,7 @@ ice-$(CONFIG_PCI_IOV) += \ ice_vf_mbx.o \ ice_vf_vsi_vlan_ops.o \ ice_vf_lib.o -ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.oice_tspll.o
drivers/net/ethernet/intel/ice/Makefile +2
-0+ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o +ice_tspll.o ice_cpi.o ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.odrivers/net/ethernet/intel/ice/ice_adapter.c +0
-0@@ -62,6 +62,8 @@ static struct ice_adapter *ice_adapter_new(struct pci_dev *pdev) adapter->index = ice_adapter_index(pdev);spin_lock_init (&adapter->ptp_gltsyn_time_lock);spin_lock_init (&adapter->txq_ctx_lock);
...
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_adapter.c +5
-0+/* CPI PHY CMD DATA register (CPI0_PHY1_CMD_DATA) */ +#define CPI_PHY_CMD_DATA_M GENMASK(15, 0) +#define CPI_PHY_CMD_OPCODE_M GENMASK(23, 16) +#define CPI_PHY_CMD_PORTLANE_M GENMASK(26, 24) +#define CPI_PHY_CMD_RSVD_M GENMASK(29, 27)
drivers/net/ethernet/intel/ice/ice_adapter.c
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_adapter.c +10
-0+#define CPI_PHY_CMD_ERROR_M BIT(30) +#define CPI_PHY_CMD_ACK_M BIT(31) + +/* CPI LM CMD DATA register (CPI0_LM1_CMD_DATA) */ +#define CPI_LM_CMD_DATA_M GENMASK(15, 0) +#define CPI_LM_CMD_OPCODE_M GENMASK(23, 16) +#define CPI_LM_CMD_PORTLANE_M GENMASK(26, 24) +#define CPI_LM_CMD_RSVD_M GENMASK(28, 27) +#define CPI_LM_CMD_GET_SET_M BIT(29) +#define CPI_LM_CMD_REQ_M BIT(31)
Indent inconsistency spaces instead of TAB
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_adapter.c +7
-0+ +#define CPI_OPCODE_PHY_CLK 0xF1 +#define CPI_OPCODE_PHY_CLK_PHY_SEL_M GENMASK(9, 6) +#define CPI_OPCODE_PHY_CLK_REF_CTRL_M GENMASK(5, 4) +#define CPI_OPCODE_PHY_CLK_DISABLE 1 +#define CPI_OPCODE_PHY_CLK_ENABLE 2 +#define CPI_OPCODE_PHY_CLK_REF_SEL_M GENMASK(3, 0)
...
Quoted 5 lines
/* Port hardware description */
structice_hw{
u8__iomem*hw_addr;
--
2.39.3
RE: [Intel-wired-lan] [PATCH v10 net-next 6/8] ice: implement CPI support for E825C
Quoted 111 lines
-----Original Message-----
From: Loktionov, Aleksandr <[email protected]>
Sent: Wednesday, May 20, 2026 2:38 PM
To: Nitka, Grzegorz <[email protected]>; [email protected]
Cc: Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; Kubalewski, Arkadiusz <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]
Subject: RE: [Intel-wired-lan] [PATCH v10 net-next 6/8] ice: implement CPI support for E825CQuoted 5 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Grzegorz Nitka
Sent: Wednesday, May 20, 2026 11:36 AM
To: [email protected]Quoted 8 lines
Cc: Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; Kubalewski, Arkadiusz <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; [email protected];
Quoted 73 lines
Subject: [Intel-wired-lan] [PATCH v10 net-next 6/8] ice: implement CPI support for E825C
Add full CPI (Converged PHY Interface) command handling required for E825C devices. The CPI interface allows the driver to interact with PHY-side control logic through the LM/PHY command registers, including enabling/disabling/selection of PHY reference clock.
This patch introduces:
- a new CPI subsystem (ice_cpi.c/ice_cpi.h) implementing the CPI request/acknowledge state machine, including REQ/ACK protocol, command execution, and response handling
- helper functions for reading/writing PHY registers over Sideband Queue
- CPI command execution API (ice_cpi_exec) and a helper for enabling
or
disabling Tx reference clocks (CPI0xF1opcode 'Config PHY
clocking')
- assurance of CPI transaction serialization into the CPI core.
CPI REQ/ACK is a multi-step handshake and must be executed
atomically per PHY. Centralize the lock inice_cpi_exec()and use adapter-scoped per-PHY mutexes, which match the hardware
sharing
model across PFs.
- addition of the non-posted write opcode (wr_np) to SBQ
-Makefileintegration to build CPI support together with the PTP
stackThis provides the infrastructure necessary to support PHY-side configuration flows on E825C and is required for advanced link control and Tx reference clock management.
Reviewed-by Arkadiusz Kubalewski <[email protected]>Signed-off-by Grzegorz Nitka <[email protected]>--- drivers/net/ethernet/intel/ice/Makefile | 2 +- drivers/net/ethernet/intel/ice/ice_adapter.c | 4 + drivers/net/ethernet/intel/ice/ice_adapter.h | 7 + drivers/net/ethernet/intel/ice/ice_cpi.c | 362 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_cpi.h | 58 +++ drivers/net/ethernet/intel/ice/ice_sbq_cmd.h | 5 +- drivers/net/ethernet/intel/ice/ice_type.h | 2 + 7 files changed, 437 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.c create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.hdrivers/net/ethernet/intel/ice/Makefile +0
-1@@ -54,7 +54,7 @@ ice-$(CONFIG_PCI_IOV) += \ ice_vf_mbx.o \ ice_vf_vsi_vlan_ops.o \ ice_vf_lib.o -ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.oice_tspll.o
drivers/net/ethernet/intel/ice/Makefile +2
-0+ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o +ice_tspll.o ice_cpi.o ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.odrivers/net/ethernet/intel/ice/ice_adapter.c +0
-0@@ -62,6 +62,8 @@ static struct ice_adapter *ice_adapter_new(struct pci_dev *pdev) adapter->index = ice_adapter_index(pdev);spin_lock_init (&adapter->ptp_gltsyn_time_lock);spin_lock_init (&adapter->txq_ctx_lock);...
Quoted 16 lines
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_adapter.c +5
-0+/* CPI PHY CMD DATA register (CPI0_PHY1_CMD_DATA) */ +#define CPI_PHY_CMD_DATA_M GENMASK(15, 0) +#define CPI_PHY_CMD_OPCODE_M GENMASK(23, 16) +#define CPI_PHY_CMD_PORTLANE_M GENMASK(26, 24) +#define CPI_PHY_CMD_RSVD_M GENMASK(29, 27)drivers/net/ethernet/intel/ice/ice_adapter.c
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_adapter.c +10
-0+#define CPI_PHY_CMD_ERROR_M BIT(30) +#define CPI_PHY_CMD_ACK_M BIT(31) + +/* CPI LM CMD DATA register (CPI0_LM1_CMD_DATA) */ +#define CPI_LM_CMD_DATA_M GENMASK(15, 0) +#define CPI_LM_CMD_OPCODE_M GENMASK(23, 16) +#define CPI_LM_CMD_PORTLANE_M GENMASK(26, 24) +#define CPI_LM_CMD_RSVD_M GENMASK(28, 27) +#define CPI_LM_CMD_GET_SET_M BIT(29) +#define CPI_LM_CMD_REQ_M BIT(31)Indent inconsistency spaces instead of TAB
Fixed in v11.
Quoted 17 lines
drivers/net/ethernet/intel/ice/ice_adapter.c
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_adapter.c +4
-0+ +#define CPI_OPCODE_PHY_CLK 0xF1 +#define CPI_OPCODE_PHY_CLK_PHY_SEL_M GENMASK(9, 6) +#define CPI_OPCODE_PHY_CLK_REF_CTRL_M GENMASK(5,4)
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_adapter.c +3
-0+#define CPI_OPCODE_PHY_CLK_DISABLE 1 +#define CPI_OPCODE_PHY_CLK_ENABLE 2 +#define CPI_OPCODE_PHY_CLK_REF_SEL_M GENMASK(3, 0)...
Quoted 5 lines
/* Port hardware description */
structice_hw{
u8__iomem*hw_addr;
--
2.39.3
PATCH v10 7/8 ice: add Tx reference clock index handling to AN restart command
In reply to Grzegorz NitkaExtend the Restart Auto-Negotiation (AN) AdminQ command with a new parameter allowing software to specify the Tx reference clock index to be used during link restart.
This patch:
- adds REFCLK field definitions to ice_aqc_restart_an
- updates ice_aq_set_link_restart_an() to take a new refclk parameter and properly encode it into the command
- keeps legacy behavior by passing REFCLK_NOCHANGE where appropriate
This prepares the driver for configurations requiring dynamic selection of the Tx reference clock as part of the AN flow.
--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 2 ++ drivers/net/ethernet/intel/ice/ice_common.c | 5 ++++- drivers/net/ethernet/intel/ice/ice_common.h | 2 +- drivers/net/ethernet/intel/ice/ice_lib.c | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +2 -0
@@ -1169,6 +1169,8 @@ struct ice_aqc_restart_an {u8 cmd_flags;#define ICE_AQC_RESTART_AN_LINK_RESTART BIT(1)#define ICE_AQC_RESTART_AN_LINK_ENABLE BIT(2) +#define ICE_AQC_RESTART_AN_REFCLK_M GENMASK(4, 3) +#define ICE_AQC_RESTART_AN_REFCLK_NOCHANGE 0u8 reserved2[13 ]; };
drivers/net/ethernet/intel/ice/ice_common.c +4 -1
@@ -4124,12 +4124,13 @@ int ice_get_link_status(struct ice_port_info *pi, bool *link_up)* @pi: pointer to the port information structure * @ena_link: if true: enable link, if false: disable link * @cd: pointer to command details structure or NULL +* @refclk: the new TX reference clock, 0 if no change * * Sets up the link and restarts the Auto-Negotiation over the link. */ int ice_aq_set_link_restart_an (struct ice_port_info *pi,bool ena_link, -struct ice_sq_cd *cd) +struct ice_sq_cd *cd,u8 refclk) {struct ice_aqc_restart_an *cmd;struct libie_aq_desc desc;
@@ -4145,6 +4146,8 @@ ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,else cmd->cmd_flags &= ~ICE_AQC_RESTART_AN_LINK_ENABLE ; + cmd->cmd_flags |=FIELD_PREP (ICE_AQC_RESTART_AN_REFCLK_M , refclk); +return ice_aq_send_cmd (pi->hw, &desc,NULL ,0 , cd); }
drivers/net/ethernet/intel/ice/ice_common.h +1 -1
@@ -215,7 +215,7 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, enum ice_fec_mode fec);int ice_aq_set_link_restart_an (struct ice_port_info *pi,bool ena_link, -struct ice_sq_cd *cd); +struct ice_sq_cd *cd,u8 refclk);int ice_aq_set_mac_cfg (struct ice_hw *hw,u16 max_frame_size,struct ice_sq_cd *cd);int
drivers/net/ethernet/intel/ice/ice_lib.c +2 -1
@@ -3769,7 +3769,8 @@ int ice_set_link(struct ice_vsi *vsi, bool ena)if (vsi->type !=ICE_VSI_PF )return -EINVAL ; - status =ice_aq_set_link_restart_an (pi, ena,NULL ); + status =ice_aq_set_link_restart_an (pi, ena,NULL , +ICE_AQC_RESTART_AN_REFCLK_NOCHANGE );/* if link is owned by manageability, FW will return LIBIE_AQ_RC_EMODE. * this is not a fatal error, so print a warning message and return
Signature · 1 line
2.39.3