]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
usb: dwc3: gadget: drop dwc3 manual phy control
authorFelipe Balbi <balbi@ti.com>
Fri, 12 Jul 2013 10:19:52 +0000 (13:19 +0300)
committerFelipe Balbi <balbi@ti.com>
Mon, 29 Jul 2013 10:56:52 +0000 (13:56 +0300)
Recent versions of the core, can suspend and resume
the PHYs automatically, so we don't need to fiddle
with dwc3's Global PHY registers at all.

On versions prior to 1.94a this patch will mean
that we will never ask dwc3 to suspend the PHY.

This is an acceptable behavior or such old versions
of the core, specially considering that the only
chip known to have a version prior to 1.94a was
OMAP5 ES1.0 and that's not supported in mainline
kernel, because it was just a test spin of OMAP5.

Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc3/gadget.c

index 4ca5706f3a86bd77f424f4d0857b04dfed91f300..c7be039d85512b3764565f3a6ce15a8751774116 100644 (file)
@@ -2105,34 +2105,6 @@ static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc)
        dwc->setup_packet_pending = false;
 }
 
-static void dwc3_gadget_usb3_phy_suspend(struct dwc3 *dwc, int suspend)
-{
-       u32                     reg;
-
-       reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
-
-       if (suspend)
-               reg |= DWC3_GUSB3PIPECTL_SUSPHY;
-       else
-               reg &= ~DWC3_GUSB3PIPECTL_SUSPHY;
-
-       dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
-}
-
-static void dwc3_gadget_usb2_phy_suspend(struct dwc3 *dwc, int suspend)
-{
-       u32                     reg;
-
-       reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
-
-       if (suspend)
-               reg |= DWC3_GUSB2PHYCFG_SUSPHY;
-       else
-               reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
-
-       dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
-}
-
 static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
 {
        u32                     reg;
@@ -2173,13 +2145,6 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
        /* after reset -> Default State */
        usb_gadget_set_state(&dwc->gadget, USB_STATE_DEFAULT);
 
-       /* Recent versions support automatic phy suspend and don't need this */
-       if (dwc->revision < DWC3_REVISION_194A) {
-               /* Resume PHYs */
-               dwc3_gadget_usb2_phy_suspend(dwc, false);
-               dwc3_gadget_usb3_phy_suspend(dwc, false);
-       }
-
        if (dwc->gadget.speed != USB_SPEED_UNKNOWN)
                dwc3_disconnect_gadget(dwc);
 
@@ -2223,20 +2188,6 @@ static void dwc3_update_ram_clk_sel(struct dwc3 *dwc, u32 speed)
        dwc3_writel(dwc->regs, DWC3_GCTL, reg);
 }
 
-static void dwc3_gadget_phy_suspend(struct dwc3 *dwc, u8 speed)
-{
-       switch (speed) {
-       case USB_SPEED_SUPER:
-               dwc3_gadget_usb2_phy_suspend(dwc, true);
-               break;
-       case USB_SPEED_HIGH:
-       case USB_SPEED_FULL:
-       case USB_SPEED_LOW:
-               dwc3_gadget_usb3_phy_suspend(dwc, true);
-               break;
-       }
-}
-
 static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
 {
        struct dwc3_ep          *dep;
@@ -2312,12 +2263,6 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
                dwc3_writel(dwc->regs, DWC3_DCTL, reg);
        }
 
-       /* Recent versions support automatic phy suspend and don't need this */
-       if (dwc->revision < DWC3_REVISION_194A) {
-               /* Suspend unneeded PHY */
-               dwc3_gadget_phy_suspend(dwc, dwc->gadget.speed);
-       }
-
        dep = dwc->eps[0];
        ret = __dwc3_gadget_ep_enable(dep, &dwc3_gadget_ep0_desc, NULL, true);
        if (ret) {
@@ -2647,12 +2592,6 @@ int dwc3_gadget_init(struct dwc3 *dwc)
        reg |= DWC3_DCFG_LPM_CAP;
        dwc3_writel(dwc->regs, DWC3_DCFG, reg);
 
-       /* Enable USB2 LPM and automatic phy suspend only on recent versions */
-       if (dwc->revision >= DWC3_REVISION_194A) {
-               dwc3_gadget_usb2_phy_suspend(dwc, false);
-               dwc3_gadget_usb3_phy_suspend(dwc, false);
-       }
-
        ret = usb_add_gadget_udc(dwc->dev, &dwc->gadget);
        if (ret) {
                dev_err(dwc->dev, "failed to register udc\n");