Skip to content

Commit 6ae9f50

Browse files
xdarklightgregkh
authored andcommitted
usb: host: xhci-mtk: remove custom USB PHY handling
The new PHY wrapper is now wired up in the core HCD code. This means that PHYs are now controlled (initialized, enabled, disabled, exited) without requiring any host-driver specific code. Remove the custom USB PHY handling from the xhci-mtk driver as the core HCD code now handles this. Signed-off-by: Martin Blumenstingl <[email protected]> Tested-by: Sean Wang <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 178a0bc commit 6ae9f50

File tree

1 file changed

+2
-96
lines changed

1 file changed

+2
-96
lines changed

drivers/usb/host/xhci-mtk.c

Lines changed: 2 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/mfd/syscon.h>
1515
#include <linux/module.h>
1616
#include <linux/of.h>
17-
#include <linux/phy/phy.h>
1817
#include <linux/platform_device.h>
1918
#include <linux/pm_runtime.h>
2019
#include <linux/regmap.h>
@@ -352,62 +351,6 @@ static const struct xhci_driver_overrides xhci_mtk_overrides __initconst = {
352351

353352
static struct hc_driver __read_mostly xhci_mtk_hc_driver;
354353

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-
411354
static int xhci_mtk_ldos_enable(struct xhci_hcd_mtk *mtk)
412355
{
413356
int ret;
@@ -488,8 +431,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
488431
struct xhci_hcd *xhci;
489432
struct resource *res;
490433
struct usb_hcd *hcd;
491-
struct phy *phy;
492-
int phy_num;
493434
int ret = -ENODEV;
494435
int irq;
495436

@@ -529,16 +470,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
529470
return ret;
530471
}
531472

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-
}
542473
pm_runtime_enable(dev);
543474
pm_runtime_get_sync(dev);
544475
device_enable_async_suspend(dev);
@@ -596,23 +527,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
596527
mtk->has_ippc = false;
597528
}
598529

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-
616530
device_init_wakeup(dev, true);
617531

618532
xhci = hcd_to_xhci(hcd);
@@ -630,7 +544,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)
630544
dev_name(dev), hcd);
631545
if (!xhci->shared_hcd) {
632546
ret = -ENOMEM;
633-
goto power_off_phys;
547+
goto disable_device_wakeup;
634548
}
635549

636550
ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
@@ -653,13 +567,9 @@ static int xhci_mtk_probe(struct platform_device *pdev)
653567
xhci_mtk_sch_exit(mtk);
654568
usb_put_hcd(xhci->shared_hcd);
655569

656-
power_off_phys:
657-
xhci_mtk_phy_power_off(mtk);
570+
disable_device_wakeup:
658571
device_init_wakeup(dev, false);
659572

660-
exit_phys:
661-
xhci_mtk_phy_exit(mtk);
662-
663573
put_usb2_hcd:
664574
usb_put_hcd(hcd);
665575

@@ -682,8 +592,6 @@ static int xhci_mtk_remove(struct platform_device *dev)
682592
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
683593

684594
usb_remove_hcd(xhci->shared_hcd);
685-
xhci_mtk_phy_power_off(mtk);
686-
xhci_mtk_phy_exit(mtk);
687595
device_init_wakeup(&dev->dev, false);
688596

689597
usb_remove_hcd(hcd);
@@ -718,7 +626,6 @@ static int __maybe_unused xhci_mtk_suspend(struct device *dev)
718626
del_timer_sync(&xhci->shared_hcd->rh_timer);
719627

720628
xhci_mtk_host_disable(mtk);
721-
xhci_mtk_phy_power_off(mtk);
722629
xhci_mtk_clks_disable(mtk);
723630
usb_wakeup_set(mtk, true);
724631
return 0;
@@ -732,7 +639,6 @@ static int __maybe_unused xhci_mtk_resume(struct device *dev)
732639

733640
usb_wakeup_set(mtk, false);
734641
xhci_mtk_clks_enable(mtk);
735-
xhci_mtk_phy_power_on(mtk);
736642
xhci_mtk_host_enable(mtk);
737643

738644
xhci_dbg(xhci, "%s: restart port polling\n", __func__);

0 commit comments

Comments
 (0)