diff options
| author | Paul Zimmerman <Paul.Zimmerman@synopsys.com> | 2015-01-15 14:21:46 -0500 |
|---|---|---|
| committer | Felipe Balbi <balbi@ti.com> | 2015-01-19 13:53:32 -0500 |
| commit | b0bb9bb6ce01e37e47db04a31fd93dbe2d2be3d3 (patch) | |
| tree | 81793e88ecc5be2d9067815408415a15ecee1178 /drivers/usb/dwc2 | |
| parent | 27f387059bedc3c4b3eb5b4c8bfe229dba59ce24 (diff) | |
Revert "usb: dwc2: add bus suspend/resume for dwc2"
This reverts commit 0cf884e819e05437287a668b9bfcc198bab6329c.
Even after applying the follow-on patch at
https://patchwork.kernel.org/patch/5325111
there are still problems with device connect on the Altera SOCFPGA
platform at least. One possible fix would be to add a whitelist
to enable suspend/resume on platforms where it does work correctly.
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc2')
| -rw-r--r-- | drivers/usb/dwc2/hcd.c | 88 |
1 files changed, 11 insertions, 77 deletions
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index a0cd9db6f4cd..755e16b9cbb3 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c | |||
| @@ -1473,30 +1473,6 @@ static void dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex) | |||
| 1473 | } | 1473 | } |
| 1474 | } | 1474 | } |
| 1475 | 1475 | ||
| 1476 | static void dwc2_port_resume(struct dwc2_hsotg *hsotg) | ||
| 1477 | { | ||
| 1478 | u32 hprt0; | ||
| 1479 | |||
| 1480 | /* After clear the Stop PHY clock bit, we should wait for a moment | ||
| 1481 | * for PLL work stable with clock output. | ||
| 1482 | */ | ||
| 1483 | writel(0, hsotg->regs + PCGCTL); | ||
| 1484 | usleep_range(2000, 4000); | ||
| 1485 | |||
| 1486 | hprt0 = dwc2_read_hprt0(hsotg); | ||
| 1487 | hprt0 |= HPRT0_RES; | ||
| 1488 | writel(hprt0, hsotg->regs + HPRT0); | ||
| 1489 | hprt0 &= ~HPRT0_SUSP; | ||
| 1490 | /* according to USB2.0 Spec 7.1.7.7, the host must send the resume | ||
| 1491 | * signal for at least 20ms | ||
| 1492 | */ | ||
| 1493 | usleep_range(20000, 25000); | ||
| 1494 | |||
| 1495 | hprt0 &= ~HPRT0_RES; | ||
| 1496 | writel(hprt0, hsotg->regs + HPRT0); | ||
| 1497 | hsotg->lx_state = DWC2_L0; | ||
| 1498 | } | ||
| 1499 | |||
| 1500 | /* Handles hub class-specific requests */ | 1476 | /* Handles hub class-specific requests */ |
| 1501 | static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, | 1477 | static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, |
| 1502 | u16 wvalue, u16 windex, char *buf, u16 wlength) | 1478 | u16 wvalue, u16 windex, char *buf, u16 wlength) |
| @@ -1542,7 +1518,17 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, | |||
| 1542 | case USB_PORT_FEAT_SUSPEND: | 1518 | case USB_PORT_FEAT_SUSPEND: |
| 1543 | dev_dbg(hsotg->dev, | 1519 | dev_dbg(hsotg->dev, |
| 1544 | "ClearPortFeature USB_PORT_FEAT_SUSPEND\n"); | 1520 | "ClearPortFeature USB_PORT_FEAT_SUSPEND\n"); |
| 1545 | dwc2_port_resume(hsotg); | 1521 | writel(0, hsotg->regs + PCGCTL); |
| 1522 | usleep_range(20000, 40000); | ||
| 1523 | |||
| 1524 | hprt0 = dwc2_read_hprt0(hsotg); | ||
| 1525 | hprt0 |= HPRT0_RES; | ||
| 1526 | writel(hprt0, hsotg->regs + HPRT0); | ||
| 1527 | hprt0 &= ~HPRT0_SUSP; | ||
| 1528 | usleep_range(100000, 150000); | ||
| 1529 | |||
| 1530 | hprt0 &= ~HPRT0_RES; | ||
| 1531 | writel(hprt0, hsotg->regs + HPRT0); | ||
| 1546 | break; | 1532 | break; |
| 1547 | 1533 | ||
| 1548 | case USB_PORT_FEAT_POWER: | 1534 | case USB_PORT_FEAT_POWER: |
| @@ -2315,55 +2301,6 @@ static void _dwc2_hcd_stop(struct usb_hcd *hcd) | |||
| 2315 | usleep_range(1000, 3000); | 2301 | usleep_range(1000, 3000); |
| 2316 | } | 2302 | } |
| 2317 | 2303 | ||
| 2318 | static int _dwc2_hcd_suspend(struct usb_hcd *hcd) | ||
| 2319 | { | ||
| 2320 | struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd); | ||
| 2321 | u32 hprt0; | ||
| 2322 | |||
| 2323 | if (!((hsotg->op_state == OTG_STATE_B_HOST) || | ||
| 2324 | (hsotg->op_state == OTG_STATE_A_HOST))) | ||
| 2325 | return 0; | ||
| 2326 | |||
| 2327 | /* TODO: We get into suspend from 'on' state, maybe we need to do | ||
| 2328 | * something if we get here from DWC2_L1(LPM sleep) state one day. | ||
| 2329 | */ | ||
| 2330 | if (hsotg->lx_state != DWC2_L0) | ||
| 2331 | return 0; | ||
| 2332 | |||
| 2333 | hprt0 = dwc2_read_hprt0(hsotg); | ||
| 2334 | if (hprt0 & HPRT0_CONNSTS) { | ||
| 2335 | dwc2_port_suspend(hsotg, 1); | ||
| 2336 | } else { | ||
| 2337 | u32 pcgctl = readl(hsotg->regs + PCGCTL); | ||
| 2338 | |||
| 2339 | pcgctl |= PCGCTL_STOPPCLK; | ||
| 2340 | writel(pcgctl, hsotg->regs + PCGCTL); | ||
| 2341 | } | ||
| 2342 | |||
| 2343 | return 0; | ||
| 2344 | } | ||
| 2345 | |||
| 2346 | static int _dwc2_hcd_resume(struct usb_hcd *hcd) | ||
| 2347 | { | ||
| 2348 | struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd); | ||
| 2349 | u32 hprt0; | ||
| 2350 | |||
| 2351 | if (!((hsotg->op_state == OTG_STATE_B_HOST) || | ||
| 2352 | (hsotg->op_state == OTG_STATE_A_HOST))) | ||
| 2353 | return 0; | ||
| 2354 | |||
| 2355 | if (hsotg->lx_state != DWC2_L2) | ||
| 2356 | return 0; | ||
| 2357 | |||
| 2358 | hprt0 = dwc2_read_hprt0(hsotg); | ||
| 2359 | if ((hprt0 & HPRT0_CONNSTS) && (hprt0 & HPRT0_SUSP)) | ||
| 2360 | dwc2_port_resume(hsotg); | ||
| 2361 | else | ||
| 2362 | writel(0, hsotg->regs + PCGCTL); | ||
| 2363 | |||
| 2364 | return 0; | ||
| 2365 | } | ||
| 2366 | |||
| 2367 | /* Returns the current frame number */ | 2304 | /* Returns the current frame number */ |
| 2368 | static int _dwc2_hcd_get_frame_number(struct usb_hcd *hcd) | 2305 | static int _dwc2_hcd_get_frame_number(struct usb_hcd *hcd) |
| 2369 | { | 2306 | { |
| @@ -2734,9 +2671,6 @@ static struct hc_driver dwc2_hc_driver = { | |||
| 2734 | .hub_status_data = _dwc2_hcd_hub_status_data, | 2671 | .hub_status_data = _dwc2_hcd_hub_status_data, |
| 2735 | .hub_control = _dwc2_hcd_hub_control, | 2672 | .hub_control = _dwc2_hcd_hub_control, |
| 2736 | .clear_tt_buffer_complete = _dwc2_hcd_clear_tt_buffer_complete, | 2673 | .clear_tt_buffer_complete = _dwc2_hcd_clear_tt_buffer_complete, |
| 2737 | |||
| 2738 | .bus_suspend = _dwc2_hcd_suspend, | ||
| 2739 | .bus_resume = _dwc2_hcd_resume, | ||
| 2740 | }; | 2674 | }; |
| 2741 | 2675 | ||
| 2742 | /* | 2676 | /* |
