@@ -1038,7 +1038,7 @@ static int _idtcm_adjtime_deprecated(struct idtcm_channel *channel, s64 delta)
1038
1038
s64 now ;
1039
1039
1040
1040
if (abs (delta ) < PHASE_PULL_IN_THRESHOLD_NS_DEPRECATED ) {
1041
- err = channel -> do_phase_pull_in (channel , delta , 0 );
1041
+ err = channel -> do_phase_pull_in (channel , delta , channel -> caps . max_adj );
1042
1042
} else {
1043
1043
idtcm -> calculate_overhead_flag = 1 ;
1044
1044
@@ -1594,7 +1594,7 @@ static int do_phase_pull_in_sw(struct idtcm_channel *channel,
1594
1594
if (abs (delta_ns ) < PHASE_PULL_IN_MIN_THRESHOLD_NS )
1595
1595
return 0 ;
1596
1596
1597
- if (max_ffo_ppb == 0 )
1597
+ if (max_ffo_ppb == 0 || max_ffo_ppb > PHASE_PULL_IN_MAX_PPB )
1598
1598
max_ffo_ppb = PHASE_PULL_IN_MAX_PPB ;
1599
1599
1600
1600
/* For most cases, keep phase pull-in duration 1 second */
@@ -1880,7 +1880,7 @@ static int idtcm_adjtime(struct ptp_clock_info *ptp, s64 delta)
1880
1880
mutex_lock (idtcm -> lock );
1881
1881
1882
1882
if (abs (delta ) < PHASE_PULL_IN_THRESHOLD_NS ) {
1883
- err = channel -> do_phase_pull_in (channel , delta , 0 );
1883
+ err = channel -> do_phase_pull_in (channel , delta , channel -> caps . max_adj );
1884
1884
} else {
1885
1885
if (delta >= 0 ) {
1886
1886
ts = ns_to_timespec64 (delta );
@@ -1927,9 +1927,6 @@ static int idtcm_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
1927
1927
if (channel -> phase_pull_in == true)
1928
1928
return 0 ;
1929
1929
1930
- if (scaled_ppm == channel -> current_freq_scaled_ppm )
1931
- return 0 ;
1932
-
1933
1930
mutex_lock (idtcm -> lock );
1934
1931
err = _idtcm_adjfine (channel , scaled_ppm );
1935
1932
mutex_unlock (idtcm -> lock );
@@ -2054,7 +2051,7 @@ static struct ptp_pin_desc pin_config[MAX_TOD][MAX_REF_CLK];
2054
2051
2055
2052
static const struct ptp_clock_info idtcm_caps = {
2056
2053
.owner = THIS_MODULE ,
2057
- .max_adj = 244000 ,
2054
+ .max_adj = MAX_FFO_PPB ,
2058
2055
.n_per_out = 12 ,
2059
2056
.n_ext_ts = MAX_TOD ,
2060
2057
.n_pins = MAX_REF_CLK ,
@@ -2071,7 +2068,7 @@ static const struct ptp_clock_info idtcm_caps = {
2071
2068
2072
2069
static const struct ptp_clock_info idtcm_caps_deprecated = {
2073
2070
.owner = THIS_MODULE ,
2074
- .max_adj = 244000 ,
2071
+ .max_adj = MAX_FFO_PPB ,
2075
2072
.n_per_out = 12 ,
2076
2073
.n_ext_ts = MAX_TOD ,
2077
2074
.n_pins = MAX_REF_CLK ,
@@ -2242,6 +2239,25 @@ static int configure_channel_tod(struct idtcm_channel *channel, u32 index)
2242
2239
return 0 ;
2243
2240
}
2244
2241
2242
+ static int initialize_max_adj (struct idtcm_channel * channel )
2243
+ {
2244
+ struct idtcm * idtcm = channel -> idtcm ;
2245
+ u8 ffo_ppm ;
2246
+ int err ;
2247
+
2248
+ err = idtcm_read (idtcm , channel -> dpll_n , DPLL_MAX_FREQ_OFFSET ,
2249
+ & ffo_ppm , sizeof (ffo_ppm ));
2250
+ if (err )
2251
+ return err ;
2252
+
2253
+ if (ffo_ppm && ffo_ppm <= (MAX_FFO_PPB / 1000 ))
2254
+ channel -> caps .max_adj = ffo_ppm * 1000 ;
2255
+ else
2256
+ channel -> caps .max_adj = MAX_FFO_PPB ;
2257
+
2258
+ return 0 ;
2259
+ }
2260
+
2245
2261
static int idtcm_enable_channel (struct idtcm * idtcm , u32 index )
2246
2262
{
2247
2263
struct idtcm_channel * channel ;
@@ -2285,6 +2301,10 @@ static int idtcm_enable_channel(struct idtcm *idtcm, u32 index)
2285
2301
ppd -> chan = index ;
2286
2302
}
2287
2303
2304
+ err = initialize_max_adj (channel );
2305
+ if (err )
2306
+ return err ;
2307
+
2288
2308
err = initialize_dco_operating_mode (channel );
2289
2309
if (err )
2290
2310
return err ;
@@ -2437,8 +2457,13 @@ static int idtcm_probe(struct platform_device *pdev)
2437
2457
2438
2458
err = idtcm_load_firmware (idtcm , & pdev -> dev );
2439
2459
2440
- if (err )
2460
+ if (err ) {
2461
+ if (err == - ENOENT ) {
2462
+ mutex_unlock (idtcm -> lock );
2463
+ return - EPROBE_DEFER ;
2464
+ }
2441
2465
dev_warn (idtcm -> dev , "loading firmware failed with %d" , err );
2466
+ }
2442
2467
2443
2468
wait_for_chip_ready (idtcm );
2444
2469
0 commit comments