ice: Add get C827 PHY index function
Subsystems (2)
PATCH 1/2 ice: Add get C827 PHY index function
From: Karol Kolacinski <[email protected]>
Add a function to find the C827 PHY node handle and return C827 PHY index for the E810 products.
In order to bring this function to full functionality, some helpers for this were written by Michal Michalik.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 62 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_common.h | 5 ++ drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 3 + 4 files changed, 71 insertions(+)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1 -0
@@ -1404,6 +1404,7 @@ 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 0x21 +#define ICE_AQC_GET_LINK_TOPO_NODE_NR_C827 0x31u8 rsvd[9 ]; };
drivers/net/ethernet/intel/ice/ice_common.c +62 -0
74 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_common.h +5 -0
@@ -16,6 +16,7 @@#define ICE_SQ_SEND_DELAY_TIME_MS 10#define ICE_SQ_SEND_MAX_EXECUTE 3 +bool ice_is_pf_c827 (struct ice_hw *hw);int ice_init_hw (struct ice_hw *hw);void ice_deinit_hw (struct ice_hw *hw);int ice_check_reset (struct ice_hw *hw);
@@ -94,6 +95,10 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,struct ice_aqc_get_phy_caps_data *caps, struct ice_sq_cd *cd);int +ice_aq_get_netlist_node (struct ice_hw *hw,struct ice_aqc_get_link_topo *cmd, +u8 *node_part_number,u16 *node_handle); +bool ice_is_pf_c827 (struct ice_hw *hw); +int ice_aq_list_caps (struct ice_hw *hw,void *buf,u16 buf_size,u32 *cap_count,enum ice_adminq_opc opc,struct ice_sq_cd *cd);int
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +3 -0
@@ -112,6 +112,9 @@ struct ice_cgu_pll_params_e822 {extern const struct ice_cgu_pll_params_e822 e822_cgu_params[NUM_ICE_TIME_REF_FREQ ]; +#define E810C_QSFP_C827_0_HANDLE 2 +#define E810C_QSFP_C827_1_HANDLE 3 +/* Table of constants related to possible TIME_REF sources */ extern const struct ice_time_ref_info_e822 e822_time_ref[NUM_ICE_TIME_REF_FREQ ];
Signature · 6 lines
2.31.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH 2/2 ice: add FW load wait
As some cards load FW from external sources, we have to wait to be sure that FW is ready before setting link up.
Add check and wait for FW readyness
--- .../net/ethernet/intel/ice/ice_hw_autogen.h | 2 + drivers/net/ethernet/intel/ice/ice_main.c | 41 +++++++++++++++++++ 2 files changed, 43 insertions(+)
drivers/net/ethernet/intel/ice/ice_hw_autogen.h +2 -0
@@ -335,6 +335,8 @@#define VP_MDET_TX_TCLAN_VALID_M BIT(0)#define VP_MDET_TX_TDPU (_VF) (0x00040000 + ((_VF) * 4))#define VP_MDET_TX_TDPU_VALID_M BIT(0) +#define GL_MNG_FWSM 0x000B6134 +#define GL_MNG_FWSM_FW_LOADING_M BIT(30)#define GLNVM_FLA 0x000B6108#define GLNVM_FLA_LOCKED_M BIT(6)#define GLNVM_GENS 0x000B6100
drivers/net/ethernet/intel/ice/ice_main.c +41 -0
53 lines not on this page · raw message
Signature · 6 lines
2.31.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH iwl-next v1 2/2] ice: add FW load wait
Quoted 4 lines · Jan Sokolowski
As some cards load FW from external sources, we have to wait to be sure that FW is ready before setting link up.
Add check and wait for FW readyness
s/readyness/readiness/
Quoted 26 lines
Signed-off-by Jan Sokolowski <[email protected]>--- .../net/ethernet/intel/ice/ice_hw_autogen.h | 2 + drivers/net/ethernet/intel/ice/ice_main.c | 41 +++++++++++++++++++ 2 files changed, 43 insertions(+)drivers/net/ethernet/intel/ice/ice_hw_autogen.h +2
-0@@ -335,6 +335,8 @@#define VP_MDET_TX_TCLAN_VALID_M BIT(0)#define VP_MDET_TX_TDPU (_VF) (0x00040000 + ((_VF) * 4))#define VP_MDET_TX_TDPU_VALID_M BIT(0) +#define GL_MNG_FWSM 0x000B6134 +#define GL_MNG_FWSM_FW_LOADING_M BIT(30)#define GLNVM_FLA 0x000B6108#define GLNVM_FLA_LOCKED_M BIT(6)#define GLNVM_GENS 0x000B6100drivers/net/ethernet/intel/ice/ice_main.c +0
-0@@ -4561,6 +4561,35 @@ static void ice_deinit_eth(struct ice_pf *pf)ice_decfg_netdev (vsi);
drivers/net/ethernet/intel/ice/ice_main.c static void ice_deinit_eth(struct ice_pf *pf) · line 4571
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +8
-0} +/** +* ice_wait_for_fw - wait for full FW readiness +* @hw: pointer to the hardware structure +* @timeout: milliseconds that can elapse before timing out +*/ +static int ice_wait_for_fw (struct ice_hw *hw,u32 timeout) +{ +int fw_loading_register;
perhaps drop '_register' part of the name
Quoted 33 lines
drivers/net/ethernet/intel/ice/ice_main.c +26
-0+u32 elapsed =0 ; + +if (timeout ==0 ) +return 0 ; + +while (elapsed < timeout) { + fw_loading_register = (rd32 (hw,GL_MNG_FWSM ) & +GL_MNG_FWSM_FW_LOADING_M ); + +/* firmware was not yet loaded, we have to wait more */ +if (fw_loading_register) { + elapsed +=100 ; +msleep (100 ); +continue ; + } +return 0 ; + } + +return -EIO ; +} +static int ice_init_dev (struct ice_pf *pf) {struct device *dev =ice_pf_to_dev (pf);@@ -4573,6 +4602,18 @@ static int ice_init_dev(struct ice_pf *pf)return err; } +/* Some cards require longer initialization times +* due to necessity of loading FW from an external source. +* This can take even half a minute. +*/ +if (ice_is_pf_c827 (hw)) {
drivers/net/ethernet/intel/ice/ice_main.c static int ice_init_dev(struct ice_pf *pf) · line 4619
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +7
-0+ err =ice_wait_for_fw (hw,30000 ); +if (err) { +dev_err (dev,"ice_wait_for_fw timed out" ); +return err; + } + } +ice_init_feature_support (pf);ice_request_fw (pf);
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tony Nguyen
maintainerRe: [Intel-wired-lan] [PATCH iwl-next v1 2/2] ice: add FW load wait
In reply to Jan SokolowskiQuoted 34 lines · Jan Sokolowski
As some cards load FW from external sources, we have to wait to be sure that FW is ready before setting link up.
Add check and wait for FW readyness
Signed-off-by Jan Sokolowski <[email protected]>--- .../net/ethernet/intel/ice/ice_hw_autogen.h | 2 + drivers/net/ethernet/intel/ice/ice_main.c | 41 +++++++++++++++++++ 2 files changed, 43 insertions(+)drivers/net/ethernet/intel/ice/ice_hw_autogen.h +2
-0@@ -335,6 +335,8 @@#define VP_MDET_TX_TCLAN_VALID_M BIT(0)#define VP_MDET_TX_TDPU (_VF) (0x00040000 + ((_VF) * 4))#define VP_MDET_TX_TDPU_VALID_M BIT(0) +#define GL_MNG_FWSM 0x000B6134 +#define GL_MNG_FWSM_FW_LOADING_M BIT(30)#define GLNVM_FLA 0x000B6108#define GLNVM_FLA_LOCKED_M BIT(6)#define GLNVM_GENS 0x000B6100drivers/net/ethernet/intel/ice/ice_main.c +2
-0@@ -4561,6 +4561,35 @@ static void ice_deinit_eth(struct ice_pf *pf)ice_decfg_netdev (vsi); } +/** +* ice_wait_for_fw - wait for full FW readiness
drivers/net/ethernet/intel/ice/ice_main.c static void ice_deinit_eth(struct ice_pf *pf) · line 4575
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +10
-0+* @hw: pointer to the hardware structure +* @timeout: milliseconds that can elapse before timing out +*/ +static int ice_wait_for_fw (struct ice_hw *hw,u32 timeout) +{ +int fw_loading_register; +u32 elapsed =0 ; + +if (timeout ==0 ) +return 0 ;
Should this check the register instead of always returning success?
drivers/net/ethernet/intel/ice/ice_main.c static void ice_deinit_eth(struct ice_pf *pf) · line 4579
Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_main.c +4
-0+ +while (elapsed < timeout) { + fw_loading_register = (rd32 (hw,GL_MNG_FWSM ) & +GL_MNG_FWSM_FW_LOADING_M );
I believe the outer parentheses aren't needed.
drivers/net/ethernet/intel/ice/ice_main.c static void ice_deinit_eth(struct ice_pf *pf) · line 4590
Quoted 11 lines
drivers/net/ethernet/intel/ice/ice_main.c +11
-0+ +/* firmware was not yet loaded, we have to wait more */ +if (fw_loading_register) { + elapsed +=100 ; +msleep (100 ); +continue ; + } +return 0 ; + } + +return -EIO ;
Would -ETIMEDOUT be more appropriate?
Quoted 14 lines
drivers/net/ethernet/intel/ice/ice_main.c +7
-0+} +static int ice_init_dev (struct ice_pf *pf) {struct device *dev =ice_pf_to_dev (pf);@@ -4573,6 +4602,18 @@ static int ice_init_dev(struct ice_pf *pf)return err; } +/* Some cards require longer initialization times +* due to necessity of loading FW from an external source. +* This can take even half a minute. +*/ +if (ice_is_pf_c827 (hw)) {
drivers/net/ethernet/intel/ice/ice_main.c static int ice_init_dev(struct ice_pf *pf) · line 4619
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +7
-0+ err =ice_wait_for_fw (hw,30000 ); +if (err) { +dev_err (dev,"ice_wait_for_fw timed out" ); +return err; + } + } +ice_init_feature_support (pf);ice_request_fw (pf);
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tony Nguyen
maintainerQuoted 12 lines · Jan Sokolowski
From: Karol Kolacinski <[email protected]>
Add a function to find the C827 PHY node handle and return C827 PHY index for the E810 products.
In order to bring this function to full functionality, some helpers for this were written by Michal Michalik.
Co-developed-by Michal Michalik <[email protected]>Signed-off-by Michal Michalik <[email protected]>Signed-off-by Karol Kolacinski <[email protected]>Signed-off-by Jan Sokolowski <[email protected]>
Quoted 6 lines
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 62 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_common.h | 5 ++ drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 3 + 4 files changed, 71 insertions(+)
This has a compile issue:
+../drivers/net/ethernet/intel/ice/ice_common.c:2473:30: warning: incorrect type in assignment (different base types)+../drivers/net/ethernet/intel/ice/ice_common.c:2473:30: expected unsigned short [usertype]+../drivers/net/ethernet/intel/ice/ice_common.c:2473:30: got restricted __le16 [addressable] [assigned] [usertype] handle
Quoted 120 lines
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1
-0@@ -1404,6 +1404,7 @@ 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 0x21 +#define ICE_AQC_GET_LINK_TOPO_NODE_NR_C827 0x31u8 rsvd[9 ]; };drivers/net/ethernet/intel/ice/ice_common.c +62
-0@@ -5,6 +5,7 @@#include "ice_sched.h" #include "ice_adminq_cmd.h" #include "ice_flow.h" +#include "ice_ptp_hw.h" #define ICE_PF_RESET_WAIT_COUNT 300@@ -2449,6 +2450,67 @@ ice_parse_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,ice_recalc_port_limited_caps (hw, &dev_p->common_cap); } +/** +* ice_aq_get_netlist_node +* @hw: pointer to the hw struct +* @cmd: get_link_topo AQ structure +* @node_part_number: output node part number if node found +* @node_handle: output node handle parameter if node found +*/ +int +ice_aq_get_netlist_node (struct ice_hw *hw,struct ice_aqc_get_link_topo *cmd, +u8 *node_part_number,u16 *node_handle) +{ +struct ice_aq_desc desc; + +ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_get_link_topo); + desc.params.get_link_topo = *cmd; + +if (ice_aq_send_cmd (hw, &desc,NULL ,0 ,NULL )) +return -EIO ; + +if (node_handle) + *node_handle = desc.params.get_link_topo.addr.handle; +if (node_part_number) + *node_part_number = desc.params.get_link_topo.node_part_num; + +return 0 ; +} + +/** +* ice_is_pf_c827 - check if pf contains c827 phy +* @hw: pointer to the hw struct +*/ +bool ice_is_pf_c827 (struct ice_hw *hw) +{ +struct ice_aqc_get_link_topo cmd = {}; +u8 node_part_number; +u16 node_handle; +int status; + +if (hw->mac_type !=ICE_MAC_E810 ) +return false; + +if (hw->device_id !=ICE_DEV_ID_E810C_QSFP ) +return true; + + cmd.addr.topo_params.node_type_ctx = +FIELD_PREP (ICE_AQC_LINK_TOPO_NODE_TYPE_M ,ICE_AQC_LINK_TOPO_NODE_TYPE_PHY ) | +FIELD_PREP (ICE_AQC_LINK_TOPO_NODE_CTX_M ,ICE_AQC_LINK_TOPO_NODE_CTX_PORT ); + cmd.addr.topo_params.index =0 ; + + status =ice_aq_get_netlist_node (hw, &cmd, &node_part_number, + &node_handle); + +if (status || node_part_number !=ICE_AQC_GET_LINK_TOPO_NODE_NR_C827 ) +return false; + +if (node_handle ==E810C_QSFP_C827_0_HANDLE || node_handle ==E810C_QSFP_C827_1_HANDLE ) +return true; + +return false; +} +/** * ice_aq_list_caps - query function/device capabilities * @hw: pointer to the HW struct drivers/net/ethernet/intel/ice/ice_common.h +5
-0@@ -16,6 +16,7 @@#define ICE_SQ_SEND_DELAY_TIME_MS 10#define ICE_SQ_SEND_MAX_EXECUTE 3 +bool ice_is_pf_c827 (struct ice_hw *hw);int ice_init_hw (struct ice_hw *hw);void ice_deinit_hw (struct ice_hw *hw);int ice_check_reset (struct ice_hw *hw);@@ -94,6 +95,10 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,struct ice_aqc_get_phy_caps_data *caps, struct ice_sq_cd *cd);int +ice_aq_get_netlist_node (struct ice_hw *hw,struct ice_aqc_get_link_topo *cmd, +u8 *node_part_number,u16 *node_handle); +bool ice_is_pf_c827 (struct ice_hw *hw); +int ice_aq_list_caps (struct ice_hw *hw,void *buf,u16 buf_size,u32 *cap_count,enum ice_adminq_opc opc,struct ice_sq_cd *cd);int drivers/net/ethernet/intel/ice/ice_ptp_hw.h +0
-0
drivers/net/ethernet/intel/ice/ice_ptp_hw.h struct ice_cgu_pll_params_e822 { · line 120
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +3
-0@@ -112,6 +112,9 @@ struct ice_cgu_pll_params_e822 {extern const struct ice_cgu_pll_params_e822 e822_cgu_params[NUM_ICE_TIME_REF_FREQ ]; +#define E810C_QSFP_C827_0_HANDLE 2 +#define E810C_QSFP_C827_1_HANDLE 3 +/* Table of constants related to possible TIME_REF sources */ extern const struct ice_time_ref_info_e822 e822_time_ref[NUM_ICE_TIME_REF_FREQ ];
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan