@@ -293,6 +293,28 @@ static u32 phy_tx_vref_tune_from_property(u32 percent)
293
293
return DIV_ROUND_CLOSEST (percent - 94U , 2 );
294
294
}
295
295
296
+ static u32 imx95_phy_tx_vref_tune_from_property (u32 percent )
297
+ {
298
+ percent = clamp (percent , 90U , 108U );
299
+
300
+ switch (percent ) {
301
+ case 90 ... 91 :
302
+ percent = 0 ;
303
+ break ;
304
+ case 92 ... 96 :
305
+ percent -= 91 ;
306
+ break ;
307
+ case 97 ... 104 :
308
+ percent -= 92 ;
309
+ break ;
310
+ case 105 ... 108 :
311
+ percent -= 93 ;
312
+ break ;
313
+ }
314
+
315
+ return percent ;
316
+ }
317
+
296
318
static u32 phy_tx_rise_tune_from_property (u32 percent )
297
319
{
298
320
switch (percent ) {
@@ -307,6 +329,22 @@ static u32 phy_tx_rise_tune_from_property(u32 percent)
307
329
}
308
330
}
309
331
332
+ static u32 imx95_phy_tx_rise_tune_from_property (u32 percent )
333
+ {
334
+ percent = clamp (percent , 90U , 120U );
335
+
336
+ switch (percent ) {
337
+ case 90 ... 99 :
338
+ return 3 ;
339
+ case 101 ... 115 :
340
+ return 1 ;
341
+ case 116 ... 120 :
342
+ return 0 ;
343
+ default :
344
+ return 2 ;
345
+ }
346
+ }
347
+
310
348
static u32 phy_tx_preemp_amp_tune_from_property (u32 microamp )
311
349
{
312
350
microamp = min (microamp , 1800U );
@@ -352,6 +390,29 @@ static u32 phy_comp_dis_tune_from_property(u32 percent)
352
390
return 7 ;
353
391
}
354
392
}
393
+
394
+ static u32 imx95_phy_comp_dis_tune_from_property (u32 percent )
395
+ {
396
+ percent = clamp (percent , 94 , 104 );
397
+
398
+ switch (percent ) {
399
+ case 94 ... 95 :
400
+ percent = 0 ;
401
+ break ;
402
+ case 96 ... 98 :
403
+ percent -= 95 ;
404
+ break ;
405
+ case 99 ... 102 :
406
+ percent -= 96 ;
407
+ break ;
408
+ case 103 ... 104 :
409
+ percent -= 97 ;
410
+ break ;
411
+ }
412
+
413
+ return percent ;
414
+ }
415
+
355
416
static u32 phy_pcs_tx_swing_full_from_property (u32 percent )
356
417
{
357
418
percent = min (percent , 100U );
@@ -362,17 +423,27 @@ static u32 phy_pcs_tx_swing_full_from_property(u32 percent)
362
423
static void imx8m_get_phy_tuning_data (struct imx8mq_usb_phy * imx_phy )
363
424
{
364
425
struct device * dev = imx_phy -> phy -> dev .parent ;
426
+ bool is_imx95 = false;
427
+
428
+ if (device_is_compatible (dev , "fsl,imx95-usb-phy" ))
429
+ is_imx95 = true;
365
430
366
431
if (device_property_read_u32 (dev , "fsl,phy-tx-vref-tune-percent" ,
367
432
& imx_phy -> tx_vref_tune ))
368
433
imx_phy -> tx_vref_tune = PHY_TUNE_DEFAULT ;
434
+ else if (is_imx95 )
435
+ imx_phy -> tx_vref_tune =
436
+ imx95_phy_tx_vref_tune_from_property (imx_phy -> tx_vref_tune );
369
437
else
370
438
imx_phy -> tx_vref_tune =
371
439
phy_tx_vref_tune_from_property (imx_phy -> tx_vref_tune );
372
440
373
441
if (device_property_read_u32 (dev , "fsl,phy-tx-rise-tune-percent" ,
374
442
& imx_phy -> tx_rise_tune ))
375
443
imx_phy -> tx_rise_tune = PHY_TUNE_DEFAULT ;
444
+ else if (is_imx95 )
445
+ imx_phy -> tx_rise_tune =
446
+ imx95_phy_tx_rise_tune_from_property (imx_phy -> tx_rise_tune );
376
447
else
377
448
imx_phy -> tx_rise_tune =
378
449
phy_tx_rise_tune_from_property (imx_phy -> tx_rise_tune );
@@ -394,6 +465,9 @@ static void imx8m_get_phy_tuning_data(struct imx8mq_usb_phy *imx_phy)
394
465
if (device_property_read_u32 (dev , "fsl,phy-comp-dis-tune-percent" ,
395
466
& imx_phy -> comp_dis_tune ))
396
467
imx_phy -> comp_dis_tune = PHY_TUNE_DEFAULT ;
468
+ else if (is_imx95 )
469
+ imx_phy -> comp_dis_tune =
470
+ imx95_phy_comp_dis_tune_from_property (imx_phy -> comp_dis_tune );
397
471
else
398
472
imx_phy -> comp_dis_tune =
399
473
phy_comp_dis_tune_from_property (imx_phy -> comp_dis_tune );
0 commit comments