From patchwork Thu Oct 8 00:48:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 7348131 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 6A75BBEEA4 for ; Thu, 8 Oct 2015 00:49:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F26920615 for ; Thu, 8 Oct 2015 00:49:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93A8920608 for ; Thu, 8 Oct 2015 00:49:41 +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 1ZjzOv-0005xF-AS; Thu, 08 Oct 2015 00:49:41 +0000 Received: from mail-pa0-x230.google.com ([2607:f8b0:400e:c03::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZjzOr-0005q6-Sj for linux-rockchip@lists.infradead.org; Thu, 08 Oct 2015 00:49:39 +0000 Received: by pacfv12 with SMTP id fv12so37216962pac.2 for ; Wed, 07 Oct 2015 17:49:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5oPscyCU/l0JEvDgufqQCRDgcF5tCJblZPaS6YLppJg=; b=ZV0stahepd65gOaXr4msqcNHzFRLMhnIXRP6dxuuXSJTbNukzYbAbwHm94MLqDFrYa QZROesgbKEhgabyR3MnhcABNAARjmXGyDKhewMcxYvp/UjDQE4pwo+hYK6tyrUsvVtam VzmCAcFoEjsa9wAdczWvj+ZvmSftHdPqgYsO4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5oPscyCU/l0JEvDgufqQCRDgcF5tCJblZPaS6YLppJg=; b=Nwm2IYC9Pt9koh6CaWfbDQJyUssWQTBstFArefHxxXz9l4K+Bw+BOvkYeZFcuEolM1 SzfuxtEGiwqQk0ZCFM0cRHdflgrxsaOJboC8oOOUDyGrOnfEDwXPZr3Oy/A7AmszzILy T3u7ju32L5RWpCXA7oFXoGIgwHbA7T/Lv6FtBsBdFu0EZZqRlQ9MzLk/4Vd+czm50HYQ fDHEV2PDIpzDltJ6mvEjq4GRCtxjNtj34ima6iTxX1XxhTPep6s3A1hDjUYHSWjE6rux 1xBnL8VjMHa6//8ot0x4Pa8UUs2jupAJSd7t3yU2eSHV9tn321OvGf6L2/6zuIyAcg8k taYQ== X-Gm-Message-State: ALoCoQmVMdXu1ECi6j6xGXxerUKpN+WjkjFMbPRuradUxEhufqGMY0Kv5I8IKgpFSJUY+d9numdI X-Received: by 10.67.3.167 with SMTP id bx7mr4537505pad.47.1444265355833; Wed, 07 Oct 2015 17:49:15 -0700 (PDT) Received: from tictac.mtv.corp.google.com ([172.22.65.76]) by smtp.gmail.com with ESMTPSA id fe8sm42011024pab.40.2015.10.07.17.49.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Oct 2015 17:49:15 -0700 (PDT) From: Douglas Anderson To: John Youn Subject: [PATCH 1/5] usb: dwc2: Restore GUSBCFG in dwc2_get_hwparams() Date: Wed, 7 Oct 2015 17:48:37 -0700 Message-Id: <1444265321-16768-2-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 In-Reply-To: <1444265321-16768-1-git-send-email-dianders@chromium.org> References: <1444265321-16768-1-git-send-email-dianders@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151007_174938_036206_F980AF8E X-CRM114-Status: GOOD ( 11.53 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Heiko=20St=C3=BCbner?= , johnyoun@synopsys.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, Douglas Anderson , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Yunzhi Li , Julius Werner MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 Previously dwc2_get_hwparams() was changing GUSBCFG and not putting it back the way it was (specifically it set and cleared FORCEHOSTMODE). Since we want to move dwc2_core_reset() _before_ dwc2_get_hwparams() we should make sure dwc2_get_hwparams() isn't messing with things in a permanent way. Since we're now looking at GUSBCFG, it's obvious that we shouldn't need all the extra delays if FORCEHOSTMODE was already set. This will avoid some delays for any ports that have forced host mode. Signed-off-by: Douglas Anderson --- drivers/usb/dwc2/core.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index bf5e951..43c8bf4 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -3097,18 +3097,20 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg) /* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */ gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG); - gusbcfg |= GUSBCFG_FORCEHOSTMODE; - dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG); - usleep_range(100000, 150000); + if (!(gusbcfg & GUSBCFG_FORCEHOSTMODE)) { + dwc2_writel(gusbcfg | GUSBCFG_FORCEHOSTMODE, + hsotg->regs + GUSBCFG); + usleep_range(100000, 150000); + } gnptxfsiz = dwc2_readl(hsotg->regs + GNPTXFSIZ); hptxfsiz = dwc2_readl(hsotg->regs + HPTXFSIZ); dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz); dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz); - gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG); - gusbcfg &= ~GUSBCFG_FORCEHOSTMODE; - dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG); - usleep_range(100000, 150000); + if (!(gusbcfg & GUSBCFG_FORCEHOSTMODE)) { + dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG); + usleep_range(100000, 150000); + } /* hwcfg2 */ hw->op_mode = (hwcfg2 & GHWCFG2_OP_MODE_MASK) >>