@@ -308,6 +308,42 @@ bool ice_is_e825c(struct ice_hw *hw)
308
308
}
309
309
}
310
310
311
+ /**
312
+ * ice_is_pf_c827 - check if pf contains c827 phy
313
+ * @hw: pointer to the hw struct
314
+ *
315
+ * Return: true if the device has c827 phy.
316
+ */
317
+ static bool ice_is_pf_c827 (struct ice_hw * hw )
318
+ {
319
+ struct ice_aqc_get_link_topo cmd = {};
320
+ u8 node_part_number ;
321
+ u16 node_handle ;
322
+ int status ;
323
+
324
+ if (hw -> mac_type != ICE_MAC_E810 )
325
+ return false;
326
+
327
+ if (hw -> device_id != ICE_DEV_ID_E810C_QSFP )
328
+ return true;
329
+
330
+ cmd .addr .topo_params .node_type_ctx =
331
+ FIELD_PREP (ICE_AQC_LINK_TOPO_NODE_TYPE_M , ICE_AQC_LINK_TOPO_NODE_TYPE_PHY ) |
332
+ FIELD_PREP (ICE_AQC_LINK_TOPO_NODE_CTX_M , ICE_AQC_LINK_TOPO_NODE_CTX_PORT );
333
+ cmd .addr .topo_params .index = 0 ;
334
+
335
+ status = ice_aq_get_netlist_node (hw , & cmd , & node_part_number ,
336
+ & node_handle );
337
+
338
+ if (status || node_part_number != ICE_AQC_GET_LINK_TOPO_NODE_NR_C827 )
339
+ return false;
340
+
341
+ if (node_handle == E810C_QSFP_C827_0_HANDLE || node_handle == E810C_QSFP_C827_1_HANDLE )
342
+ return true;
343
+
344
+ return false;
345
+ }
346
+
311
347
/**
312
348
* ice_clear_pf_cfg - Clear PF configuration
313
349
* @hw: pointer to the hardware structure
@@ -1025,6 +1061,33 @@ static void ice_get_itr_intrl_gran(struct ice_hw *hw)
1025
1061
}
1026
1062
}
1027
1063
1064
+ /**
1065
+ * ice_wait_for_fw - wait for full FW readiness
1066
+ * @hw: pointer to the hardware structure
1067
+ * @timeout: milliseconds that can elapse before timing out
1068
+ *
1069
+ * Return: 0 on success, -ETIMEDOUT on timeout.
1070
+ */
1071
+ static int ice_wait_for_fw (struct ice_hw * hw , u32 timeout )
1072
+ {
1073
+ int fw_loading ;
1074
+ u32 elapsed = 0 ;
1075
+
1076
+ while (elapsed <= timeout ) {
1077
+ fw_loading = rd32 (hw , GL_MNG_FWSM ) & GL_MNG_FWSM_FW_LOADING_M ;
1078
+
1079
+ /* firmware was not yet loaded, we have to wait more */
1080
+ if (fw_loading ) {
1081
+ elapsed += 100 ;
1082
+ msleep (100 );
1083
+ continue ;
1084
+ }
1085
+ return 0 ;
1086
+ }
1087
+
1088
+ return - ETIMEDOUT ;
1089
+ }
1090
+
1028
1091
/**
1029
1092
* ice_init_hw - main hardware initialization routine
1030
1093
* @hw: pointer to the hardware structure
@@ -1174,8 +1237,19 @@ int ice_init_hw(struct ice_hw *hw)
1174
1237
mutex_init (& hw -> tnl_lock );
1175
1238
ice_init_chk_recipe_reuse_support (hw );
1176
1239
1177
- return 0 ;
1240
+ /* Some cards require longer initialization times
1241
+ * due to necessity of loading FW from an external source.
1242
+ * This can take even half a minute.
1243
+ */
1244
+ if (ice_is_pf_c827 (hw )) {
1245
+ status = ice_wait_for_fw (hw , 30000 );
1246
+ if (status ) {
1247
+ dev_err (ice_hw_to_dev (hw ), "ice_wait_for_fw timed out" );
1248
+ goto err_unroll_fltr_mgmt_struct ;
1249
+ }
1250
+ }
1178
1251
1252
+ return 0 ;
1179
1253
err_unroll_fltr_mgmt_struct :
1180
1254
ice_cleanup_fltr_mgmt_struct (hw );
1181
1255
err_unroll_sched :
@@ -2728,40 +2802,6 @@ ice_parse_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
2728
2802
ice_recalc_port_limited_caps (hw , & dev_p -> common_cap );
2729
2803
}
2730
2804
2731
- /**
2732
- * ice_is_pf_c827 - check if pf contains c827 phy
2733
- * @hw: pointer to the hw struct
2734
- */
2735
- bool ice_is_pf_c827 (struct ice_hw * hw )
2736
- {
2737
- struct ice_aqc_get_link_topo cmd = {};
2738
- u8 node_part_number ;
2739
- u16 node_handle ;
2740
- int status ;
2741
-
2742
- if (hw -> mac_type != ICE_MAC_E810 )
2743
- return false;
2744
-
2745
- if (hw -> device_id != ICE_DEV_ID_E810C_QSFP )
2746
- return true;
2747
-
2748
- cmd .addr .topo_params .node_type_ctx =
2749
- FIELD_PREP (ICE_AQC_LINK_TOPO_NODE_TYPE_M , ICE_AQC_LINK_TOPO_NODE_TYPE_PHY ) |
2750
- FIELD_PREP (ICE_AQC_LINK_TOPO_NODE_CTX_M , ICE_AQC_LINK_TOPO_NODE_CTX_PORT );
2751
- cmd .addr .topo_params .index = 0 ;
2752
-
2753
- status = ice_aq_get_netlist_node (hw , & cmd , & node_part_number ,
2754
- & node_handle );
2755
-
2756
- if (status || node_part_number != ICE_AQC_GET_LINK_TOPO_NODE_NR_C827 )
2757
- return false;
2758
-
2759
- if (node_handle == E810C_QSFP_C827_0_HANDLE || node_handle == E810C_QSFP_C827_1_HANDLE )
2760
- return true;
2761
-
2762
- return false;
2763
- }
2764
-
2765
2805
/**
2766
2806
* ice_is_phy_rclk_in_netlist
2767
2807
* @hw: pointer to the hw struct
0 commit comments