aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2011-09-30 03:58:50 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-04 13:25:56 -0400
commitaabb70752361a8b8ca44142a942a5bd133c4d304 (patch)
treeddc6da1f1a031834d9478cc85301c2d796da389a
parent26ceca9750260997ab82bb84dac122de1e441658 (diff)
usb: dwc3: gadget: allow clock gating to work
The dwc3 core has internal clock gating support. Let's allow that to happen by clearing the disable bit in GCTL register. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/dwc3/core.h6
-rw-r--r--drivers/usb/dwc3/gadget.c8
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index a763ba705bff..29a8e1679e12 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -161,6 +161,7 @@
161#define DWC3_GCTL_CORESOFTRESET (1 << 11) 161#define DWC3_GCTL_CORESOFTRESET (1 << 11)
162#define DWC3_GCTL_SCALEDOWN(n) (n << 4) 162#define DWC3_GCTL_SCALEDOWN(n) (n << 4)
163#define DWC3_GCTL_DISSCRAMBLE (1 << 3) 163#define DWC3_GCTL_DISSCRAMBLE (1 << 3)
164#define DWC3_GCTL_DSBLCLKGTNG (1 << 0)
164 165
165/* Global USB2 PHY Configuration Register */ 166/* Global USB2 PHY Configuration Register */
166#define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31) 167#define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31)
@@ -170,6 +171,11 @@
170#define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 << 31) 171#define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 << 31)
171#define DWC3_GUSB3PIPECTL_SUSPHY (1 << 17) 172#define DWC3_GUSB3PIPECTL_SUSPHY (1 << 17)
172 173
174/* Global HWPARAMS1 Register */
175#define DWC3_GHWPARAMS1_EN_PWROPT(n) ((n & (3 << 24)) >> 24)
176#define DWC3_GHWPARAMS1_EN_PWROPT_NO 0
177#define DWC3_GHWPARAMS1_EN_PWROPT_CLK 1
178
173/* Device Configuration Register */ 179/* Device Configuration Register */
174#define DWC3_DCFG_DEVADDR(addr) ((addr) << 3) 180#define DWC3_DCFG_DEVADDR(addr) ((addr) << 3)
175#define DWC3_DCFG_DEVADDR_MASK DWC3_DCFG_DEVADDR(0x7f) 181#define DWC3_DCFG_DEVADDR_MASK DWC3_DCFG_DEVADDR(0x7f)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 8d8502373db6..fd1ac4dd5600 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1164,6 +1164,14 @@ static int dwc3_gadget_start(struct usb_gadget *g,
1164 reg &= ~DWC3_GCTL_DISSCRAMBLE; 1164 reg &= ~DWC3_GCTL_DISSCRAMBLE;
1165 reg |= DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_DEVICE); 1165 reg |= DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_DEVICE);
1166 1166
1167 switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams0)) {
1168 case DWC3_GHWPARAMS1_EN_PWROPT_CLK:
1169 reg &= ~DWC3_GCTL_DSBLCLKGTNG;
1170 break;
1171 default:
1172 dev_dbg(dwc->dev, "No power optimization available\n");
1173 }
1174
1167 /* 1175 /*
1168 * WORKAROUND: DWC3 revisions <1.90a have a bug 1176 * WORKAROUND: DWC3 revisions <1.90a have a bug
1169 * when The device fails to connect at SuperSpeed 1177 * when The device fails to connect at SuperSpeed