aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPratyush Anand <pratyush.anand@st.com>2013-01-14 05:29:31 -0500
committerFelipe Balbi <balbi@ti.com>2013-01-18 07:25:28 -0500
commit2b758350af19db9a5c98241cf222c2e211d7a912 (patch)
tree707ccd7ff07df28daa72a2d984df2fdaf789ace5 /drivers
parentd7668024b3b5f9563eab8dad66cb9a4b80f36ebf (diff)
usb: dwc3: Enable usb2 LPM only when connected as usb2.0
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: <stable@vger.kernel.org> # v3.6 v3.7 v3.8 Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Pratyush Anand <pratyush.anand@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/dwc3/gadget.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 0b92e982ac54..113ec80dcc26 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)
2154 break; 2154 break;
2155 } 2155 }
2156 2156
2157 /* Enable USB2 LPM Capability */
2158
2159 if ((dwc->revision > DWC3_REVISION_194A)
2160 && (speed != DWC3_DCFG_SUPERSPEED)) {
2161 reg = dwc3_readl(dwc->regs, DWC3_DCFG);
2162 reg |= DWC3_DCFG_LPM_CAP;
2163 dwc3_writel(dwc->regs, DWC3_DCFG, reg);
2164
2165 reg = dwc3_readl(dwc->regs, DWC3_DCTL);
2166 reg &= ~(DWC3_DCTL_HIRD_THRES_MASK | DWC3_DCTL_L1_HIBER_EN);
2167
2168 /* TODO: This should be configurable */
2169 reg |= DWC3_DCTL_HIRD_THRES(28);
2170
2171 dwc3_writel(dwc->regs, DWC3_DCTL, reg);
2172 }
2173
2157 /* Recent versions support automatic phy suspend and don't need this */ 2174 /* Recent versions support automatic phy suspend and don't need this */
2158 if (dwc->revision < DWC3_REVISION_194A) { 2175 if (dwc->revision < DWC3_REVISION_194A) {
2159 /* Suspend unneeded PHY */ 2176 /* Suspend unneeded PHY */
@@ -2460,20 +2477,8 @@ int dwc3_gadget_init(struct dwc3 *dwc)
2460 DWC3_DEVTEN_DISCONNEVTEN); 2477 DWC3_DEVTEN_DISCONNEVTEN);
2461 dwc3_writel(dwc->regs, DWC3_DEVTEN, reg); 2478 dwc3_writel(dwc->regs, DWC3_DEVTEN, reg);
2462 2479
2463 /* Enable USB2 LPM and automatic phy suspend only on recent versions */ 2480 /* automatic phy suspend only on recent versions */
2464 if (dwc->revision >= DWC3_REVISION_194A) { 2481 if (dwc->revision >= DWC3_REVISION_194A) {
2465 reg = dwc3_readl(dwc->regs, DWC3_DCFG);
2466 reg |= DWC3_DCFG_LPM_CAP;
2467 dwc3_writel(dwc->regs, DWC3_DCFG, reg);
2468
2469 reg = dwc3_readl(dwc->regs, DWC3_DCTL);
2470 reg &= ~(DWC3_DCTL_HIRD_THRES_MASK | DWC3_DCTL_L1_HIBER_EN);
2471
2472 /* TODO: This should be configurable */
2473 reg |= DWC3_DCTL_HIRD_THRES(28);
2474
2475 dwc3_writel(dwc->regs, DWC3_DCTL, reg);
2476
2477 dwc3_gadget_usb2_phy_suspend(dwc, false); 2482 dwc3_gadget_usb2_phy_suspend(dwc, false);
2478 dwc3_gadget_usb3_phy_suspend(dwc, false); 2483 dwc3_gadget_usb3_phy_suspend(dwc, false);
2479 } 2484 }