This is a note to let you know that I've just added the patch titled

    usb: dwc3: Enable usb2 LPM only when connected as usb2.0

to my usb git tree which can be found at
    git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From 2b758350af19db9a5c98241cf222c2e211d7a912 Mon Sep 17 00:00:00 2001
From: Pratyush Anand <[email protected]>
Date: Mon, 14 Jan 2013 15:59:31 +0530
Subject: usb: dwc3: Enable usb2 LPM only when connected as usb2.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Synopsys says:
The HIRD Threshold field must be set to ‘0’ when the device core is
operating in super speed mode.

This patch implements above statement.

Cc: <[email protected]> # v3.6 v3.7 v3.8
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Pratyush Anand <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
---
 drivers/usb/dwc3/gadget.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 0b92e98..113ec80 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2154,6 +2154,23 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 
*dwc)
                break;
        }
 
+       /* Enable USB2 LPM Capability */
+
+       if ((dwc->revision > DWC3_REVISION_194A)
+                       && (speed != DWC3_DCFG_SUPERSPEED)) {
+               reg = dwc3_readl(dwc->regs, DWC3_DCFG);
+               reg |= DWC3_DCFG_LPM_CAP;
+               dwc3_writel(dwc->regs, DWC3_DCFG, reg);
+
+               reg = dwc3_readl(dwc->regs, DWC3_DCTL);
+               reg &= ~(DWC3_DCTL_HIRD_THRES_MASK | DWC3_DCTL_L1_HIBER_EN);
+
+               /* TODO: This should be configurable */
+               reg |= DWC3_DCTL_HIRD_THRES(28);
+
+               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 */
@@ -2460,20 +2477,8 @@ int dwc3_gadget_init(struct dwc3 *dwc)
                        DWC3_DEVTEN_DISCONNEVTEN);
        dwc3_writel(dwc->regs, DWC3_DEVTEN, reg);
 
-       /* Enable USB2 LPM and automatic phy suspend only on recent versions */
+       /* automatic phy suspend only on recent versions */
        if (dwc->revision >= DWC3_REVISION_194A) {
-               reg = dwc3_readl(dwc->regs, DWC3_DCFG);
-               reg |= DWC3_DCFG_LPM_CAP;
-               dwc3_writel(dwc->regs, DWC3_DCFG, reg);
-
-               reg = dwc3_readl(dwc->regs, DWC3_DCTL);
-               reg &= ~(DWC3_DCTL_HIRD_THRES_MASK | DWC3_DCTL_L1_HIBER_EN);
-
-               /* TODO: This should be configurable */
-               reg |= DWC3_DCTL_HIRD_THRES(28);
-
-               dwc3_writel(dwc->regs, DWC3_DCTL, reg);
-
                dwc3_gadget_usb2_phy_suspend(dwc, false);
                dwc3_gadget_usb3_phy_suspend(dwc, false);
        }
-- 
1.8.1.rc1.5.g7e0651a


--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to