summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/intel/ice/ice_common.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-11-14 01:36:35 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-11-14 01:36:35 +0300
commitd6b9ce75e87c5f4bfbc0f7bba4f4f7cbf942f98a (patch)
tree0b052e77f632b0cd080ffc5da3b5525e676f05f4 /drivers/net/ethernet/intel/ice/ice_common.c
parent8d422b8beb76bfc57f0fe4b03082f3823eccd150 (diff)
parentd0fcf70c680e4d1669fcb3a8632f41400b9a73c2 (diff)
downloadlinux-d6b9ce75e87c5f4bfbc0f7bba4f4f7cbf942f98a.tar.xz
Merge tag 'stratix10_svc_fix_v6.18' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux into char-misc-linus
Dinh writes: firmware: stratix10-svc: fix saving contoller data for v6.18 - Fix the incorrect use of platform_set_drvdata and dev_set_drvdata * tag 'stratix10_svc_fix_v6.18' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux: (237 commits) firmware: stratix10-svc: fix bug in saving controller data Linux 6.18-rc4 objtool: Fix skip_alt_group() for non-alternative STAC/CLAC kconfig/nconf: Initialize the default locale at startup kconfig/mconf: Initialize the default locale at startup x86/mm: Ensure clear_page() variants always have __kcfi_typeid_ symbols PCI: Do not size non-existing prefetchable window Revert "PCI: qcom: Remove custom ASPM enablement code" bpf/arm64: Fix BPF_ST into arena memory bpf: Make migrate_disable always inline to avoid partial inlining null_blk: set dma alignment to logical block size xfs: document another racy GC case in xfs_zoned_map_extent xfs: prevent gc from picking the same zone twice drm/ast: Clear preserved bits from register output value s390: Disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP drm/imx: parallel-display: add the bridge before attaching it drm/imx: parallel-display: convert to devm_drm_bridge_alloc() API blk-crypto: use BLK_STS_INVAL for alignment errors regulator: bd718x7: Fix voltages scaled by resistor divider x86/cpu: Add/fix core comments for {Panther,Nova} Lake ...
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_common.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_common.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index 2250426ec91b..2532b6f82e97 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -4382,6 +4382,15 @@ int ice_get_phy_lane_number(struct ice_hw *hw)
unsigned int lane;
int err;
+ /* E82X does not have sequential IDs, lane number is PF ID.
+ * For E825 device, the exception is the variant with external
+ * PHY (0x579F), in which there is also 1:1 pf_id -> lane_number
+ * mapping.
+ */
+ if (hw->mac_type == ICE_MAC_GENERIC ||
+ hw->device_id == ICE_DEV_ID_E825C_SGMII)
+ return hw->pf_id;
+
options = kcalloc(ICE_AQC_PORT_OPT_MAX, sizeof(*options), GFP_KERNEL);
if (!options)
return -ENOMEM;
@@ -6497,6 +6506,28 @@ u32 ice_get_link_speed(u16 index)
}
/**
+ * ice_get_dest_cgu - get destination CGU dev for given HW
+ * @hw: pointer to the HW struct
+ *
+ * Get CGU client id for CGU register read/write operations.
+ *
+ * Return: CGU device id to use in SBQ transactions.
+ */
+static enum ice_sbq_dev_id ice_get_dest_cgu(struct ice_hw *hw)
+{
+ /* On dual complex E825 only complex 0 has functional CGU powering all
+ * the PHYs.
+ * SBQ destination device cgu points to CGU on a current complex and to
+ * access primary CGU from the secondary complex, the driver should use
+ * cgu_peer as a destination device.
+ */
+ if (hw->mac_type == ICE_MAC_GENERIC_3K_E825 && ice_is_dual(hw) &&
+ !ice_is_primary(hw))
+ return ice_sbq_dev_cgu_peer;
+ return ice_sbq_dev_cgu;
+}
+
+/**
* ice_read_cgu_reg - Read a CGU register
* @hw: Pointer to the HW struct
* @addr: Register address to read
@@ -6510,8 +6541,8 @@ u32 ice_get_link_speed(u16 index)
int ice_read_cgu_reg(struct ice_hw *hw, u32 addr, u32 *val)
{
struct ice_sbq_msg_input cgu_msg = {
+ .dest_dev = ice_get_dest_cgu(hw),
.opcode = ice_sbq_msg_rd,
- .dest_dev = ice_sbq_dev_cgu,
.msg_addr_low = addr
};
int err;
@@ -6542,8 +6573,8 @@ int ice_read_cgu_reg(struct ice_hw *hw, u32 addr, u32 *val)
int ice_write_cgu_reg(struct ice_hw *hw, u32 addr, u32 val)
{
struct ice_sbq_msg_input cgu_msg = {
+ .dest_dev = ice_get_dest_cgu(hw),
.opcode = ice_sbq_msg_wr,
- .dest_dev = ice_sbq_dev_cgu,
.msg_addr_low = addr,
.data = val
};