Skip to content

Commit 8a3a565

Browse files
kubalewskidavem330
authored andcommitted
ice: add admin commands to access cgu configuration
Add firmware admin command to access clock generation unit configuration, it is required to enable Extended PTP and SyncE features in the driver. Add definitions of possible hardware variations of input and output pins related to clock generation unit and functions to access the data. Signed-off-by: Arkadiusz Kubalewski <[email protected]> Signed-off-by: Vadim Fedorenko <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5f18426 commit 8a3a565

File tree

8 files changed

+1385
-33
lines changed

8 files changed

+1385
-33
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@
198198
enum ice_feature {
199199
ICE_F_DSCP,
200200
ICE_F_PTP_EXTTS,
201+
ICE_F_PHY_RCLK,
201202
ICE_F_SMA_CTRL,
203+
ICE_F_CGU,
202204
ICE_F_GNSS,
203205
ICE_F_ROCE_LAG,
204206
ICE_F_SRIOV_LAG,

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

Lines changed: 244 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,30 @@ struct ice_aqc_set_mac_lb {
13511351
u8 reserved[15];
13521352
};
13531353

1354+
/* Set PHY recovered clock output (direct 0x0630) */
1355+
struct ice_aqc_set_phy_rec_clk_out {
1356+
u8 phy_output;
1357+
u8 port_num;
1358+
#define ICE_AQC_SET_PHY_REC_CLK_OUT_CURR_PORT 0xFF
1359+
u8 flags;
1360+
#define ICE_AQC_SET_PHY_REC_CLK_OUT_OUT_EN BIT(0)
1361+
u8 rsvd;
1362+
__le32 freq;
1363+
u8 rsvd2[6];
1364+
__le16 node_handle;
1365+
};
1366+
1367+
/* Get PHY recovered clock output (direct 0x0631) */
1368+
struct ice_aqc_get_phy_rec_clk_out {
1369+
u8 phy_output;
1370+
u8 port_num;
1371+
#define ICE_AQC_GET_PHY_REC_CLK_OUT_CURR_PORT 0xFF
1372+
u8 flags;
1373+
#define ICE_AQC_GET_PHY_REC_CLK_OUT_OUT_EN BIT(0)
1374+
u8 rsvd[11];
1375+
__le16 node_handle;
1376+
};
1377+
13541378
struct ice_aqc_link_topo_params {
13551379
u8 lport_num;
13561380
u8 lport_num_valid;
@@ -1367,6 +1391,8 @@ struct ice_aqc_link_topo_params {
13671391
#define ICE_AQC_LINK_TOPO_NODE_TYPE_CAGE 6
13681392
#define ICE_AQC_LINK_TOPO_NODE_TYPE_MEZZ 7
13691393
#define ICE_AQC_LINK_TOPO_NODE_TYPE_ID_EEPROM 8
1394+
#define ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL 9
1395+
#define ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_MUX 10
13701396
#define ICE_AQC_LINK_TOPO_NODE_CTX_S 4
13711397
#define ICE_AQC_LINK_TOPO_NODE_CTX_M \
13721398
(0xF << ICE_AQC_LINK_TOPO_NODE_CTX_S)
@@ -1403,8 +1429,12 @@ struct ice_aqc_link_topo_addr {
14031429
struct ice_aqc_get_link_topo {
14041430
struct ice_aqc_link_topo_addr addr;
14051431
u8 node_part_num;
1406-
#define ICE_AQC_GET_LINK_TOPO_NODE_NR_PCA9575 0x21
1407-
#define ICE_AQC_GET_LINK_TOPO_NODE_NR_C827 0x31
1432+
#define ICE_AQC_GET_LINK_TOPO_NODE_NR_PCA9575 0x21
1433+
#define ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032 0x24
1434+
#define ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384 0x25
1435+
#define ICE_AQC_GET_LINK_TOPO_NODE_NR_E822_PHY 0x30
1436+
#define ICE_AQC_GET_LINK_TOPO_NODE_NR_C827 0x31
1437+
#define ICE_AQC_GET_LINK_TOPO_NODE_NR_GEN_CLK_MUX 0x47
14081438
u8 rsvd[9];
14091439
};
14101440

@@ -2125,6 +2155,193 @@ struct ice_aqc_get_pkg_info_resp {
21252155
struct ice_aqc_get_pkg_info pkg_info[];
21262156
};
21272157

2158+
/* Get CGU abilities command response data structure (indirect 0x0C61) */
2159+
struct ice_aqc_get_cgu_abilities {
2160+
u8 num_inputs;
2161+
u8 num_outputs;
2162+
u8 pps_dpll_idx;
2163+
u8 eec_dpll_idx;
2164+
__le32 max_in_freq;
2165+
__le32 max_in_phase_adj;
2166+
__le32 max_out_freq;
2167+
__le32 max_out_phase_adj;
2168+
u8 cgu_part_num;
2169+
u8 rsvd[3];
2170+
};
2171+
2172+
/* Set CGU input config (direct 0x0C62) */
2173+
struct ice_aqc_set_cgu_input_config {
2174+
u8 input_idx;
2175+
u8 flags1;
2176+
#define ICE_AQC_SET_CGU_IN_CFG_FLG1_UPDATE_FREQ BIT(6)
2177+
#define ICE_AQC_SET_CGU_IN_CFG_FLG1_UPDATE_DELAY BIT(7)
2178+
u8 flags2;
2179+
#define ICE_AQC_SET_CGU_IN_CFG_FLG2_INPUT_EN BIT(5)
2180+
#define ICE_AQC_SET_CGU_IN_CFG_FLG2_ESYNC_EN BIT(6)
2181+
u8 rsvd;
2182+
__le32 freq;
2183+
__le32 phase_delay;
2184+
u8 rsvd2[2];
2185+
__le16 node_handle;
2186+
};
2187+
2188+
/* Get CGU input config response descriptor structure (direct 0x0C63) */
2189+
struct ice_aqc_get_cgu_input_config {
2190+
u8 input_idx;
2191+
u8 status;
2192+
#define ICE_AQC_GET_CGU_IN_CFG_STATUS_LOS BIT(0)
2193+
#define ICE_AQC_GET_CGU_IN_CFG_STATUS_SCM_FAIL BIT(1)
2194+
#define ICE_AQC_GET_CGU_IN_CFG_STATUS_CFM_FAIL BIT(2)
2195+
#define ICE_AQC_GET_CGU_IN_CFG_STATUS_GST_FAIL BIT(3)
2196+
#define ICE_AQC_GET_CGU_IN_CFG_STATUS_PFM_FAIL BIT(4)
2197+
#define ICE_AQC_GET_CGU_IN_CFG_STATUS_ESYNC_FAIL BIT(6)
2198+
#define ICE_AQC_GET_CGU_IN_CFG_STATUS_ESYNC_CAP BIT(7)
2199+
u8 type;
2200+
#define ICE_AQC_GET_CGU_IN_CFG_TYPE_READ_ONLY BIT(0)
2201+
#define ICE_AQC_GET_CGU_IN_CFG_TYPE_GPS BIT(4)
2202+
#define ICE_AQC_GET_CGU_IN_CFG_TYPE_EXTERNAL BIT(5)
2203+
#define ICE_AQC_GET_CGU_IN_CFG_TYPE_PHY BIT(6)
2204+
u8 flags1;
2205+
#define ICE_AQC_GET_CGU_IN_CFG_FLG1_PHASE_DELAY_SUPP BIT(0)
2206+
#define ICE_AQC_GET_CGU_IN_CFG_FLG1_1PPS_SUPP BIT(2)
2207+
#define ICE_AQC_GET_CGU_IN_CFG_FLG1_10MHZ_SUPP BIT(3)
2208+
#define ICE_AQC_GET_CGU_IN_CFG_FLG1_ANYFREQ BIT(7)
2209+
__le32 freq;
2210+
__le32 phase_delay;
2211+
u8 flags2;
2212+
#define ICE_AQC_GET_CGU_IN_CFG_FLG2_INPUT_EN BIT(5)
2213+
#define ICE_AQC_GET_CGU_IN_CFG_FLG2_ESYNC_EN BIT(6)
2214+
u8 rsvd[1];
2215+
__le16 node_handle;
2216+
};
2217+
2218+
/* Set CGU output config (direct 0x0C64) */
2219+
struct ice_aqc_set_cgu_output_config {
2220+
u8 output_idx;
2221+
u8 flags;
2222+
#define ICE_AQC_SET_CGU_OUT_CFG_OUT_EN BIT(0)
2223+
#define ICE_AQC_SET_CGU_OUT_CFG_ESYNC_EN BIT(1)
2224+
#define ICE_AQC_SET_CGU_OUT_CFG_UPDATE_FREQ BIT(2)
2225+
#define ICE_AQC_SET_CGU_OUT_CFG_UPDATE_PHASE BIT(3)
2226+
#define ICE_AQC_SET_CGU_OUT_CFG_UPDATE_SRC_SEL BIT(4)
2227+
u8 src_sel;
2228+
#define ICE_AQC_SET_CGU_OUT_CFG_DPLL_SRC_SEL ICE_M(0x1F, 0)
2229+
u8 rsvd;
2230+
__le32 freq;
2231+
__le32 phase_delay;
2232+
u8 rsvd2[2];
2233+
__le16 node_handle;
2234+
};
2235+
2236+
/* Get CGU output config (direct 0x0C65) */
2237+
struct ice_aqc_get_cgu_output_config {
2238+
u8 output_idx;
2239+
u8 flags;
2240+
#define ICE_AQC_GET_CGU_OUT_CFG_OUT_EN BIT(0)
2241+
#define ICE_AQC_GET_CGU_OUT_CFG_ESYNC_EN BIT(1)
2242+
#define ICE_AQC_GET_CGU_OUT_CFG_ESYNC_ABILITY BIT(2)
2243+
u8 src_sel;
2244+
#define ICE_AQC_GET_CGU_OUT_CFG_DPLL_SRC_SEL_SHIFT 0
2245+
#define ICE_AQC_GET_CGU_OUT_CFG_DPLL_SRC_SEL \
2246+
ICE_M(0x1F, ICE_AQC_GET_CGU_OUT_CFG_DPLL_SRC_SEL_SHIFT)
2247+
#define ICE_AQC_GET_CGU_OUT_CFG_DPLL_MODE_SHIFT 5
2248+
#define ICE_AQC_GET_CGU_OUT_CFG_DPLL_MODE \
2249+
ICE_M(0x7, ICE_AQC_GET_CGU_OUT_CFG_DPLL_MODE_SHIFT)
2250+
u8 rsvd;
2251+
__le32 freq;
2252+
__le32 src_freq;
2253+
u8 rsvd2[2];
2254+
__le16 node_handle;
2255+
};
2256+
2257+
/* Get CGU DPLL status (direct 0x0C66) */
2258+
struct ice_aqc_get_cgu_dpll_status {
2259+
u8 dpll_num;
2260+
u8 ref_state;
2261+
#define ICE_AQC_GET_CGU_DPLL_STATUS_REF_SW_LOS BIT(0)
2262+
#define ICE_AQC_GET_CGU_DPLL_STATUS_REF_SW_SCM BIT(1)
2263+
#define ICE_AQC_GET_CGU_DPLL_STATUS_REF_SW_CFM BIT(2)
2264+
#define ICE_AQC_GET_CGU_DPLL_STATUS_REF_SW_GST BIT(3)
2265+
#define ICE_AQC_GET_CGU_DPLL_STATUS_REF_SW_PFM BIT(4)
2266+
#define ICE_AQC_GET_CGU_DPLL_STATUS_FAST_LOCK_EN BIT(5)
2267+
#define ICE_AQC_GET_CGU_DPLL_STATUS_REF_SW_ESYNC BIT(6)
2268+
u8 dpll_state;
2269+
#define ICE_AQC_GET_CGU_DPLL_STATUS_STATE_LOCK BIT(0)
2270+
#define ICE_AQC_GET_CGU_DPLL_STATUS_STATE_HO BIT(1)
2271+
#define ICE_AQC_GET_CGU_DPLL_STATUS_STATE_HO_READY BIT(2)
2272+
#define ICE_AQC_GET_CGU_DPLL_STATUS_STATE_FLHIT BIT(5)
2273+
#define ICE_AQC_GET_CGU_DPLL_STATUS_STATE_PSLHIT BIT(7)
2274+
u8 config;
2275+
#define ICE_AQC_GET_CGU_DPLL_CONFIG_CLK_REF_SEL ICE_M(0x1F, 0)
2276+
#define ICE_AQC_GET_CGU_DPLL_CONFIG_MODE_SHIFT 5
2277+
#define ICE_AQC_GET_CGU_DPLL_CONFIG_MODE \
2278+
ICE_M(0x7, ICE_AQC_GET_CGU_DPLL_CONFIG_MODE_SHIFT)
2279+
#define ICE_AQC_GET_CGU_DPLL_CONFIG_MODE_FREERUN 0
2280+
#define ICE_AQC_GET_CGU_DPLL_CONFIG_MODE_AUTOMATIC \
2281+
ICE_M(0x3, ICE_AQC_GET_CGU_DPLL_CONFIG_MODE_SHIFT)
2282+
__le32 phase_offset_h;
2283+
__le32 phase_offset_l;
2284+
u8 eec_mode;
2285+
#define ICE_AQC_GET_CGU_DPLL_STATUS_EEC_MODE_1 0xA
2286+
#define ICE_AQC_GET_CGU_DPLL_STATUS_EEC_MODE_2 0xB
2287+
#define ICE_AQC_GET_CGU_DPLL_STATUS_EEC_MODE_UNKNOWN 0xF
2288+
u8 rsvd[1];
2289+
__le16 node_handle;
2290+
};
2291+
2292+
/* Set CGU DPLL config (direct 0x0C67) */
2293+
struct ice_aqc_set_cgu_dpll_config {
2294+
u8 dpll_num;
2295+
u8 ref_state;
2296+
#define ICE_AQC_SET_CGU_DPLL_CONFIG_REF_SW_LOS BIT(0)
2297+
#define ICE_AQC_SET_CGU_DPLL_CONFIG_REF_SW_SCM BIT(1)
2298+
#define ICE_AQC_SET_CGU_DPLL_CONFIG_REF_SW_CFM BIT(2)
2299+
#define ICE_AQC_SET_CGU_DPLL_CONFIG_REF_SW_GST BIT(3)
2300+
#define ICE_AQC_SET_CGU_DPLL_CONFIG_REF_SW_PFM BIT(4)
2301+
#define ICE_AQC_SET_CGU_DPLL_CONFIG_REF_FLOCK_EN BIT(5)
2302+
#define ICE_AQC_SET_CGU_DPLL_CONFIG_REF_SW_ESYNC BIT(6)
2303+
u8 rsvd;
2304+
u8 config;
2305+
#define ICE_AQC_SET_CGU_DPLL_CONFIG_CLK_REF_SEL ICE_M(0x1F, 0)
2306+
#define ICE_AQC_SET_CGU_DPLL_CONFIG_MODE_SHIFT 5
2307+
#define ICE_AQC_SET_CGU_DPLL_CONFIG_MODE \
2308+
ICE_M(0x7, ICE_AQC_SET_CGU_DPLL_CONFIG_MODE_SHIFT)
2309+
#define ICE_AQC_SET_CGU_DPLL_CONFIG_MODE_FREERUN 0
2310+
#define ICE_AQC_SET_CGU_DPLL_CONFIG_MODE_AUTOMATIC \
2311+
ICE_M(0x3, ICE_AQC_SET_CGU_DPLL_CONFIG_MODE_SHIFT)
2312+
u8 rsvd2[8];
2313+
u8 eec_mode;
2314+
u8 rsvd3[1];
2315+
__le16 node_handle;
2316+
};
2317+
2318+
/* Set CGU reference priority (direct 0x0C68) */
2319+
struct ice_aqc_set_cgu_ref_prio {
2320+
u8 dpll_num;
2321+
u8 ref_idx;
2322+
u8 ref_priority;
2323+
u8 rsvd[11];
2324+
__le16 node_handle;
2325+
};
2326+
2327+
/* Get CGU reference priority (direct 0x0C69) */
2328+
struct ice_aqc_get_cgu_ref_prio {
2329+
u8 dpll_num;
2330+
u8 ref_idx;
2331+
u8 ref_priority; /* Valid only in response */
2332+
u8 rsvd[13];
2333+
};
2334+
2335+
/* Get CGU info (direct 0x0C6A) */
2336+
struct ice_aqc_get_cgu_info {
2337+
__le32 cgu_id;
2338+
__le32 cgu_cfg_ver;
2339+
__le32 cgu_fw_ver;
2340+
u8 node_part_num;
2341+
u8 dev_rev;
2342+
__le16 node_handle;
2343+
};
2344+
21282345
/* Driver Shared Parameters (direct, 0x0C90) */
21292346
struct ice_aqc_driver_shared_params {
21302347
u8 set_or_get_op;
@@ -2194,6 +2411,8 @@ struct ice_aq_desc {
21942411
struct ice_aqc_get_phy_caps get_phy;
21952412
struct ice_aqc_set_phy_cfg set_phy;
21962413
struct ice_aqc_restart_an restart_an;
2414+
struct ice_aqc_set_phy_rec_clk_out set_phy_rec_clk_out;
2415+
struct ice_aqc_get_phy_rec_clk_out get_phy_rec_clk_out;
21972416
struct ice_aqc_gpio read_write_gpio;
21982417
struct ice_aqc_sff_eeprom read_write_sff_param;
21992418
struct ice_aqc_set_port_id_led set_port_id_led;
@@ -2234,6 +2453,15 @@ struct ice_aq_desc {
22342453
struct ice_aqc_fw_logging fw_logging;
22352454
struct ice_aqc_get_clear_fw_log get_clear_fw_log;
22362455
struct ice_aqc_download_pkg download_pkg;
2456+
struct ice_aqc_set_cgu_input_config set_cgu_input_config;
2457+
struct ice_aqc_get_cgu_input_config get_cgu_input_config;
2458+
struct ice_aqc_set_cgu_output_config set_cgu_output_config;
2459+
struct ice_aqc_get_cgu_output_config get_cgu_output_config;
2460+
struct ice_aqc_get_cgu_dpll_status get_cgu_dpll_status;
2461+
struct ice_aqc_set_cgu_dpll_config set_cgu_dpll_config;
2462+
struct ice_aqc_set_cgu_ref_prio set_cgu_ref_prio;
2463+
struct ice_aqc_get_cgu_ref_prio get_cgu_ref_prio;
2464+
struct ice_aqc_get_cgu_info get_cgu_info;
22372465
struct ice_aqc_driver_shared_params drv_shared_params;
22382466
struct ice_aqc_set_mac_lb set_mac_lb;
22392467
struct ice_aqc_alloc_free_res_cmd sw_res_ctrl;
@@ -2358,6 +2586,8 @@ enum ice_adminq_opc {
23582586
ice_aqc_opc_get_link_status = 0x0607,
23592587
ice_aqc_opc_set_event_mask = 0x0613,
23602588
ice_aqc_opc_set_mac_lb = 0x0620,
2589+
ice_aqc_opc_set_phy_rec_clk_out = 0x0630,
2590+
ice_aqc_opc_get_phy_rec_clk_out = 0x0631,
23612591
ice_aqc_opc_get_link_topo = 0x06E0,
23622592
ice_aqc_opc_read_i2c = 0x06E2,
23632593
ice_aqc_opc_write_i2c = 0x06E3,
@@ -2413,6 +2643,18 @@ enum ice_adminq_opc {
24132643
ice_aqc_opc_update_pkg = 0x0C42,
24142644
ice_aqc_opc_get_pkg_info_list = 0x0C43,
24152645

2646+
/* 1588/SyncE commands/events */
2647+
ice_aqc_opc_get_cgu_abilities = 0x0C61,
2648+
ice_aqc_opc_set_cgu_input_config = 0x0C62,
2649+
ice_aqc_opc_get_cgu_input_config = 0x0C63,
2650+
ice_aqc_opc_set_cgu_output_config = 0x0C64,
2651+
ice_aqc_opc_get_cgu_output_config = 0x0C65,
2652+
ice_aqc_opc_get_cgu_dpll_status = 0x0C66,
2653+
ice_aqc_opc_set_cgu_dpll_config = 0x0C67,
2654+
ice_aqc_opc_set_cgu_ref_prio = 0x0C68,
2655+
ice_aqc_opc_get_cgu_ref_prio = 0x0C69,
2656+
ice_aqc_opc_get_cgu_info = 0x0C6A,
2657+
24162658
ice_aqc_opc_driver_shared_params = 0x0C90,
24172659

24182660
/* Standalone Commands/Events */

0 commit comments

Comments
 (0)