usb: ehci/ohci-platform: assigned hcd phy phandle at platform probe
authorFrank Wang <frank.wang@rock-chips.com>
Thu, 15 Dec 2016 02:50:54 +0000 (10:50 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 19 Dec 2016 08:53:42 +0000 (16:53 +0800)
In ehci/ohci-platform, phy_power_on() gets called twice at probe time,
one is at pdata->power_on(); another is in usb_add_hcd(). However,
phy_power_off() is only invoked one time when ehci/ohci-platform goes
to PM suspend. As a result, the phy power count become inconsistent.

This adds assigned phy phandle to hcd-phy at ehci/ohci-platform probe
time to prevent hcd invoking generic phy methods again when phy-cells
is 0 in DT.

Change-Id: I2f0cca622d31a46dea0b805b83b676cc78e4d67c
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
drivers/usb/host/ehci-platform.c
drivers/usb/host/ohci-platform.c

index 5756dc8..77bca46 100644 (file)
@@ -290,6 +290,8 @@ static int ehci_platform_probe(struct platform_device *dev)
        }
        hcd->rsrc_start = res_mem->start;
        hcd->rsrc_len = resource_size(res_mem);
+       if (priv->num_phys == 1)
+               hcd->phy = priv->phys[0];
 
        err = usb_add_hcd(hcd, irq, IRQF_SHARED);
        if (err)
index c2669f1..d7a4106 100644 (file)
@@ -250,6 +250,8 @@ static int ohci_platform_probe(struct platform_device *dev)
        }
        hcd->rsrc_start = res_mem->start;
        hcd->rsrc_len = resource_size(res_mem);
+       if (priv->num_phys == 1)
+               hcd->phy = priv->phys[0];
 
        err = usb_add_hcd(hcd, irq, IRQF_SHARED);
        if (err)