From patchwork Thu Jan 15 19:21:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Zimmerman X-Patchwork-Id: 5642061 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DB9E6C058D for ; Thu, 15 Jan 2015 19:22:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E920720172 for ; Thu, 15 Jan 2015 19:22:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0A2D52013D for ; Thu, 15 Jan 2015 19:22:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YBpzk-0002lr-4v; Thu, 15 Jan 2015 19:22:16 +0000 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YBpzg-0002Xq-1v for linux-rockchip@lists.infradead.org; Thu, 15 Jan 2015 19:22:13 +0000 Received: from dc8secmta2.synopsys.com (dc8secmta2.synopsys.com [10.13.218.202]) by smtprelay.synopsys.com (Postfix) with ESMTP id EE85C24E091C; Thu, 15 Jan 2015 11:21:47 -0800 (PST) Received: from dc8secmta2.internal.synopsys.com (dc8secmta2.internal.synopsys.com [127.0.0.1]) by dc8secmta2.internal.synopsys.com (Service) with ESMTP id E12D1A4112; Thu, 15 Jan 2015 11:21:47 -0800 (PST) Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by dc8secmta2.internal.synopsys.com (Service) with ESMTP id 9E99DA4102; Thu, 15 Jan 2015 11:21:47 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 883E480E; Thu, 15 Jan 2015 11:21:47 -0800 (PST) Received: from us01wehtc1.internal.synopsys.com (us01wehtc1.internal.synopsys.com [10.12.239.235]) by mailhost.synopsys.com (Postfix) with ESMTP id 2FB44807; Thu, 15 Jan 2015 11:21:47 -0800 (PST) Received: from US01WEMBX2.internal.synopsys.com ([fe80::e4b6:5520:9c0d:250b]) by us01wehtc1.internal.synopsys.com ([::1]) with mapi id 14.03.0195.001; Thu, 15 Jan 2015 11:21:46 -0800 From: Paul Zimmerman To: Felipe Balbi , Kever Yang Subject: [PATCH] Revert "usb: dwc2: add bus suspend/resume for dwc2" Thread-Topic: [PATCH] Revert "usb: dwc2: add bus suspend/resume for dwc2" Thread-Index: AdAw+H1ni/7Lz4jATrSNTqNBjHd7JQ== Date: Thu, 15 Jan 2015 19:21:46 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.13.184.19] MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150115_112212_345015_749BD74D X-CRM114-Status: GOOD ( 10.90 ) X-Spam-Score: -0.0 (/) Cc: "linux-rockchip@lists.infradead.org" , "Dinh Nguyen \(dinguyen@opensource.altera.com\)" , "linux-usb@vger.kernel.org" , Doug Anderson , "linux-kernel@vger.kernel.org" X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- Based on Felipe's testing/next branch. 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 a0cd9db..755e16b 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) } } -static void dwc2_port_resume(struct dwc2_hsotg *hsotg) -{ - u32 hprt0; - - /* After clear the Stop PHY clock bit, we should wait for a moment - * for PLL work stable with clock output. - */ - writel(0, hsotg->regs + PCGCTL); - usleep_range(2000, 4000); - - hprt0 = dwc2_read_hprt0(hsotg); - hprt0 |= HPRT0_RES; - writel(hprt0, hsotg->regs + HPRT0); - hprt0 &= ~HPRT0_SUSP; - /* according to USB2.0 Spec 7.1.7.7, the host must send the resume - * signal for at least 20ms - */ - usleep_range(20000, 25000); - - hprt0 &= ~HPRT0_RES; - writel(hprt0, hsotg->regs + HPRT0); - hsotg->lx_state = DWC2_L0; -} - /* Handles hub class-specific requests */ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, u16 wvalue, u16 windex, char *buf, u16 wlength) @@ -1542,7 +1518,17 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, case USB_PORT_FEAT_SUSPEND: dev_dbg(hsotg->dev, "ClearPortFeature USB_PORT_FEAT_SUSPEND\n"); - dwc2_port_resume(hsotg); + writel(0, hsotg->regs + PCGCTL); + usleep_range(20000, 40000); + + hprt0 = dwc2_read_hprt0(hsotg); + hprt0 |= HPRT0_RES; + writel(hprt0, hsotg->regs + HPRT0); + hprt0 &= ~HPRT0_SUSP; + usleep_range(100000, 150000); + + hprt0 &= ~HPRT0_RES; + writel(hprt0, hsotg->regs + HPRT0); break; case USB_PORT_FEAT_POWER: @@ -2315,55 +2301,6 @@ static void _dwc2_hcd_stop(struct usb_hcd *hcd) usleep_range(1000, 3000); } -static int _dwc2_hcd_suspend(struct usb_hcd *hcd) -{ - struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd); - u32 hprt0; - - if (!((hsotg->op_state == OTG_STATE_B_HOST) || - (hsotg->op_state == OTG_STATE_A_HOST))) - return 0; - - /* TODO: We get into suspend from 'on' state, maybe we need to do - * something if we get here from DWC2_L1(LPM sleep) state one day. - */ - if (hsotg->lx_state != DWC2_L0) - return 0; - - hprt0 = dwc2_read_hprt0(hsotg); - if (hprt0 & HPRT0_CONNSTS) { - dwc2_port_suspend(hsotg, 1); - } else { - u32 pcgctl = readl(hsotg->regs + PCGCTL); - - pcgctl |= PCGCTL_STOPPCLK; - writel(pcgctl, hsotg->regs + PCGCTL); - } - - return 0; -} - -static int _dwc2_hcd_resume(struct usb_hcd *hcd) -{ - struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd); - u32 hprt0; - - if (!((hsotg->op_state == OTG_STATE_B_HOST) || - (hsotg->op_state == OTG_STATE_A_HOST))) - return 0; - - if (hsotg->lx_state != DWC2_L2) - return 0; - - hprt0 = dwc2_read_hprt0(hsotg); - if ((hprt0 & HPRT0_CONNSTS) && (hprt0 & HPRT0_SUSP)) - dwc2_port_resume(hsotg); - else - writel(0, hsotg->regs + PCGCTL); - - return 0; -} - /* Returns the current frame number */ static int _dwc2_hcd_get_frame_number(struct usb_hcd *hcd) { @@ -2734,9 +2671,6 @@ static struct hc_driver dwc2_hc_driver = { .hub_status_data = _dwc2_hcd_hub_status_data, .hub_control = _dwc2_hcd_hub_control, .clear_tt_buffer_complete = _dwc2_hcd_clear_tt_buffer_complete, - - .bus_suspend = _dwc2_hcd_suspend, - .bus_resume = _dwc2_hcd_resume, }; /*