Commit b63636b6 authored by Rahul Rameshbabu's avatar Rahul Rameshbabu Committed by Saeed Mahameed

net/mlx5: Add firmware support for MTUTC scaled_ppm frequency adjustments

When device is capable of handling scaled ppm values for adjusting
frequency, conversion to ppb will not be done by the driver. Instead, the
scaled ppm value will be passed directly to the device for the frequency
adjustment operation.
Signed-off-by: default avatarRahul Rameshbabu <rrameshbabu@nvidia.com>
Reviewed-by: default avatarGal Pressman <gal@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 04937a0f
...@@ -362,7 +362,7 @@ static int mlx5_ptp_adjphase(struct ptp_clock_info *ptp, s32 delta) ...@@ -362,7 +362,7 @@ static int mlx5_ptp_adjphase(struct ptp_clock_info *ptp, s32 delta)
return mlx5_ptp_adjtime(ptp, delta); return mlx5_ptp_adjtime(ptp, delta);
} }
static int mlx5_ptp_adjfreq_real_time(struct mlx5_core_dev *mdev, s32 freq) static int mlx5_ptp_freq_adj_real_time(struct mlx5_core_dev *mdev, long scaled_ppm)
{ {
u32 in[MLX5_ST_SZ_DW(mtutc_reg)] = {}; u32 in[MLX5_ST_SZ_DW(mtutc_reg)] = {};
...@@ -370,7 +370,15 @@ static int mlx5_ptp_adjfreq_real_time(struct mlx5_core_dev *mdev, s32 freq) ...@@ -370,7 +370,15 @@ static int mlx5_ptp_adjfreq_real_time(struct mlx5_core_dev *mdev, s32 freq)
return 0; return 0;
MLX5_SET(mtutc_reg, in, operation, MLX5_MTUTC_OPERATION_ADJUST_FREQ_UTC); MLX5_SET(mtutc_reg, in, operation, MLX5_MTUTC_OPERATION_ADJUST_FREQ_UTC);
MLX5_SET(mtutc_reg, in, freq_adjustment, freq);
if (MLX5_CAP_MCAM_FEATURE(mdev, mtutc_freq_adj_units)) {
MLX5_SET(mtutc_reg, in, freq_adj_units,
MLX5_MTUTC_FREQ_ADJ_UNITS_SCALED_PPM);
MLX5_SET(mtutc_reg, in, freq_adjustment, scaled_ppm);
} else {
MLX5_SET(mtutc_reg, in, freq_adj_units, MLX5_MTUTC_FREQ_ADJ_UNITS_PPB);
MLX5_SET(mtutc_reg, in, freq_adjustment, scaled_ppm_to_ppb(scaled_ppm));
}
return mlx5_set_mtutc(mdev, in, sizeof(in)); return mlx5_set_mtutc(mdev, in, sizeof(in));
} }
...@@ -385,7 +393,8 @@ static int mlx5_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) ...@@ -385,7 +393,8 @@ static int mlx5_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
int err; int err;
mdev = container_of(clock, struct mlx5_core_dev, clock); mdev = container_of(clock, struct mlx5_core_dev, clock);
err = mlx5_ptp_adjfreq_real_time(mdev, scaled_ppm_to_ppb(scaled_ppm));
err = mlx5_ptp_freq_adj_real_time(mdev, scaled_ppm);
if (err) if (err)
return err; return err;
......
...@@ -9925,6 +9925,11 @@ struct mlx5_ifc_mpegc_reg_bits { ...@@ -9925,6 +9925,11 @@ struct mlx5_ifc_mpegc_reg_bits {
u8 reserved_at_60[0x100]; u8 reserved_at_60[0x100];
}; };
enum {
MLX5_MTUTC_FREQ_ADJ_UNITS_PPB = 0x0,
MLX5_MTUTC_FREQ_ADJ_UNITS_SCALED_PPM = 0x1,
};
enum { enum {
MLX5_MTUTC_OPERATION_SET_TIME_IMMEDIATE = 0x1, MLX5_MTUTC_OPERATION_SET_TIME_IMMEDIATE = 0x1,
MLX5_MTUTC_OPERATION_ADJUST_TIME = 0x2, MLX5_MTUTC_OPERATION_ADJUST_TIME = 0x2,
...@@ -9932,7 +9937,9 @@ enum { ...@@ -9932,7 +9937,9 @@ enum {
}; };
struct mlx5_ifc_mtutc_reg_bits { struct mlx5_ifc_mtutc_reg_bits {
u8 reserved_at_0[0x1c]; u8 reserved_at_0[0x5];
u8 freq_adj_units[0x3];
u8 reserved_at_8[0x14];
u8 operation[0x4]; u8 operation[0x4];
u8 freq_adjustment[0x20]; u8 freq_adjustment[0x20];
...@@ -10005,7 +10012,8 @@ struct mlx5_ifc_pcam_reg_bits { ...@@ -10005,7 +10012,8 @@ struct mlx5_ifc_pcam_reg_bits {
}; };
struct mlx5_ifc_mcam_enhanced_features_bits { struct mlx5_ifc_mcam_enhanced_features_bits {
u8 reserved_at_0[0x51]; u8 reserved_at_0[0x50];
u8 mtutc_freq_adj_units[0x1];
u8 mtutc_time_adjustment_extended_range[0x1]; u8 mtutc_time_adjustment_extended_range[0x1];
u8 reserved_at_52[0xb]; u8 reserved_at_52[0xb];
u8 mcia_32dwords[0x1]; u8 mcia_32dwords[0x1];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment