mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2024-10-01 (ice) This series contains updates to ice driver only. Karol cleans up current PTP GPIO pin handling, fixes minor bugs, refactors implementation for all products, introduces SDP (Software Definable Pins) for E825C and implements reading SDP section from NVM for E810 products. Sergey replaces multiple aux buses and devices used in the PTP support code with struct ice_adapter holding the necessary shared data. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue: ice: Drop auxbus use for PTP to finalize ice_adapter move ice: Use ice_adapter for PTP shared data instead of auxdev ice: Initial support for E825C hardware in ice_adapter ice: Add ice_get_ctrl_ptp() wrapper to simplify the code ice: Introduce ice_get_phy_model() wrapper ice: Enable 1PPS out from CGU for E825C products ice: Read SDP section from NVM for pin definitions ice: Disable shared pin on E810 on setfunc ice: Cache perout/extts requests and check flags ice: Align E810T GPIO to other products ice: Add SDPs support for E825C ice: Implement ice_ptp_pin_desc ==================== Link: https://patch.msgid.link/20241001201702.3252954-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -1047,5 +1047,10 @@ static inline void ice_clear_rdma_cap(struct ice_pf *pf)
|
||||
clear_bit(ICE_FLAG_RDMA_ENA, pf->flags);
|
||||
}
|
||||
|
||||
static inline enum ice_phy_model ice_get_phy_model(const struct ice_hw *hw)
|
||||
{
|
||||
return hw->ptp.phy_model;
|
||||
}
|
||||
|
||||
extern const struct xdp_metadata_ops ice_xdp_md_ops;
|
||||
#endif /* _ICE_H_ */
|
||||
|
||||
@@ -9,12 +9,14 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/xarray.h>
|
||||
#include "ice_adapter.h"
|
||||
#include "ice.h"
|
||||
|
||||
static DEFINE_XARRAY(ice_adapters);
|
||||
static DEFINE_MUTEX(ice_adapters_mutex);
|
||||
|
||||
/* PCI bus number is 8 bits. Slot is 5 bits. Domain can have the rest. */
|
||||
#define INDEX_FIELD_DOMAIN GENMASK(BITS_PER_LONG - 1, 13)
|
||||
#define INDEX_FIELD_DEV GENMASK(31, 16)
|
||||
#define INDEX_FIELD_BUS GENMASK(12, 5)
|
||||
#define INDEX_FIELD_SLOT GENMASK(4, 0)
|
||||
|
||||
@@ -24,9 +26,17 @@ static unsigned long ice_adapter_index(const struct pci_dev *pdev)
|
||||
|
||||
WARN_ON(domain > FIELD_MAX(INDEX_FIELD_DOMAIN));
|
||||
|
||||
return FIELD_PREP(INDEX_FIELD_DOMAIN, domain) |
|
||||
FIELD_PREP(INDEX_FIELD_BUS, pdev->bus->number) |
|
||||
FIELD_PREP(INDEX_FIELD_SLOT, PCI_SLOT(pdev->devfn));
|
||||
switch (pdev->device) {
|
||||
case ICE_DEV_ID_E825C_BACKPLANE:
|
||||
case ICE_DEV_ID_E825C_QSFP:
|
||||
case ICE_DEV_ID_E825C_SFP:
|
||||
case ICE_DEV_ID_E825C_SGMII:
|
||||
return FIELD_PREP(INDEX_FIELD_DEV, pdev->device);
|
||||
default:
|
||||
return FIELD_PREP(INDEX_FIELD_DOMAIN, domain) |
|
||||
FIELD_PREP(INDEX_FIELD_BUS, pdev->bus->number) |
|
||||
FIELD_PREP(INDEX_FIELD_SLOT, PCI_SLOT(pdev->devfn));
|
||||
}
|
||||
}
|
||||
|
||||
static struct ice_adapter *ice_adapter_new(void)
|
||||
@@ -40,11 +50,17 @@ static struct ice_adapter *ice_adapter_new(void)
|
||||
spin_lock_init(&adapter->ptp_gltsyn_time_lock);
|
||||
refcount_set(&adapter->refcount, 1);
|
||||
|
||||
mutex_init(&adapter->ports.lock);
|
||||
INIT_LIST_HEAD(&adapter->ports.ports);
|
||||
|
||||
return adapter;
|
||||
}
|
||||
|
||||
static void ice_adapter_free(struct ice_adapter *adapter)
|
||||
{
|
||||
WARN_ON(!list_empty(&adapter->ports.ports));
|
||||
mutex_destroy(&adapter->ports.lock);
|
||||
|
||||
kfree(adapter);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,22 +4,42 @@
|
||||
#ifndef _ICE_ADAPTER_H_
|
||||
#define _ICE_ADAPTER_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/spinlock_types.h>
|
||||
#include <linux/refcount_types.h>
|
||||
|
||||
struct pci_dev;
|
||||
struct ice_pf;
|
||||
|
||||
/**
|
||||
* struct ice_port_list - data used to store the list of adapter ports
|
||||
*
|
||||
* This structure contains data used to maintain a list of adapter ports
|
||||
*
|
||||
* @ports: list of ports
|
||||
* @lock: protect access to the ports list
|
||||
*/
|
||||
struct ice_port_list {
|
||||
struct list_head ports;
|
||||
/* To synchronize the ports list operations */
|
||||
struct mutex lock;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ice_adapter - PCI adapter resources shared across PFs
|
||||
* @ptp_gltsyn_time_lock: Spinlock protecting access to the GLTSYN_TIME
|
||||
* register of the PTP clock.
|
||||
* @refcount: Reference count. struct ice_pf objects hold the references.
|
||||
* @ctrl_pf: Control PF of the adapter
|
||||
* @ports: Ports list
|
||||
*/
|
||||
struct ice_adapter {
|
||||
refcount_t refcount;
|
||||
/* For access to the GLTSYN_TIME register */
|
||||
spinlock_t ptp_gltsyn_time_lock;
|
||||
|
||||
refcount_t refcount;
|
||||
struct ice_pf *ctrl_pf;
|
||||
struct ice_port_list ports;
|
||||
};
|
||||
|
||||
struct ice_adapter *ice_adapter_get(const struct pci_dev *pdev);
|
||||
|
||||
@@ -1742,6 +1742,15 @@ struct ice_aqc_nvm {
|
||||
};
|
||||
|
||||
#define ICE_AQC_NVM_START_POINT 0
|
||||
#define ICE_AQC_NVM_SECTOR_UNIT 4096
|
||||
#define ICE_AQC_NVM_SDP_AC_PTR_OFFSET 0xD8
|
||||
#define ICE_AQC_NVM_SDP_AC_PTR_M GENMASK(14, 0)
|
||||
#define ICE_AQC_NVM_SDP_AC_PTR_INVAL 0x7FFF
|
||||
#define ICE_AQC_NVM_SDP_AC_PTR_TYPE_M BIT(15)
|
||||
#define ICE_AQC_NVM_SDP_AC_SDP_NUM_M GENMASK(2, 0)
|
||||
#define ICE_AQC_NVM_SDP_AC_DIR_M BIT(3)
|
||||
#define ICE_AQC_NVM_SDP_AC_PIN_M GENMASK(15, 6)
|
||||
#define ICE_AQC_NVM_SDP_AC_MAX_SIZE 7
|
||||
|
||||
#define ICE_AQC_NVM_TX_TOPO_MOD_ID 0x14B
|
||||
|
||||
|
||||
@@ -397,8 +397,8 @@ bool ice_gnss_is_gps_present(struct ice_hw *hw)
|
||||
int err;
|
||||
u8 data;
|
||||
|
||||
err = ice_read_pca9575_reg_e810t(hw, ICE_PCA9575_P0_IN, &data);
|
||||
if (err || !!(data & ICE_E810T_P0_GNSS_PRSNT_N))
|
||||
err = ice_read_pca9575_reg(hw, ICE_PCA9575_P0_IN, &data);
|
||||
if (err || !!(data & ICE_P0_GNSS_PRSNT_N))
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,37 +9,6 @@
|
||||
|
||||
#include "ice_ptp_hw.h"
|
||||
|
||||
enum ice_ptp_pin_e810 {
|
||||
GPIO_20 = 0,
|
||||
GPIO_21,
|
||||
GPIO_22,
|
||||
GPIO_23,
|
||||
NUM_PTP_PIN_E810
|
||||
};
|
||||
|
||||
enum ice_ptp_pin_e810t {
|
||||
GNSS = 0,
|
||||
SMA1,
|
||||
UFL1,
|
||||
SMA2,
|
||||
UFL2,
|
||||
NUM_PTP_PINS_E810T
|
||||
};
|
||||
|
||||
struct ice_perout_channel {
|
||||
bool ena;
|
||||
u32 gpio_pin;
|
||||
u32 flags;
|
||||
u64 period;
|
||||
u64 start_time;
|
||||
};
|
||||
|
||||
struct ice_extts_channel {
|
||||
bool ena;
|
||||
u32 gpio_pin;
|
||||
u32 flags;
|
||||
};
|
||||
|
||||
/* The ice hardware captures Tx hardware timestamps in the PHY. The timestamp
|
||||
* is stored in a buffer of registers. Depending on the specific hardware,
|
||||
* this buffer might be shared across multiple PHY ports.
|
||||
@@ -169,9 +138,8 @@ struct ice_ptp_tx {
|
||||
* ready for PTP functionality. It is used to track the port initialization
|
||||
* and determine when the port's PHY offset is valid.
|
||||
*
|
||||
* @list_member: list member structure of auxiliary device
|
||||
* @list_node: list member structure
|
||||
* @tx: Tx timestamp tracking for this port
|
||||
* @aux_dev: auxiliary device associated with this port
|
||||
* @ov_work: delayed work task for tracking when PHY offset is valid
|
||||
* @ps_lock: mutex used to protect the overall PTP PHY start procedure
|
||||
* @link_up: indicates whether the link is up
|
||||
@@ -179,9 +147,8 @@ struct ice_ptp_tx {
|
||||
* @port_num: the port number this structure represents
|
||||
*/
|
||||
struct ice_ptp_port {
|
||||
struct list_head list_member;
|
||||
struct list_head list_node;
|
||||
struct ice_ptp_tx tx;
|
||||
struct auxiliary_device aux_dev;
|
||||
struct kthread_delayed_work ov_work;
|
||||
struct mutex ps_lock; /* protects overall PTP PHY start procedure */
|
||||
bool link_up;
|
||||
@@ -195,22 +162,6 @@ enum ice_ptp_tx_interrupt {
|
||||
ICE_PTP_TX_INTERRUPT_ALL,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ice_ptp_port_owner - data used to handle the PTP clock owner info
|
||||
*
|
||||
* This structure contains data necessary for the PTP clock owner to correctly
|
||||
* handle the timestamping feature for all attached ports.
|
||||
*
|
||||
* @aux_driver: the structure carring the auxiliary driver information
|
||||
* @ports: list of porst handled by this port owner
|
||||
* @lock: protect access to ports list
|
||||
*/
|
||||
struct ice_ptp_port_owner {
|
||||
struct auxiliary_driver aux_driver;
|
||||
struct list_head ports;
|
||||
struct mutex lock;
|
||||
};
|
||||
|
||||
#define GLTSYN_TGT_H_IDX_MAX 4
|
||||
|
||||
enum ice_ptp_state {
|
||||
@@ -221,20 +172,69 @@ enum ice_ptp_state {
|
||||
ICE_PTP_ERROR,
|
||||
};
|
||||
|
||||
enum ice_ptp_pin {
|
||||
SDP0 = 0,
|
||||
SDP1,
|
||||
SDP2,
|
||||
SDP3,
|
||||
TIME_SYNC,
|
||||
ONE_PPS
|
||||
};
|
||||
|
||||
enum ice_ptp_pin_nvm {
|
||||
GNSS = 0,
|
||||
SMA1,
|
||||
UFL1,
|
||||
SMA2,
|
||||
UFL2,
|
||||
NUM_PTP_PINS_NVM,
|
||||
GPIO_NA = 9
|
||||
};
|
||||
|
||||
/* Per-channel register definitions */
|
||||
#define GLTSYN_AUX_OUT(_chan, _idx) (GLTSYN_AUX_OUT_0(_idx) + ((_chan) * 8))
|
||||
#define GLTSYN_AUX_IN(_chan, _idx) (GLTSYN_AUX_IN_0(_idx) + ((_chan) * 8))
|
||||
#define GLTSYN_CLKO(_chan, _idx) (GLTSYN_CLKO_0(_idx) + ((_chan) * 8))
|
||||
#define GLTSYN_TGT_L(_chan, _idx) (GLTSYN_TGT_L_0(_idx) + ((_chan) * 16))
|
||||
#define GLTSYN_TGT_H(_chan, _idx) (GLTSYN_TGT_H_0(_idx) + ((_chan) * 16))
|
||||
#define GLTSYN_EVNT_L(_chan, _idx) (GLTSYN_EVNT_L_0(_idx) + ((_chan) * 16))
|
||||
#define GLTSYN_EVNT_H(_chan, _idx) (GLTSYN_EVNT_H_0(_idx) + ((_chan) * 16))
|
||||
#define GLTSYN_EVNT_H_IDX_MAX 3
|
||||
|
||||
/* Pin definitions for PTP */
|
||||
#define ICE_N_PINS_MAX 6
|
||||
#define ICE_SMA_PINS_NUM 4
|
||||
#define ICE_PIN_DESC_ARR_LEN(_arr) (sizeof(_arr) / \
|
||||
sizeof(struct ice_ptp_pin_desc))
|
||||
|
||||
/**
|
||||
* struct ice_ptp_pin_desc - hardware pin description data
|
||||
* @name_idx: index of the name of pin in ice_pin_names
|
||||
* @gpio: the associated GPIO input and output pins
|
||||
*
|
||||
* Structure describing a PTP-capable GPIO pin that extends ptp_pin_desc array
|
||||
* for the device. Device families have separate sets of available pins with
|
||||
* varying restrictions.
|
||||
*/
|
||||
struct ice_ptp_pin_desc {
|
||||
int name_idx;
|
||||
int gpio[2];
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ice_ptp - data used for integrating with CONFIG_PTP_1588_CLOCK
|
||||
* @state: current state of PTP state machine
|
||||
* @tx_interrupt_mode: the TX interrupt mode for the PTP clock
|
||||
* @port: data for the PHY port initialization procedure
|
||||
* @ports_owner: data for the auxiliary driver owner
|
||||
* @work: delayed work function for periodic tasks
|
||||
* @cached_phc_time: a cached copy of the PHC time for timestamp extension
|
||||
* @cached_phc_jiffies: jiffies when cached_phc_time was last updated
|
||||
* @ext_ts_chan: the external timestamp channel in use
|
||||
* @ext_ts_irq: the external timestamp IRQ in use
|
||||
* @kworker: kwork thread for handling periodic work
|
||||
* @perout_channels: periodic output data
|
||||
* @extts_channels: channels for external timestamps
|
||||
* @ext_ts_irq: the external timestamp IRQ in use
|
||||
* @pin_desc: structure defining pins
|
||||
* @ice_pin_desc: internal structure describing pin relations
|
||||
* @perout_rqs: cached periodic output requests
|
||||
* @extts_rqs: cached external timestamp requests
|
||||
* @info: structure defining PTP hardware capabilities
|
||||
* @clock: pointer to registered PTP clock device
|
||||
* @tstamp_config: hardware timestamping configuration
|
||||
@@ -250,15 +250,15 @@ struct ice_ptp {
|
||||
enum ice_ptp_state state;
|
||||
enum ice_ptp_tx_interrupt tx_interrupt_mode;
|
||||
struct ice_ptp_port port;
|
||||
struct ice_ptp_port_owner ports_owner;
|
||||
struct kthread_delayed_work work;
|
||||
u64 cached_phc_time;
|
||||
unsigned long cached_phc_jiffies;
|
||||
u8 ext_ts_chan;
|
||||
u8 ext_ts_irq;
|
||||
struct kthread_worker *kworker;
|
||||
struct ice_perout_channel perout_channels[GLTSYN_TGT_H_IDX_MAX];
|
||||
struct ice_extts_channel extts_channels[GLTSYN_TGT_H_IDX_MAX];
|
||||
u8 ext_ts_irq;
|
||||
struct ptp_pin_desc pin_desc[ICE_N_PINS_MAX];
|
||||
const struct ice_ptp_pin_desc *ice_pin_desc;
|
||||
struct ptp_perout_request perout_rqs[GLTSYN_TGT_H_IDX_MAX];
|
||||
struct ptp_extts_request extts_rqs[GLTSYN_EVNT_H_IDX_MAX];
|
||||
struct ptp_clock_info info;
|
||||
struct ptp_clock *clock;
|
||||
struct hwtstamp_config tstamp_config;
|
||||
@@ -289,27 +289,6 @@ struct ice_ptp {
|
||||
#define FIFO_EMPTY BIT(2)
|
||||
#define FIFO_OK 0xFF
|
||||
#define ICE_PTP_FIFO_NUM_CHECKS 5
|
||||
/* Per-channel register definitions */
|
||||
#define GLTSYN_AUX_OUT(_chan, _idx) (GLTSYN_AUX_OUT_0(_idx) + ((_chan) * 8))
|
||||
#define GLTSYN_AUX_IN(_chan, _idx) (GLTSYN_AUX_IN_0(_idx) + ((_chan) * 8))
|
||||
#define GLTSYN_CLKO(_chan, _idx) (GLTSYN_CLKO_0(_idx) + ((_chan) * 8))
|
||||
#define GLTSYN_TGT_L(_chan, _idx) (GLTSYN_TGT_L_0(_idx) + ((_chan) * 16))
|
||||
#define GLTSYN_TGT_H(_chan, _idx) (GLTSYN_TGT_H_0(_idx) + ((_chan) * 16))
|
||||
#define GLTSYN_EVNT_L(_chan, _idx) (GLTSYN_EVNT_L_0(_idx) + ((_chan) * 16))
|
||||
#define GLTSYN_EVNT_H(_chan, _idx) (GLTSYN_EVNT_H_0(_idx) + ((_chan) * 16))
|
||||
#define GLTSYN_EVNT_H_IDX_MAX 3
|
||||
|
||||
/* Pin definitions for PTP PPS out */
|
||||
#define PPS_CLK_GEN_CHAN 3
|
||||
#define PPS_CLK_SRC_CHAN 2
|
||||
#define PPS_PIN_INDEX 5
|
||||
#define TIME_SYNC_PIN_INDEX 4
|
||||
#define N_EXT_TS_E810 3
|
||||
#define N_PER_OUT_E810 4
|
||||
#define N_PER_OUT_E810T 3
|
||||
#define N_PER_OUT_NO_SMA_E810T 2
|
||||
#define N_EXT_TS_NO_SMA_E810T 2
|
||||
#define ETH_GLTSYN_ENA(_i) (0x03000348 + ((_i) * 4))
|
||||
|
||||
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
|
||||
int ice_ptp_clock_index(struct ice_pf *pf);
|
||||
|
||||
@@ -334,7 +334,7 @@ struct ice_eth56g_mac_reg_cfg eth56g_mac_cfg[NUM_ICE_ETH56G_LNK_SPD] = {
|
||||
* reference. See the struct ice_time_ref_info_e82x for information about the
|
||||
* meaning of each constant.
|
||||
*/
|
||||
const struct ice_time_ref_info_e82x e822_time_ref[NUM_ICE_TIME_REF_FREQ] = {
|
||||
const struct ice_time_ref_info_e82x e82x_time_ref[NUM_ICE_TIME_REF_FREQ] = {
|
||||
/* ICE_TIME_REF_FREQ_25_000 -> 25 MHz */
|
||||
{
|
||||
/* pll_freq */
|
||||
|
||||
@@ -661,6 +661,29 @@ static int ice_cfg_cgu_pll_e825c(struct ice_hw *hw,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define ICE_ONE_PPS_OUT_AMP_MAX 3
|
||||
|
||||
/**
|
||||
* ice_cgu_cfg_pps_out - Configure 1PPS output from CGU
|
||||
* @hw: pointer to the HW struct
|
||||
* @enable: true to enable 1PPS output, false to disable it
|
||||
*
|
||||
* Return: 0 on success, other negative error code when CGU read/write failed
|
||||
*/
|
||||
int ice_cgu_cfg_pps_out(struct ice_hw *hw, bool enable)
|
||||
{
|
||||
union nac_cgu_dword9 dw9;
|
||||
int err;
|
||||
|
||||
err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD9, &dw9.val);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
dw9.one_pps_out_en = enable;
|
||||
dw9.one_pps_out_amp = enable * ICE_ONE_PPS_OUT_AMP_MAX;
|
||||
return ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD9, dw9.val);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_cfg_cgu_pll_dis_sticky_bits_e82x - disable TS PLL sticky bits
|
||||
* @hw: pointer to the HW struct
|
||||
@@ -806,7 +829,7 @@ static u32 ice_ptp_tmr_cmd_to_port_reg(struct ice_hw *hw,
|
||||
/* Certain hardware families share the same register values for the
|
||||
* port register and source timer register.
|
||||
*/
|
||||
switch (hw->ptp.phy_model) {
|
||||
switch (ice_get_phy_model(hw)) {
|
||||
case ICE_PHY_E810:
|
||||
return ice_ptp_tmr_cmd_to_src_reg(hw, cmd) & TS_CMD_MASK_E810;
|
||||
default:
|
||||
@@ -5150,9 +5173,9 @@ ice_get_phy_tx_tstamp_ready_e810(struct ice_hw *hw, u8 port, u64 *tstamp_ready)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* E810T SMA functions
|
||||
/* E810 SMA functions
|
||||
*
|
||||
* The following functions operate specifically on E810T hardware and are used
|
||||
* The following functions operate specifically on E810 hardware and are used
|
||||
* to access the extended GPIOs available.
|
||||
*/
|
||||
|
||||
@@ -5219,14 +5242,14 @@ ice_get_pca9575_handle(struct ice_hw *hw, u16 *pca9575_handle)
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_read_sma_ctrl_e810t
|
||||
* ice_read_sma_ctrl
|
||||
* @hw: pointer to the hw struct
|
||||
* @data: pointer to data to be read from the GPIO controller
|
||||
*
|
||||
* Read the SMA controller state. It is connected to pins 3-7 of Port 1 of the
|
||||
* PCA9575 expander, so only bits 3-7 in data are valid.
|
||||
*/
|
||||
int ice_read_sma_ctrl_e810t(struct ice_hw *hw, u8 *data)
|
||||
int ice_read_sma_ctrl(struct ice_hw *hw, u8 *data)
|
||||
{
|
||||
int status;
|
||||
u16 handle;
|
||||
@@ -5238,7 +5261,7 @@ int ice_read_sma_ctrl_e810t(struct ice_hw *hw, u8 *data)
|
||||
|
||||
*data = 0;
|
||||
|
||||
for (i = ICE_SMA_MIN_BIT_E810T; i <= ICE_SMA_MAX_BIT_E810T; i++) {
|
||||
for (i = ICE_SMA_MIN_BIT; i <= ICE_SMA_MAX_BIT; i++) {
|
||||
bool pin;
|
||||
|
||||
status = ice_aq_get_gpio(hw, handle, i + ICE_PCA9575_P1_OFFSET,
|
||||
@@ -5252,14 +5275,14 @@ int ice_read_sma_ctrl_e810t(struct ice_hw *hw, u8 *data)
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_write_sma_ctrl_e810t
|
||||
* ice_write_sma_ctrl
|
||||
* @hw: pointer to the hw struct
|
||||
* @data: data to be written to the GPIO controller
|
||||
*
|
||||
* Write the data to the SMA controller. It is connected to pins 3-7 of Port 1
|
||||
* of the PCA9575 expander, so only bits 3-7 in data are valid.
|
||||
*/
|
||||
int ice_write_sma_ctrl_e810t(struct ice_hw *hw, u8 data)
|
||||
int ice_write_sma_ctrl(struct ice_hw *hw, u8 data)
|
||||
{
|
||||
int status;
|
||||
u16 handle;
|
||||
@@ -5269,7 +5292,7 @@ int ice_write_sma_ctrl_e810t(struct ice_hw *hw, u8 data)
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
for (i = ICE_SMA_MIN_BIT_E810T; i <= ICE_SMA_MAX_BIT_E810T; i++) {
|
||||
for (i = ICE_SMA_MIN_BIT; i <= ICE_SMA_MAX_BIT; i++) {
|
||||
bool pin;
|
||||
|
||||
pin = !(data & (1 << i));
|
||||
@@ -5283,14 +5306,14 @@ int ice_write_sma_ctrl_e810t(struct ice_hw *hw, u8 data)
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_read_pca9575_reg_e810t
|
||||
* ice_read_pca9575_reg
|
||||
* @hw: pointer to the hw struct
|
||||
* @offset: GPIO controller register offset
|
||||
* @data: pointer to data to be read from the GPIO controller
|
||||
*
|
||||
* Read the register from the GPIO controller
|
||||
*/
|
||||
int ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data)
|
||||
int ice_read_pca9575_reg(struct ice_hw *hw, u8 offset, u8 *data)
|
||||
{
|
||||
struct ice_aqc_link_topo_addr link_topo;
|
||||
__le16 addr;
|
||||
@@ -5313,6 +5336,66 @@ int ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data)
|
||||
return ice_aq_read_i2c(hw, link_topo, 0, addr, 1, data, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_ptp_read_sdp_ac - read SDP available connections section from NVM
|
||||
* @hw: pointer to the HW struct
|
||||
* @entries: returns the SDP available connections section from NVM
|
||||
* @num_entries: returns the number of valid entries
|
||||
*
|
||||
* Return: 0 on success, negative error code if NVM read failed or section does
|
||||
* not exist or is corrupted
|
||||
*/
|
||||
int ice_ptp_read_sdp_ac(struct ice_hw *hw, __le16 *entries, uint *num_entries)
|
||||
{
|
||||
__le16 data;
|
||||
u32 offset;
|
||||
int err;
|
||||
|
||||
err = ice_acquire_nvm(hw, ICE_RES_READ);
|
||||
if (err)
|
||||
goto exit;
|
||||
|
||||
/* Read the offset of SDP_AC */
|
||||
offset = ICE_AQC_NVM_SDP_AC_PTR_OFFSET;
|
||||
err = ice_aq_read_nvm(hw, 0, offset, sizeof(data), &data, false, true,
|
||||
NULL);
|
||||
if (err)
|
||||
goto exit;
|
||||
|
||||
/* Check if section exist */
|
||||
offset = FIELD_GET(ICE_AQC_NVM_SDP_AC_PTR_M, le16_to_cpu(data));
|
||||
if (offset == ICE_AQC_NVM_SDP_AC_PTR_INVAL) {
|
||||
err = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (offset & ICE_AQC_NVM_SDP_AC_PTR_TYPE_M) {
|
||||
offset &= ICE_AQC_NVM_SDP_AC_PTR_M;
|
||||
offset *= ICE_AQC_NVM_SECTOR_UNIT;
|
||||
} else {
|
||||
offset *= sizeof(data);
|
||||
}
|
||||
|
||||
/* Skip reading section length and read the number of valid entries */
|
||||
offset += sizeof(data);
|
||||
err = ice_aq_read_nvm(hw, 0, offset, sizeof(data), &data, false, true,
|
||||
NULL);
|
||||
if (err)
|
||||
goto exit;
|
||||
*num_entries = le16_to_cpu(data);
|
||||
|
||||
/* Read SDP configuration section */
|
||||
offset += sizeof(data);
|
||||
err = ice_aq_read_nvm(hw, 0, offset, *num_entries * sizeof(data),
|
||||
entries, false, true, NULL);
|
||||
|
||||
exit:
|
||||
if (err)
|
||||
dev_dbg(ice_hw_to_dev(hw), "Failed to configure SDP connection section\n");
|
||||
ice_release_nvm(hw);
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_ptp_init_phy_e810 - initialize PHY parameters
|
||||
* @ptp: pointer to the PTP HW struct
|
||||
@@ -5419,7 +5502,7 @@ void ice_ptp_init_hw(struct ice_hw *hw)
|
||||
static int ice_ptp_write_port_cmd(struct ice_hw *hw, u8 port,
|
||||
enum ice_ptp_tmr_cmd cmd)
|
||||
{
|
||||
switch (hw->ptp.phy_model) {
|
||||
switch (ice_get_phy_model(hw)) {
|
||||
case ICE_PHY_ETH56G:
|
||||
return ice_ptp_write_port_cmd_eth56g(hw, port, cmd);
|
||||
case ICE_PHY_E82X:
|
||||
@@ -5484,7 +5567,7 @@ static int ice_ptp_port_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd)
|
||||
u32 port;
|
||||
|
||||
/* PHY models which can program all ports simultaneously */
|
||||
switch (hw->ptp.phy_model) {
|
||||
switch (ice_get_phy_model(hw)) {
|
||||
case ICE_PHY_E810:
|
||||
return ice_ptp_port_cmd_e810(hw, cmd);
|
||||
default:
|
||||
@@ -5563,7 +5646,7 @@ int ice_ptp_init_time(struct ice_hw *hw, u64 time)
|
||||
|
||||
/* PHY timers */
|
||||
/* Fill Rx and Tx ports and send msg to PHY */
|
||||
switch (hw->ptp.phy_model) {
|
||||
switch (ice_get_phy_model(hw)) {
|
||||
case ICE_PHY_ETH56G:
|
||||
err = ice_ptp_prep_phy_time_eth56g(hw,
|
||||
(u32)(time & 0xFFFFFFFF));
|
||||
@@ -5609,7 +5692,7 @@ int ice_ptp_write_incval(struct ice_hw *hw, u64 incval)
|
||||
wr32(hw, GLTSYN_SHADJ_L(tmr_idx), lower_32_bits(incval));
|
||||
wr32(hw, GLTSYN_SHADJ_H(tmr_idx), upper_32_bits(incval));
|
||||
|
||||
switch (hw->ptp.phy_model) {
|
||||
switch (ice_get_phy_model(hw)) {
|
||||
case ICE_PHY_ETH56G:
|
||||
err = ice_ptp_prep_phy_incval_eth56g(hw, incval);
|
||||
break;
|
||||
@@ -5678,7 +5761,7 @@ int ice_ptp_adj_clock(struct ice_hw *hw, s32 adj)
|
||||
wr32(hw, GLTSYN_SHADJ_L(tmr_idx), 0);
|
||||
wr32(hw, GLTSYN_SHADJ_H(tmr_idx), adj);
|
||||
|
||||
switch (hw->ptp.phy_model) {
|
||||
switch (ice_get_phy_model(hw)) {
|
||||
case ICE_PHY_ETH56G:
|
||||
err = ice_ptp_prep_phy_adj_eth56g(hw, adj);
|
||||
break;
|
||||
@@ -5711,7 +5794,7 @@ int ice_ptp_adj_clock(struct ice_hw *hw, s32 adj)
|
||||
*/
|
||||
int ice_read_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx, u64 *tstamp)
|
||||
{
|
||||
switch (hw->ptp.phy_model) {
|
||||
switch (ice_get_phy_model(hw)) {
|
||||
case ICE_PHY_ETH56G:
|
||||
return ice_read_ptp_tstamp_eth56g(hw, block, idx, tstamp);
|
||||
case ICE_PHY_E810:
|
||||
@@ -5741,7 +5824,7 @@ int ice_read_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx, u64 *tstamp)
|
||||
*/
|
||||
int ice_clear_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx)
|
||||
{
|
||||
switch (hw->ptp.phy_model) {
|
||||
switch (ice_get_phy_model(hw)) {
|
||||
case ICE_PHY_ETH56G:
|
||||
return ice_clear_ptp_tstamp_eth56g(hw, block, idx);
|
||||
case ICE_PHY_E810:
|
||||
@@ -5804,7 +5887,7 @@ static int ice_get_pf_c827_idx(struct ice_hw *hw, u8 *idx)
|
||||
*/
|
||||
void ice_ptp_reset_ts_memory(struct ice_hw *hw)
|
||||
{
|
||||
switch (hw->ptp.phy_model) {
|
||||
switch (ice_get_phy_model(hw)) {
|
||||
case ICE_PHY_ETH56G:
|
||||
ice_ptp_reset_ts_memory_eth56g(hw);
|
||||
break;
|
||||
@@ -5833,7 +5916,7 @@ int ice_ptp_init_phc(struct ice_hw *hw)
|
||||
/* Clear event err indications for auxiliary pins */
|
||||
(void)rd32(hw, GLTSYN_STAT(src_idx));
|
||||
|
||||
switch (hw->ptp.phy_model) {
|
||||
switch (ice_get_phy_model(hw)) {
|
||||
case ICE_PHY_ETH56G:
|
||||
return ice_ptp_init_phc_eth56g(hw);
|
||||
case ICE_PHY_E810:
|
||||
@@ -5858,7 +5941,7 @@ int ice_ptp_init_phc(struct ice_hw *hw)
|
||||
*/
|
||||
int ice_get_phy_tx_tstamp_ready(struct ice_hw *hw, u8 block, u64 *tstamp_ready)
|
||||
{
|
||||
switch (hw->ptp.phy_model) {
|
||||
switch (ice_get_phy_model(hw)) {
|
||||
case ICE_PHY_ETH56G:
|
||||
return ice_get_phy_tx_tstamp_ready_eth56g(hw, block,
|
||||
tstamp_ready);
|
||||
|
||||
@@ -316,7 +316,7 @@ ice_cgu_pll_params_e825c e825c_cgu_params[NUM_ICE_TIME_REF_FREQ];
|
||||
extern const struct ice_phy_reg_info_eth56g eth56g_phy_res[NUM_ETH56G_PHY_RES];
|
||||
|
||||
/* Table of constants related to possible TIME_REF sources */
|
||||
extern const struct ice_time_ref_info_e82x e822_time_ref[NUM_ICE_TIME_REF_FREQ];
|
||||
extern const struct ice_time_ref_info_e82x e82x_time_ref[NUM_ICE_TIME_REF_FREQ];
|
||||
|
||||
/* Table of constants for Vernier calibration on E822 */
|
||||
extern const struct ice_vernier_info_e82x e822_vernier[NUM_ICE_PTP_LNK_SPD];
|
||||
@@ -326,10 +326,12 @@ extern const struct ice_vernier_info_e82x e822_vernier[NUM_ICE_PTP_LNK_SPD];
|
||||
*/
|
||||
#define ICE_E810_PLL_FREQ 812500000
|
||||
#define ICE_PTP_NOMINAL_INCVAL_E810 0x13b13b13bULL
|
||||
#define E810_OUT_PROP_DELAY_NS 1
|
||||
#define ICE_E810_OUT_PROP_DELAY_NS 1
|
||||
#define ICE_E825C_OUT_PROP_DELAY_NS 11
|
||||
|
||||
/* Device agnostic functions */
|
||||
u8 ice_get_ptp_src_clock_index(struct ice_hw *hw);
|
||||
int ice_cgu_cfg_pps_out(struct ice_hw *hw, bool enable);
|
||||
bool ice_ptp_lock(struct ice_hw *hw);
|
||||
void ice_ptp_unlock(struct ice_hw *hw);
|
||||
void ice_ptp_src_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd);
|
||||
@@ -358,7 +360,7 @@ void ice_ptp_reset_ts_memory_quad_e82x(struct ice_hw *hw, u8 quad);
|
||||
*
|
||||
* Returns the current TIME_REF from the capabilities structure.
|
||||
*/
|
||||
static inline enum ice_time_ref_freq ice_e82x_time_ref(struct ice_hw *hw)
|
||||
static inline enum ice_time_ref_freq ice_e82x_time_ref(const struct ice_hw *hw)
|
||||
{
|
||||
return hw->func_caps.ts_func_info.time_ref;
|
||||
}
|
||||
@@ -379,17 +381,17 @@ ice_set_e82x_time_ref(struct ice_hw *hw, enum ice_time_ref_freq time_ref)
|
||||
|
||||
static inline u64 ice_e82x_pll_freq(enum ice_time_ref_freq time_ref)
|
||||
{
|
||||
return e822_time_ref[time_ref].pll_freq;
|
||||
return e82x_time_ref[time_ref].pll_freq;
|
||||
}
|
||||
|
||||
static inline u64 ice_e82x_nominal_incval(enum ice_time_ref_freq time_ref)
|
||||
{
|
||||
return e822_time_ref[time_ref].nominal_incval;
|
||||
return e82x_time_ref[time_ref].nominal_incval;
|
||||
}
|
||||
|
||||
static inline u64 ice_e82x_pps_delay(enum ice_time_ref_freq time_ref)
|
||||
{
|
||||
return e822_time_ref[time_ref].pps_delay;
|
||||
return e82x_time_ref[time_ref].pps_delay;
|
||||
}
|
||||
|
||||
/* E822 Vernier calibration functions */
|
||||
@@ -400,10 +402,11 @@ int ice_phy_cfg_rx_offset_e82x(struct ice_hw *hw, u8 port);
|
||||
int ice_phy_cfg_intr_e82x(struct ice_hw *hw, u8 quad, bool ena, u8 threshold);
|
||||
|
||||
/* E810 family functions */
|
||||
int ice_read_sma_ctrl_e810t(struct ice_hw *hw, u8 *data);
|
||||
int ice_write_sma_ctrl_e810t(struct ice_hw *hw, u8 data);
|
||||
int ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data);
|
||||
int ice_read_sma_ctrl(struct ice_hw *hw, u8 *data);
|
||||
int ice_write_sma_ctrl(struct ice_hw *hw, u8 data);
|
||||
int ice_read_pca9575_reg(struct ice_hw *hw, u8 offset, u8 *data);
|
||||
bool ice_is_pca9575_present(struct ice_hw *hw);
|
||||
int ice_ptp_read_sdp_ac(struct ice_hw *hw, __le16 *entries, uint *num_entries);
|
||||
enum dpll_pin_type ice_cgu_get_pin_type(struct ice_hw *hw, u8 pin, bool input);
|
||||
struct dpll_pin_frequency *
|
||||
ice_cgu_get_pin_freq_supp(struct ice_hw *hw, u8 pin, bool input, u8 *num);
|
||||
@@ -431,6 +434,20 @@ int ice_phy_cfg_ptp_1step_eth56g(struct ice_hw *hw, u8 port);
|
||||
#define ICE_ETH56G_NOMINAL_THRESH4 0x7777
|
||||
#define ICE_ETH56G_NOMINAL_TX_THRESH 0x6
|
||||
|
||||
static inline u64 ice_prop_delay(const struct ice_hw *hw)
|
||||
{
|
||||
switch (hw->ptp.phy_model) {
|
||||
case ICE_PHY_ETH56G:
|
||||
return ICE_E825C_OUT_PROP_DELAY_NS;
|
||||
case ICE_PHY_E810:
|
||||
return ICE_E810_OUT_PROP_DELAY_NS;
|
||||
case ICE_PHY_E82X:
|
||||
return ice_e82x_pps_delay(ice_e82x_time_ref(hw));
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_get_base_incval - Get base clock increment value
|
||||
* @hw: pointer to the HW struct
|
||||
@@ -451,6 +468,11 @@ static inline u64 ice_get_base_incval(struct ice_hw *hw)
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool ice_is_dual(struct ice_hw *hw)
|
||||
{
|
||||
return !!(hw->dev_caps.nac_topo.mode & ICE_NAC_TOPO_DUAL_M);
|
||||
}
|
||||
|
||||
#define PFTSYN_SEM_BYTES 4
|
||||
|
||||
#define ICE_PTP_CLOCK_INDEX_0 0x00
|
||||
@@ -688,30 +710,27 @@ static inline u64 ice_get_base_incval(struct ice_hw *hw)
|
||||
#define LOW_TX_MEMORY_BANK_START 0x03090000
|
||||
#define HIGH_TX_MEMORY_BANK_START 0x03090004
|
||||
|
||||
/* E810T SMA controller pin control */
|
||||
#define ICE_SMA1_DIR_EN_E810T BIT(4)
|
||||
#define ICE_SMA1_TX_EN_E810T BIT(5)
|
||||
#define ICE_SMA2_UFL2_RX_DIS_E810T BIT(3)
|
||||
#define ICE_SMA2_DIR_EN_E810T BIT(6)
|
||||
#define ICE_SMA2_TX_EN_E810T BIT(7)
|
||||
/* SMA controller pin control */
|
||||
#define ICE_SMA1_DIR_EN BIT(4)
|
||||
#define ICE_SMA1_TX_EN BIT(5)
|
||||
#define ICE_SMA2_UFL2_RX_DIS BIT(3)
|
||||
#define ICE_SMA2_DIR_EN BIT(6)
|
||||
#define ICE_SMA2_TX_EN BIT(7)
|
||||
|
||||
#define ICE_SMA1_MASK_E810T (ICE_SMA1_DIR_EN_E810T | \
|
||||
ICE_SMA1_TX_EN_E810T)
|
||||
#define ICE_SMA2_MASK_E810T (ICE_SMA2_UFL2_RX_DIS_E810T | \
|
||||
ICE_SMA2_DIR_EN_E810T | \
|
||||
ICE_SMA2_TX_EN_E810T)
|
||||
#define ICE_ALL_SMA_MASK_E810T (ICE_SMA1_MASK_E810T | \
|
||||
ICE_SMA2_MASK_E810T)
|
||||
#define ICE_SMA1_MASK (ICE_SMA1_DIR_EN | ICE_SMA1_TX_EN)
|
||||
#define ICE_SMA2_MASK (ICE_SMA2_UFL2_RX_DIS | ICE_SMA2_DIR_EN | \
|
||||
ICE_SMA2_TX_EN)
|
||||
#define ICE_ALL_SMA_MASK (ICE_SMA1_MASK | ICE_SMA2_MASK)
|
||||
|
||||
#define ICE_SMA_MIN_BIT_E810T 3
|
||||
#define ICE_SMA_MAX_BIT_E810T 7
|
||||
#define ICE_SMA_MIN_BIT 3
|
||||
#define ICE_SMA_MAX_BIT 7
|
||||
#define ICE_PCA9575_P1_OFFSET 8
|
||||
|
||||
/* E810T PCA9575 IO controller registers */
|
||||
/* PCA9575 IO controller registers */
|
||||
#define ICE_PCA9575_P0_IN 0x0
|
||||
|
||||
/* E810T PCA9575 IO controller pin control */
|
||||
#define ICE_E810T_P0_GNSS_PRSNT_N BIT(4)
|
||||
/* PCA9575 IO controller pin control */
|
||||
#define ICE_P0_GNSS_PRSNT_N BIT(4)
|
||||
|
||||
/* ETH56G PHY register addresses */
|
||||
/* Timestamp PHY incval registers */
|
||||
|
||||
Reference in New Issue
Block a user