14
14
#include <linux/mfd/syscon.h>
15
15
#include <linux/module.h>
16
16
#include <linux/of.h>
17
- #include <linux/phy/phy.h>
18
17
#include <linux/platform_device.h>
19
18
#include <linux/pm_runtime.h>
20
19
#include <linux/regmap.h>
@@ -352,62 +351,6 @@ static const struct xhci_driver_overrides xhci_mtk_overrides __initconst = {
352
351
353
352
static struct hc_driver __read_mostly xhci_mtk_hc_driver ;
354
353
355
- static int xhci_mtk_phy_init (struct xhci_hcd_mtk * mtk )
356
- {
357
- int i ;
358
- int ret ;
359
-
360
- for (i = 0 ; i < mtk -> num_phys ; i ++ ) {
361
- ret = phy_init (mtk -> phys [i ]);
362
- if (ret )
363
- goto exit_phy ;
364
- }
365
- return 0 ;
366
-
367
- exit_phy :
368
- for (; i > 0 ; i -- )
369
- phy_exit (mtk -> phys [i - 1 ]);
370
-
371
- return ret ;
372
- }
373
-
374
- static int xhci_mtk_phy_exit (struct xhci_hcd_mtk * mtk )
375
- {
376
- int i ;
377
-
378
- for (i = 0 ; i < mtk -> num_phys ; i ++ )
379
- phy_exit (mtk -> phys [i ]);
380
-
381
- return 0 ;
382
- }
383
-
384
- static int xhci_mtk_phy_power_on (struct xhci_hcd_mtk * mtk )
385
- {
386
- int i ;
387
- int ret ;
388
-
389
- for (i = 0 ; i < mtk -> num_phys ; i ++ ) {
390
- ret = phy_power_on (mtk -> phys [i ]);
391
- if (ret )
392
- goto power_off_phy ;
393
- }
394
- return 0 ;
395
-
396
- power_off_phy :
397
- for (; i > 0 ; i -- )
398
- phy_power_off (mtk -> phys [i - 1 ]);
399
-
400
- return ret ;
401
- }
402
-
403
- static void xhci_mtk_phy_power_off (struct xhci_hcd_mtk * mtk )
404
- {
405
- unsigned int i ;
406
-
407
- for (i = 0 ; i < mtk -> num_phys ; i ++ )
408
- phy_power_off (mtk -> phys [i ]);
409
- }
410
-
411
354
static int xhci_mtk_ldos_enable (struct xhci_hcd_mtk * mtk )
412
355
{
413
356
int ret ;
@@ -488,8 +431,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
488
431
struct xhci_hcd * xhci ;
489
432
struct resource * res ;
490
433
struct usb_hcd * hcd ;
491
- struct phy * phy ;
492
- int phy_num ;
493
434
int ret = - ENODEV ;
494
435
int irq ;
495
436
@@ -529,16 +470,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
529
470
return ret ;
530
471
}
531
472
532
- mtk -> num_phys = of_count_phandle_with_args (node ,
533
- "phys" , "#phy-cells" );
534
- if (mtk -> num_phys > 0 ) {
535
- mtk -> phys = devm_kcalloc (dev , mtk -> num_phys ,
536
- sizeof (* mtk -> phys ), GFP_KERNEL );
537
- if (!mtk -> phys )
538
- return - ENOMEM ;
539
- } else {
540
- mtk -> num_phys = 0 ;
541
- }
542
473
pm_runtime_enable (dev );
543
474
pm_runtime_get_sync (dev );
544
475
device_enable_async_suspend (dev );
@@ -596,23 +527,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
596
527
mtk -> has_ippc = false;
597
528
}
598
529
599
- for (phy_num = 0 ; phy_num < mtk -> num_phys ; phy_num ++ ) {
600
- phy = devm_of_phy_get_by_index (dev , node , phy_num );
601
- if (IS_ERR (phy )) {
602
- ret = PTR_ERR (phy );
603
- goto put_usb2_hcd ;
604
- }
605
- mtk -> phys [phy_num ] = phy ;
606
- }
607
-
608
- ret = xhci_mtk_phy_init (mtk );
609
- if (ret )
610
- goto put_usb2_hcd ;
611
-
612
- ret = xhci_mtk_phy_power_on (mtk );
613
- if (ret )
614
- goto exit_phys ;
615
-
616
530
device_init_wakeup (dev , true);
617
531
618
532
xhci = hcd_to_xhci (hcd );
@@ -630,7 +544,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)
630
544
dev_name (dev ), hcd );
631
545
if (!xhci -> shared_hcd ) {
632
546
ret = - ENOMEM ;
633
- goto power_off_phys ;
547
+ goto disable_device_wakeup ;
634
548
}
635
549
636
550
ret = usb_add_hcd (hcd , irq , IRQF_SHARED );
@@ -653,13 +567,9 @@ static int xhci_mtk_probe(struct platform_device *pdev)
653
567
xhci_mtk_sch_exit (mtk );
654
568
usb_put_hcd (xhci -> shared_hcd );
655
569
656
- power_off_phys :
657
- xhci_mtk_phy_power_off (mtk );
570
+ disable_device_wakeup :
658
571
device_init_wakeup (dev , false);
659
572
660
- exit_phys :
661
- xhci_mtk_phy_exit (mtk );
662
-
663
573
put_usb2_hcd :
664
574
usb_put_hcd (hcd );
665
575
@@ -682,8 +592,6 @@ static int xhci_mtk_remove(struct platform_device *dev)
682
592
struct xhci_hcd * xhci = hcd_to_xhci (hcd );
683
593
684
594
usb_remove_hcd (xhci -> shared_hcd );
685
- xhci_mtk_phy_power_off (mtk );
686
- xhci_mtk_phy_exit (mtk );
687
595
device_init_wakeup (& dev -> dev , false);
688
596
689
597
usb_remove_hcd (hcd );
@@ -718,7 +626,6 @@ static int __maybe_unused xhci_mtk_suspend(struct device *dev)
718
626
del_timer_sync (& xhci -> shared_hcd -> rh_timer );
719
627
720
628
xhci_mtk_host_disable (mtk );
721
- xhci_mtk_phy_power_off (mtk );
722
629
xhci_mtk_clks_disable (mtk );
723
630
usb_wakeup_set (mtk , true);
724
631
return 0 ;
@@ -732,7 +639,6 @@ static int __maybe_unused xhci_mtk_resume(struct device *dev)
732
639
733
640
usb_wakeup_set (mtk , false);
734
641
xhci_mtk_clks_enable (mtk );
735
- xhci_mtk_phy_power_on (mtk );
736
642
xhci_mtk_host_enable (mtk );
737
643
738
644
xhci_dbg (xhci , "%s: restart port polling\n" , __func__ );
0 commit comments