Skip to content

Commit fce3521

Browse files
committed
Merge: [Intel 9.6 FEAT]GPIO (1PPS/EXTTS) fixes
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5378 JIRA: https://issues.redhat.com/browse/RHEL-29207 Patches are required to activate the GNR-D platform. Signed-off-by: Petr Oros <[email protected]> Signed-off-by: Michal Schmidt <[email protected]> Approved-by: Michal Schmidt <[email protected]> Approved-by: José Ignacio Tornos Martínez <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: Augusto Caringi <[email protected]>
2 parents a05ed4d + 09a8095 commit fce3521

File tree

11 files changed

+930
-963
lines changed

11 files changed

+930
-963
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,5 +1046,10 @@ static inline void ice_clear_rdma_cap(struct ice_pf *pf)
10461046
clear_bit(ICE_FLAG_RDMA_ENA, pf->flags);
10471047
}
10481048

1049+
static inline enum ice_phy_model ice_get_phy_model(const struct ice_hw *hw)
1050+
{
1051+
return hw->ptp.phy_model;
1052+
}
1053+
10491054
extern const struct xdp_metadata_ops ice_xdp_md_ops;
10501055
#endif /* _ICE_H_ */

drivers/net/ethernet/intel/ice/ice_adapter.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
#include <linux/spinlock.h>
1010
#include <linux/xarray.h>
1111
#include "ice_adapter.h"
12+
#include "ice.h"
1213

1314
static DEFINE_XARRAY(ice_adapters);
1415
static DEFINE_MUTEX(ice_adapters_mutex);
1516

1617
/* PCI bus number is 8 bits. Slot is 5 bits. Domain can have the rest. */
1718
#define INDEX_FIELD_DOMAIN GENMASK(BITS_PER_LONG - 1, 13)
19+
#define INDEX_FIELD_DEV GENMASK(31, 16)
1820
#define INDEX_FIELD_BUS GENMASK(12, 5)
1921
#define INDEX_FIELD_SLOT GENMASK(4, 0)
2022

@@ -24,9 +26,17 @@ static unsigned long ice_adapter_index(const struct pci_dev *pdev)
2426

2527
WARN_ON(domain > FIELD_MAX(INDEX_FIELD_DOMAIN));
2628

27-
return FIELD_PREP(INDEX_FIELD_DOMAIN, domain) |
28-
FIELD_PREP(INDEX_FIELD_BUS, pdev->bus->number) |
29-
FIELD_PREP(INDEX_FIELD_SLOT, PCI_SLOT(pdev->devfn));
29+
switch (pdev->device) {
30+
case ICE_DEV_ID_E825C_BACKPLANE:
31+
case ICE_DEV_ID_E825C_QSFP:
32+
case ICE_DEV_ID_E825C_SFP:
33+
case ICE_DEV_ID_E825C_SGMII:
34+
return FIELD_PREP(INDEX_FIELD_DEV, pdev->device);
35+
default:
36+
return FIELD_PREP(INDEX_FIELD_DOMAIN, domain) |
37+
FIELD_PREP(INDEX_FIELD_BUS, pdev->bus->number) |
38+
FIELD_PREP(INDEX_FIELD_SLOT, PCI_SLOT(pdev->devfn));
39+
}
3040
}
3141

3242
static struct ice_adapter *ice_adapter_new(void)
@@ -40,11 +50,17 @@ static struct ice_adapter *ice_adapter_new(void)
4050
spin_lock_init(&adapter->ptp_gltsyn_time_lock);
4151
refcount_set(&adapter->refcount, 1);
4252

53+
mutex_init(&adapter->ports.lock);
54+
INIT_LIST_HEAD(&adapter->ports.ports);
55+
4356
return adapter;
4457
}
4558

4659
static void ice_adapter_free(struct ice_adapter *adapter)
4760
{
61+
WARN_ON(!list_empty(&adapter->ports.ports));
62+
mutex_destroy(&adapter->ports.lock);
63+
4864
kfree(adapter);
4965
}
5066

drivers/net/ethernet/intel/ice/ice_adapter.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,42 @@
44
#ifndef _ICE_ADAPTER_H_
55
#define _ICE_ADAPTER_H_
66

7+
#include <linux/types.h>
78
#include <linux/spinlock_types.h>
89
#include <linux/refcount.h>
910

1011
struct pci_dev;
12+
struct ice_pf;
13+
14+
/**
15+
* struct ice_port_list - data used to store the list of adapter ports
16+
*
17+
* This structure contains data used to maintain a list of adapter ports
18+
*
19+
* @ports: list of ports
20+
* @lock: protect access to the ports list
21+
*/
22+
struct ice_port_list {
23+
struct list_head ports;
24+
/* To synchronize the ports list operations */
25+
struct mutex lock;
26+
};
1127

1228
/**
1329
* struct ice_adapter - PCI adapter resources shared across PFs
1430
* @ptp_gltsyn_time_lock: Spinlock protecting access to the GLTSYN_TIME
1531
* register of the PTP clock.
1632
* @refcount: Reference count. struct ice_pf objects hold the references.
33+
* @ctrl_pf: Control PF of the adapter
34+
* @ports: Ports list
1735
*/
1836
struct ice_adapter {
37+
refcount_t refcount;
1938
/* For access to the GLTSYN_TIME register */
2039
spinlock_t ptp_gltsyn_time_lock;
2140

22-
refcount_t refcount;
41+
struct ice_pf *ctrl_pf;
42+
struct ice_port_list ports;
2343
};
2444

2545
struct ice_adapter *ice_adapter_get(const struct pci_dev *pdev);

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,15 @@ struct ice_aqc_nvm {
17431743
};
17441744

17451745
#define ICE_AQC_NVM_START_POINT 0
1746+
#define ICE_AQC_NVM_SECTOR_UNIT 4096
1747+
#define ICE_AQC_NVM_SDP_AC_PTR_OFFSET 0xD8
1748+
#define ICE_AQC_NVM_SDP_AC_PTR_M GENMASK(14, 0)
1749+
#define ICE_AQC_NVM_SDP_AC_PTR_INVAL 0x7FFF
1750+
#define ICE_AQC_NVM_SDP_AC_PTR_TYPE_M BIT(15)
1751+
#define ICE_AQC_NVM_SDP_AC_SDP_NUM_M GENMASK(2, 0)
1752+
#define ICE_AQC_NVM_SDP_AC_DIR_M BIT(3)
1753+
#define ICE_AQC_NVM_SDP_AC_PIN_M GENMASK(15, 6)
1754+
#define ICE_AQC_NVM_SDP_AC_MAX_SIZE 7
17461755

17471756
#define ICE_AQC_NVM_TX_TOPO_MOD_ID 0x14B
17481757

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,8 @@ ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd,
578578
/**
579579
* ice_find_netlist_node
580580
* @hw: pointer to the hw struct
581-
* @node_type_ctx: type of netlist node to look for
581+
* @node_type: type of netlist node to look for
582+
* @ctx: context of the search
582583
* @node_part_number: node part number to look for
583584
* @node_handle: output parameter if node found - optional
584585
*
@@ -588,10 +589,12 @@ ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd,
588589
* valid if the function returns zero, and should be ignored on any non-zero
589590
* return value.
590591
*
591-
* Returns: 0 if the node is found, -ENOENT if no handle was found, and
592-
* a negative error code on failure to access the AQ.
592+
* Return:
593+
* * 0 if the node is found,
594+
* * -ENOENT if no handle was found,
595+
* * negative error code on failure to access the AQ.
593596
*/
594-
static int ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx,
597+
static int ice_find_netlist_node(struct ice_hw *hw, u8 node_type, u8 ctx,
595598
u8 node_part_number, u16 *node_handle)
596599
{
597600
u8 idx;
@@ -602,8 +605,8 @@ static int ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx,
602605
int status;
603606

604607
cmd.addr.topo_params.node_type_ctx =
605-
FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_TYPE_M,
606-
node_type_ctx);
608+
FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_TYPE_M, node_type) |
609+
FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_CTX_M, ctx);
607610
cmd.addr.topo_params.index = idx;
608611

609612
status = ice_aq_get_netlist_node(hw, &cmd,
@@ -2769,9 +2772,11 @@ ice_parse_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
27692772
*/
27702773
bool ice_is_phy_rclk_in_netlist(struct ice_hw *hw)
27712774
{
2772-
if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL,
2775+
if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_PHY,
2776+
ICE_AQC_LINK_TOPO_NODE_CTX_PORT,
27732777
ICE_AQC_GET_LINK_TOPO_NODE_NR_C827, NULL) &&
2774-
ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL,
2778+
ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_PHY,
2779+
ICE_AQC_LINK_TOPO_NODE_CTX_PORT,
27752780
ICE_AQC_GET_LINK_TOPO_NODE_NR_E822_PHY, NULL))
27762781
return false;
27772782

@@ -2787,6 +2792,7 @@ bool ice_is_phy_rclk_in_netlist(struct ice_hw *hw)
27872792
bool ice_is_clock_mux_in_netlist(struct ice_hw *hw)
27882793
{
27892794
if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_MUX,
2795+
ICE_AQC_LINK_TOPO_NODE_CTX_GLOBAL,
27902796
ICE_AQC_GET_LINK_TOPO_NODE_NR_GEN_CLK_MUX,
27912797
NULL))
27922798
return false;
@@ -2807,12 +2813,14 @@ bool ice_is_clock_mux_in_netlist(struct ice_hw *hw)
28072813
bool ice_is_cgu_in_netlist(struct ice_hw *hw)
28082814
{
28092815
if (!ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL,
2816+
ICE_AQC_LINK_TOPO_NODE_CTX_GLOBAL,
28102817
ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032,
28112818
NULL)) {
28122819
hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032;
28132820
return true;
28142821
} else if (!ice_find_netlist_node(hw,
28152822
ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL,
2823+
ICE_AQC_LINK_TOPO_NODE_CTX_GLOBAL,
28162824
ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384,
28172825
NULL)) {
28182826
hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384;
@@ -2831,6 +2839,7 @@ bool ice_is_cgu_in_netlist(struct ice_hw *hw)
28312839
bool ice_is_gps_in_netlist(struct ice_hw *hw)
28322840
{
28332841
if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_GPS,
2842+
ICE_AQC_LINK_TOPO_NODE_CTX_GLOBAL,
28342843
ICE_AQC_GET_LINK_TOPO_NODE_NR_GEN_GPS, NULL))
28352844
return false;
28362845

drivers/net/ethernet/intel/ice/ice_gnss.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ bool ice_gnss_is_gps_present(struct ice_hw *hw)
397397
int err;
398398
u8 data;
399399

400-
err = ice_read_pca9575_reg_e810t(hw, ICE_PCA9575_P0_IN, &data);
401-
if (err || !!(data & ICE_E810T_P0_GNSS_PRSNT_N))
400+
err = ice_read_pca9575_reg(hw, ICE_PCA9575_P0_IN, &data);
401+
if (err || !!(data & ICE_P0_GNSS_PRSNT_N))
402402
return false;
403403
} else {
404404
return false;

0 commit comments

Comments
 (0)