Skip to content

Commit b390ecc

Browse files
kolacinskikarolkuba-moo
authored andcommitted
ice: Change CGU regs struct to anonymous
Simplify the code by using anonymous struct in CGU registers instead of naming each structure 'field'. Suggested-by: Przemek Kitszel <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Reviewed-by: Arkadiusz Kubalewski <[email protected]> Signed-off-by: Karol Kolacinski <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Link: https://lore.kernel.org/r/20240528-next-2024-05-28-ptp-refactors-v1-8-c082739bb6f6@intel.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7cab44f commit b390ecc

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ union nac_cgu_dword9 {
2323
u32 clk_synce0_amp : 2;
2424
u32 one_pps_out_amp : 2;
2525
u32 misc24 : 12;
26-
} field;
26+
};
2727
u32 val;
2828
};
2929

@@ -39,7 +39,7 @@ union nac_cgu_dword19 {
3939
u32 japll_ndivratio : 4;
4040
u32 japll_iref_ndivratio : 3;
4141
u32 misc27 : 1;
42-
} field;
42+
};
4343
u32 val;
4444
};
4545

@@ -63,7 +63,7 @@ union nac_cgu_dword22 {
6363
u32 fdpllclk_sel_div2 : 1;
6464
u32 time1588clk_sel_div2 : 1;
6565
u32 misc3 : 1;
66-
} field;
66+
};
6767
u32 val;
6868
};
6969

@@ -77,7 +77,7 @@ union nac_cgu_dword24 {
7777
u32 ext_synce_sel : 1;
7878
u32 ref1588_ck_div : 4;
7979
u32 time_ref_sel : 1;
80-
} field;
80+
};
8181
u32 val;
8282
};
8383

@@ -92,7 +92,7 @@ union tspll_cntr_bist_settings {
9292
u32 i_plllock_cnt_6_0 : 7;
9393
u32 i_plllock_cnt_10_7 : 4;
9494
u32 reserved200 : 4;
95-
} field;
95+
};
9696
u32 val;
9797
};
9898

@@ -109,7 +109,7 @@ union tspll_ro_bwm_lf {
109109
u32 afcdone_cri : 1;
110110
u32 feedfwrdgain_cal_cri_7_0 : 8;
111111
u32 m2fbdivmod_cri_7_0 : 8;
112-
} field;
112+
};
113113
u32 val;
114114
};
115115

drivers/net/ethernet/intel/ice/ice_ptp_hw.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -393,22 +393,22 @@ static int ice_cfg_cgu_pll_e82x(struct ice_hw *hw,
393393

394394
/* Log the current clock configuration */
395395
ice_debug(hw, ICE_DBG_PTP, "Current CGU configuration -- %s, clk_src %s, clk_freq %s, PLL %s\n",
396-
dw24.field.ts_pll_enable ? "enabled" : "disabled",
397-
ice_clk_src_str(dw24.field.time_ref_sel),
398-
ice_clk_freq_str(dw9.field.time_ref_freq_sel),
399-
bwm_lf.field.plllock_true_lock_cri ? "locked" : "unlocked");
396+
dw24.ts_pll_enable ? "enabled" : "disabled",
397+
ice_clk_src_str(dw24.time_ref_sel),
398+
ice_clk_freq_str(dw9.time_ref_freq_sel),
399+
bwm_lf.plllock_true_lock_cri ? "locked" : "unlocked");
400400

401401
/* Disable the PLL before changing the clock source or frequency */
402-
if (dw24.field.ts_pll_enable) {
403-
dw24.field.ts_pll_enable = 0;
402+
if (dw24.ts_pll_enable) {
403+
dw24.ts_pll_enable = 0;
404404

405405
err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD24, dw24.val);
406406
if (err)
407407
return err;
408408
}
409409

410410
/* Set the frequency */
411-
dw9.field.time_ref_freq_sel = clk_freq;
411+
dw9.time_ref_freq_sel = clk_freq;
412412
err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD9, dw9.val);
413413
if (err)
414414
return err;
@@ -418,8 +418,8 @@ static int ice_cfg_cgu_pll_e82x(struct ice_hw *hw,
418418
if (err)
419419
return err;
420420

421-
dw19.field.tspll_fbdiv_intgr = e822_cgu_params[clk_freq].feedback_div;
422-
dw19.field.tspll_ndivratio = 1;
421+
dw19.tspll_fbdiv_intgr = e822_cgu_params[clk_freq].feedback_div;
422+
dw19.tspll_ndivratio = 1;
423423

424424
err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD19, dw19.val);
425425
if (err)
@@ -430,8 +430,8 @@ static int ice_cfg_cgu_pll_e82x(struct ice_hw *hw,
430430
if (err)
431431
return err;
432432

433-
dw22.field.time1588clk_div = e822_cgu_params[clk_freq].post_pll_div;
434-
dw22.field.time1588clk_sel_div2 = 0;
433+
dw22.time1588clk_div = e822_cgu_params[clk_freq].post_pll_div;
434+
dw22.time1588clk_sel_div2 = 0;
435435

436436
err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD22, dw22.val);
437437
if (err)
@@ -442,16 +442,16 @@ static int ice_cfg_cgu_pll_e82x(struct ice_hw *hw,
442442
if (err)
443443
return err;
444444

445-
dw24.field.ref1588_ck_div = e822_cgu_params[clk_freq].refclk_pre_div;
446-
dw24.field.tspll_fbdiv_frac = e822_cgu_params[clk_freq].frac_n_div;
447-
dw24.field.time_ref_sel = clk_src;
445+
dw24.ref1588_ck_div = e822_cgu_params[clk_freq].refclk_pre_div;
446+
dw24.tspll_fbdiv_frac = e822_cgu_params[clk_freq].frac_n_div;
447+
dw24.time_ref_sel = clk_src;
448448

449449
err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD24, dw24.val);
450450
if (err)
451451
return err;
452452

453453
/* Finally, enable the PLL */
454-
dw24.field.ts_pll_enable = 1;
454+
dw24.ts_pll_enable = 1;
455455

456456
err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD24, dw24.val);
457457
if (err)
@@ -464,17 +464,17 @@ static int ice_cfg_cgu_pll_e82x(struct ice_hw *hw,
464464
if (err)
465465
return err;
466466

467-
if (!bwm_lf.field.plllock_true_lock_cri) {
467+
if (!bwm_lf.plllock_true_lock_cri) {
468468
dev_warn(ice_hw_to_dev(hw), "CGU PLL failed to lock\n");
469469
return -EBUSY;
470470
}
471471

472472
/* Log the current clock configuration */
473473
ice_debug(hw, ICE_DBG_PTP, "New CGU configuration -- %s, clk_src %s, clk_freq %s, PLL %s\n",
474-
dw24.field.ts_pll_enable ? "enabled" : "disabled",
475-
ice_clk_src_str(dw24.field.time_ref_sel),
476-
ice_clk_freq_str(dw9.field.time_ref_freq_sel),
477-
bwm_lf.field.plllock_true_lock_cri ? "locked" : "unlocked");
474+
dw24.ts_pll_enable ? "enabled" : "disabled",
475+
ice_clk_src_str(dw24.time_ref_sel),
476+
ice_clk_freq_str(dw9.time_ref_freq_sel),
477+
bwm_lf.plllock_true_lock_cri ? "locked" : "unlocked");
478478

479479
return 0;
480480
}
@@ -499,8 +499,8 @@ static int ice_init_cgu_e82x(struct ice_hw *hw)
499499
return err;
500500

501501
/* Disable sticky lock detection so lock err reported is accurate */
502-
cntr_bist.field.i_plllock_sel_0 = 0;
503-
cntr_bist.field.i_plllock_sel_1 = 0;
502+
cntr_bist.i_plllock_sel_0 = 0;
503+
cntr_bist.i_plllock_sel_1 = 0;
504504

505505
err = ice_write_cgu_reg_e82x(hw, TSPLL_CNTR_BIST_SETTINGS,
506506
cntr_bist.val);

0 commit comments

Comments
 (0)