Add support for E810-T PTP pins
Subsystems (2)
v2 cover Add support for E810-T PTP pins
Extend the driver implementation to support PTP pins on E810-T and derivative devices.
E810-T adapters are equipped with:
- 2 external bidirectional SMA connectors
- 1 internal TX U.FL shared with SMA1
- 1 internal RX U.FL shared with SMA2
The SMA and U.FL configuration is controlled by the external multiplexer.
E810-T Derivatives are equipped with:
- 2 1PPS outputs on SDP20 and SDP22
- 2 1PPS inputs on SDP21 and SDP23
v2:
* Fix code style errors
* Change pca9575_handle type returned by ice_get_pca9575_handle to u16
Maciej Machnikowski (4):
ice: Refactor ice_aqc_link_topo_addr
ice: Implement functions for reading and setting GPIO pins
ice: Add support for SMA control multiplexer
ice: Implement support for SMA and U.FL on E810-T
drivers/net/ethernet/intel/ice/ice.h | 1 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 20 +- drivers/net/ethernet/intel/ice/ice_common.c | 87 +++- drivers/net/ethernet/intel/ice/ice_common.h | 7 + drivers/net/ethernet/intel/ice/ice_devids.h | 2 + drivers/net/ethernet/intel/ice/ice_lib.c | 15 + drivers/net/ethernet/intel/ice/ice_lib.h | 1 + drivers/net/ethernet/intel/ice/ice_ptp.c | 374 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_ptp.h | 21 +- drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 156 ++++++++ drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 22 ++ drivers/net/ethernet/intel/ice/ice_type.h | 1 + 12 files changed, 693 insertions(+), 14 deletions(-)
Signature · 1 line
2.26.3
PATCH v2 1/4 ice: Refactor ice_aqc_link_topo_addr
Separate link topo parameters and move to the ice_aqc_link_topo_params in the ice_aqc_link_topo_addr.
--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 6 +++++- drivers/net/ethernet/intel/ice/ice_common.c | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +5 -1
@@ -1283,7 +1283,7 @@ struct ice_aqc_set_mac_lb {u8 reserved[15 ]; }; -struct ice_aqc_link_topo_addr { +struct ice_aqc_link_topo_params {u8 lport_num;u8 lport_num_valid;#define ICE_AQC_LINK_TOPO_PORT_NUM_VALID BIT(0)
@@ -1309,6 +1309,10 @@ struct ice_aqc_link_topo_addr {#define ICE_AQC_LINK_TOPO_NODE_CTX_PROVIDED 4#define ICE_AQC_LINK_TOPO_NODE_CTX_OVERRIDE 5u8 index; +}; + +struct ice_aqc_link_topo_addr { +struct ice_aqc_link_topo_params topo_params;__le16 handle;#define ICE_AQC_LINK_TOPO_HANDLE_S 0#define ICE_AQC_LINK_TOPO_HANDLE_M (0x3FF << ICE_AQC_LINK_TOPO_HANDLE_S)
drivers/net/ethernet/intel/ice/ice_common.c +5 -3
@@ -240,11 +240,13 @@ ice_aq_get_link_topo_handle(struct ice_port_info *pi, u8 node_type,ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_get_link_topo); - cmd->addr.node_type_ctx = (ICE_AQC_LINK_TOPO_NODE_CTX_PORT << -ICE_AQC_LINK_TOPO_NODE_CTX_S ); + cmd->addr.topo_params.node_type_ctx = + (ICE_AQC_LINK_TOPO_NODE_CTX_PORT << +ICE_AQC_LINK_TOPO_NODE_CTX_S );/* set node type */ - cmd->addr.node_type_ctx |= (ICE_AQC_LINK_TOPO_NODE_TYPE_M & node_type); + cmd->addr.topo_params.node_type_ctx |= + (ICE_AQC_LINK_TOPO_NODE_TYPE_M & node_type);return ice_aq_send_cmd (pi->hw, &desc,NULL ,0 , cd); }
Signature · 1 line
2.26.3
Mekala
PATCH v2 1/4 ice: Refactor ice_aqc_link_topo_addr
Quoted 7 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Maciej Machnikowski
Sent: Tuesday, August 17, 2021 4:09 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Machnikowski, Maciej <[email protected]>
Subject: [Intel-wired-lan] [PATCH v2 intel-next 1/4] ice: Refactorice_aqc_link_topo_addr
Quoted 8 lines
Separate link topo parameters and move to the
ice_aqc_link_topo_paramsin theice_aqc_link_topo_addr.Signed-off-by Maciej Machnikowski <[email protected]>---
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h| 6 +++++-drivers/net/ethernet/intel/ice/ice_common.c| 8 +++++---2 files changed, 10 insertions(+), 4 deletions(-)
PATCH v2 2/4 ice: Implement functions for reading and setting GPIO pins
In reply to Maciej MachnikowskiImplement ice_aq_get_gpio and ice_aq_set_gpio for reading and changing the state of GPIO pins described in the topology.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 13 +++++ drivers/net/ethernet/intel/ice/ice_common.c | 58 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_common.h | 6 ++ 3 files changed, 77 insertions(+)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +13 -0
@@ -1348,6 +1348,16 @@ struct ice_aqc_set_port_id_led {u8 rsvd[13 ]; }; +/* Set/Get GPIO (direct, 0x06EC/0x06ED) */ +struct ice_aqc_gpio { +__le16 gpio_ctrl_handle; +#define ICE_AQC_GPIO_HANDLE_S 0 +#define ICE_AQC_GPIO_HANDLE_M (0x3FF << ICE_AQC_GPIO_HANDLE_S) +u8 gpio_num; +u8 gpio_val; +u8 rsvd[12 ]; +}; +/* Read/Write SFF EEPROM command (indirect 0x06EE) */ struct ice_aqc_sff_eeprom {u8 lport_num;
@@ -1989,6 +1999,7 @@ struct ice_aq_desc {struct ice_aqc_get_phy_caps get_phy;struct ice_aqc_set_phy_cfg set_phy;struct ice_aqc_restart_an restart_an; +struct ice_aqc_gpio read_write_gpio;struct ice_aqc_sff_eeprom read_write_sff_param;struct ice_aqc_set_port_id_led set_port_id_led;struct ice_aqc_get_sw_cfg get_sw_conf;
@@ -2144,6 +2155,8 @@ enum ice_adminq_opc { ice_aqc_opc_set_mac_lb =0x0620 , ice_aqc_opc_get_link_topo =0x06E0 , ice_aqc_opc_set_port_id_led =0x06E9 , + ice_aqc_opc_set_gpio =0x06EC , + ice_aqc_opc_get_gpio =0x06ED , ice_aqc_opc_sff_eeprom = 0x06EE,/* NVM commands */
drivers/net/ethernet/intel/ice/ice_common.c +58 -0
64 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_common.h +6 -0
@@ -193,6 +193,12 @@ int ice_aq_get_driver_param(struct ice_hw *hw, enum ice_aqc_driver_params idx, u32 *value, struct ice_sq_cd *cd);enum ice_status +ice_aq_set_gpio (struct ice_hw *hw,u16 gpio_ctrl_handle,u8 pin_idx,bool value, +struct ice_sq_cd *cd); +enum ice_status +ice_aq_get_gpio (struct ice_hw *hw,u16 gpio_ctrl_handle,u8 pin_idx, +bool *value,struct ice_sq_cd *cd); +enum ice_status ice_aq_set_lldp_mib (struct ice_hw *hw,u8 mib_type,void *buf,u16 buf_size,struct ice_sq_cd *cd);bool ice_fw_supports_lldp_fltr_ctrl (struct ice_hw *hw);
Signature · 1 line
2.26.3
Mekala
PATCH v2 2/4 ice: Implement functions for reading and setting GPIO pins
Quoted 7 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Maciej Machnikowski
Sent: Tuesday, August 17, 2021 4:09 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Machnikowski, Maciej <[email protected]>
Subject: [Intel-wired-lan] [PATCH v2 intel-next 2/4] ice: Implement functions for reading and setting GPIO pins
Quoted 9 lines
Implement
ice_aq_get_gpioandice_aq_set_gpiofor reading and changing the state of GPIO pins described in the topology.Signed-off-by Maciej Machnikowski <[email protected]>--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 13 +++++ drivers/net/ethernet/intel/ice/ice_common.c | 58 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_common.h | 6 ++ 3 files changed, 77 insertions(+)
PATCH v2 3/4 ice: Add support for SMA control multiplexer
In reply to Maciej MachnikowskiE810-T adapters have two external bidirectional SMA connectors and two internal unidirectional U.FL connectors. Multiplexing between U.FL and SMA and SMA direction is controlled using the PCA9575 expander.
Add support for the PCA9575 detection and control of the respective pins of the SMA/U.FL multiplexer using the GPIO AQ API.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 21 +++ drivers/net/ethernet/intel/ice/ice_common.h | 1 + drivers/net/ethernet/intel/ice/ice_devids.h | 2 + drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 156 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 22 +++ drivers/net/ethernet/intel/ice/ice_type.h | 1 + 7 files changed, 204 insertions(+)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1 -0
@@ -1335,6 +1335,7 @@ struct ice_aqc_link_topo_addr {struct ice_aqc_get_link_topo {struct ice_aqc_link_topo_addr addr;u8 node_part_num; +#define ICE_AQC_GET_LINK_TOPO_NODE_NR_PCA9575 0x21u8 rsvd[9 ]; };
drivers/net/ethernet/intel/ice/ice_common.c +21 -0
@@ -69,6 +69,27 @@ bool ice_is_e810(struct ice_hw *hw)return hw->mac_type ==ICE_MAC_E810 ; } +/** +* ice_is_e810t +* @hw: pointer to the hardware structure +* +* returns true if the device is E810T based, false if not. +*/ +bool ice_is_e810t (struct ice_hw *hw) +{ +switch (hw->device_id) { +case ICE_DEV_ID_E810C_SFP : +if (hw->subsystem_device_id ==ICE_SUBDEV_ID_E810T || + hw->subsystem_device_id ==ICE_SUBDEV_ID_E810T2 ) +return true; +break ; +default : +break ; + } + +return false; +} +/** * ice_clear_pf_cfg - Clear PF configuration * @hw: pointer to the hardware structure
drivers/net/ethernet/intel/ice/ice_common.h +1 -0
@@ -183,6 +183,7 @@ ice_stat_update40(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,void ice_stat_update32 (struct ice_hw *hw,u32 reg,bool prev_stat_loaded,u64 *prev_stat,u64 *cur_stat); +bool ice_is_e810t (struct ice_hw *hw);enum ice_status ice_sched_query_elem (struct ice_hw *hw,u32 node_teid,struct ice_aqc_txsched_elem_data *buf);
drivers/net/ethernet/intel/ice/ice_devids.h +2 -0
@@ -21,6 +21,8 @@#define ICE_DEV_ID_E810C_QSFP 0x1592/* Intel(R) Ethernet Controller E810-C for SFP */ #define ICE_DEV_ID_E810C_SFP 0x1593 +#define ICE_SUBDEV_ID_E810T 0x000E +#define ICE_SUBDEV_ID_E810T2 0x000F/* Intel(R) Ethernet Controller E810-XXV for SFP */ #define ICE_DEV_ID_E810_XXV_SFP 0x159B/* Intel(R) Ethernet Connection E823-C for backplane */
drivers/net/ethernet/intel/ice/ice_ptp_hw.c +156 -0
159 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +22 -0
@@ -189,6 +189,9 @@ int ice_phy_exit_bypass_e822(struct ice_hw *hw, u8 port);/* E810 family functions */ int ice_ptp_init_phy_e810 (struct ice_hw *hw); +int ice_read_sma_ctrl_e810t (struct ice_hw *hw,u8 *data); +int ice_write_sma_ctrl_e810t (struct ice_hw *hw,u8 data); +bool ice_is_pca9575_present (struct ice_hw *hw);#define PFTSYN_SEM_BYTES 4
@@ -421,4 +424,23 @@ int ice_ptp_init_phy_e810(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) + +#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_SMA_MIN_BIT_E810T 3 +#define ICE_SMA_MAX_BIT_E810T 7 +#define ICE_PCA9575_P1_OFFSET 8 +#endif /* _ICE_PTP_HW_H_ */
drivers/net/ethernet/intel/ice/ice_type.h +1 -0
@@ -938,6 +938,7 @@ struct ice_hw {struct list_head rss_list_head;struct ice_mbx_snapshot mbx_snapshot;DECLARE_BITMAP (hw_ptype,ICE_FLOW_PTYPE_MAX ); +u16 io_expander_handle; };/* Statistics collected by each port, VSI, VEB, and S-channel */
Signature · 1 line
2.26.3
Mekala
PATCH v2 3/4 ice: Add support for SMA control multiplexer
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Maciej Machnikowski
Sent: Tuesday, August 17, 2021 4:09 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Machnikowski, Maciej <[email protected]>
Subject: [Intel-wired-lan] [PATCH v2 intel-next 3/4] ice: Add support for SMA control multiplexerE810-T adapters have two external bidirectional SMA connectors and two internal unidirectional U.FL connectors. Multiplexing between U.FL and SMA and SMA direction is controlled using the PCA9575 expander.
Add support for the PCA9575 detection and control of the respective pins of the SMA/U.FL multiplexer using the GPIO AQ API.
Signed-off-by Maciej Machnikowski <[email protected]>---
.../net/ethernet/intel/ice/ice_adminq_cmd.h| 1 +
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_common.c | 21 +++ drivers/net/ethernet/intel/ice/ice_common.h | 1 + drivers/net/ethernet/intel/ice/ice_devids.h | 2 + drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 156 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 22 +++ drivers/net/ethernet/intel/ice/ice_type.h | 1 + 7 files changed, 204 insertions(+)
PATCH v2 4/4 ice: Implement support for SMA and U.FL on E810-T
In reply to Maciej MachnikowskiExpose SMA and U.FL connectors as ptp_pins on E810-T based adapters and allow controlling them.
E810-T adapters are equipped with:
- 2 external bidirectional SMA connectors
- 1 internal TX U.FL
- 1 internal RX U.FL
U.FL connectors share signal lines with the SMA connectors. The TX U.FL1 share the line with the SMA1 and the RX U.FL2 share line with the SMA2. This dependence is controlled by the ice_verify_pin_e810t.
Additionally add support for the E810-T-based devices which don't use the SMA/U.FL controller. If the IO expander is not detected don't expose pins and use 2 predefined 1PPS input and output pins.
--- drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_lib.c | 15 + drivers/net/ethernet/intel/ice/ice_lib.h | 1 + drivers/net/ethernet/intel/ice/ice_ptp.c | 374 ++++++++++++++++++++++- drivers/net/ethernet/intel/ice/ice_ptp.h | 21 +- 5 files changed, 402 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +1 -0
@@ -160,6 +160,7 @@enum ice_feature {ICE_F_DSCP , +ICE_F_SMA_CTRL ,ICE_F_MAX };
drivers/net/ethernet/intel/ice/ice_lib.c +15 -0
@@ -3890,6 +3890,19 @@ static void ice_set_feature_support(struct ice_pf *pf, enum ice_feature f)set_bit (f, pf->features); } +/** +* ice_clear_feature_support +* @pf: pointer to the struct ice_pf instance +* @f: feature enum to clear +*/ +void ice_clear_feature_support (struct ice_pf *pf,enum ice_feature f) +{ +if (f <0 || f >=ICE_F_MAX ) +return ; + +clear_bit (f, pf->features); +} +/** * ice_init_feature_support * @pf: pointer to the struct ice_pf instance
@@ -3903,6 +3916,8 @@ void ice_init_feature_support(struct ice_pf *pf)case ICE_DEV_ID_E810C_QSFP :case ICE_DEV_ID_E810C_SFP :ice_set_feature_support (pf,ICE_F_DSCP ); +if (ice_is_e810t (&pf->hw)) +ice_set_feature_support (pf,ICE_F_SMA_CTRL );break ;default :break ;
drivers/net/ethernet/intel/ice/ice_lib.h +1 -0
@@ -130,5 +130,6 @@ void ice_vsi_ctx_set_allow_override(struct ice_vsi_ctx *ctx);void ice_vsi_ctx_clear_allow_override (struct ice_vsi_ctx *ctx);bool ice_is_feature_supported (struct ice_pf *pf,enum ice_feature f); +void ice_clear_feature_support (struct ice_pf *pf,enum ice_feature f);void ice_init_feature_support (struct ice_pf *pf);#endif /* !_ICE_LIB_H_ */
drivers/net/ethernet/intel/ice/ice_ptp.c +368 -6
419 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_ptp.h +17 -4
@@ -9,12 +9,21 @@#include "ice_ptp_hw.h" -enum ice_ptp_pin { +enum ice_ptp_pin_e810 {GPIO_20 =0 ,GPIO_21 ,GPIO_22 ,GPIO_23 , -NUM_ICE_PTP_PIN +NUM_PTP_PIN_E810 +}; + +enum ice_ptp_pin_e810t { +GNSS =0 , +SMA1 , +UFL1 , +SMA2 , +UFL2 , +NUM_PTP_PINS_E810T };struct ice_perout_channel {
@@ -173,8 +182,12 @@ struct ice_ptp {#define PPS_CLK_SRC_CHAN 2#define PPS_PIN_INDEX 5#define TIME_SYNC_PIN_INDEX 4 -#define E810_N_EXT_TS 3 -#define E810_N_PER_OUT 4 +#define N_EXT_TS_E810 3 +#define N_PER_OUT_E810 4 +#define N_PER_OUT_E810T 3 +#define N_PER_OUT_E810T_NO_SMA 2 +#define N_EXT_TS_E810_NO_SMA 2 +#define ETH_GLTSYN_ENA (_i) (0x03000348 + ((_i) * 4))#if IS_ENABLED (CONFIG_PTP_1588_CLOCK )
Signature · 1 line
2.26.3
Mekala
PATCH v2 4/4 ice: Implement support for SMA and U.FL on E810-T
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Maciej Machnikowski
Sent: Tuesday, August 17, 2021 4:09 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Machnikowski, Maciej <[email protected]>
Subject: [Intel-wired-lan] [PATCH v2 intel-next 4/4] ice: Implement support for SMA and U.FL on E810-TExpose SMA and U.FL connectors as
ptp_pinson E810-T based adapters and allow controlling them.E810-T adapters are equipped with:
- 2 external bidirectional SMA connectors
- 1 internal TX U.FL
- 1 internal RX U.FLU.FL connectors share signal lines with the SMA connectors. The TX U.FL1 share the line with the SMA1 and the RX U.FL2 share line with the SMA2. This dependence is controlled by the
ice_verify_pin_e810t.Additionally add support for the E810-T-based devices which don't use the SMA/U.FL controller. If the IO expander is not detected don't expose pins and use 2 predefined 1PPS input and output pins.
Quoted 8 lines
Signed-off-by Maciej Machnikowski <[email protected]>---
drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_lib.c | 15 + drivers/net/ethernet/intel/ice/ice_lib.h | 1 + drivers/net/ethernet/intel/ice/ice_ptp.c | 374 ++++++++++++++++++++++- drivers/net/ethernet/intel/ice/ice_ptp.h | 21 +- 5 files changed, 402 insertions(+), 10 deletions(-)