From patchwork Thu Oct 8 00:48:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 7348151 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 633999F32B for ; Thu, 8 Oct 2015 00:49:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72AC420606 for ; Thu, 8 Oct 2015 00:49:43 +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 87BFD20613 for ; Thu, 8 Oct 2015 00:49:42 +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 1ZjzOw-0005xy-6O; Thu, 08 Oct 2015 00:49:42 +0000 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZjzOs-0005qX-MO for linux-rockchip@lists.infradead.org; Thu, 08 Oct 2015 00:49:39 +0000 Received: by pacfv12 with SMTP id fv12so37217327pac.2 for ; Wed, 07 Oct 2015 17:49:16 -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=Hhav2IUapGT5LZOzC3DgHgK2bNarHOaj2G6f3HHPI+0=; b=eusmncT4T7SCqT8UfoMYFvgaQMTtrxtxLEY7IB3VlnDl1EOZ2yjX5YgVGT43WxzFNm cEeGDaRnzoBO+9ZBqNEfzOhGVd4/YfwJ9hWdmwGov2xpcJvH+RemXW5NL2iBN1Z9xtKV d+7ZHU0G/c8ZWxSGR3LvWRlg59AR3VaJe/8JA= 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=Hhav2IUapGT5LZOzC3DgHgK2bNarHOaj2G6f3HHPI+0=; b=TZUXwPMQ02BX+3jGvYVNrIOvtIuzxiusZX+aMJl4ydNzPocCX3iaCyr+sJmv4MQqWx slAiVkWIK8GyYtPSoTH9aM7KhO08qyy3YfpZ1LV2CwEj7zN1BR3fD54blO3fuO9gTYdl 9jN0wVKR/7BcTQsgbSCJ2/xe9zCrp6iy5B4Pzd6OBEAVBuV8qvUWIaOBtWy0qCL6b15v E+O8LPgLx+Mq89oxqnw++JfNSRwCkH0GDkbdITBRN4cGg6W2MmD4LCPOF6bk422AoVz6 jvjup3FSy/h8VOyWd/l3qlzY+UoI8eK5E6RCaMo0j9DQhSyUjsWGW2MbeME7311m0VHt s32Q== X-Gm-Message-State: ALoCoQkg7zAq1cATZKBZ3luaNxkiMGdhnkkgFBTEs82BdvJDukPIgneSddGMUjmEEiSpK7gL1XQv X-Received: by 10.66.194.138 with SMTP id hw10mr4534212pac.71.1444265356704; Wed, 07 Oct 2015 17:49:16 -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:16 -0700 (PDT) From: Douglas Anderson To: John Youn Subject: [PATCH 2/5] usb: dwc2: reset dwc2 core before dwc2_get_hwparams() Date: Wed, 7 Oct 2015 17:48:38 -0700 Message-Id: <1444265321-16768-3-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_893512_BCDF489D X-CRM114-Status: GOOD ( 13.39 ) 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=ham 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 From: Yunzhi Li We initiate dwc2 usb controller in BIOS, dwc2_core_reset() should be called before dwc2_get_hwparams() to reset core registers to default value. Without this the FIFO setting might be incorrect because calculating FIFO size need power-on value of GRXFSIZ/GNPTXFSIZ/HPTXFSIZ registers. This patch could avoid warnning massage like in rk3288 platform: [ 2.074764] dwc2 ff580000.usb: 256 invalid for host_perio_tx_fifo_size. Check HW configuration. Signed-off-by: Yunzhi Li Signed-off-by: Douglas Anderson --- drivers/usb/dwc2/core.c | 2 +- drivers/usb/dwc2/core.h | 1 + drivers/usb/dwc2/platform.c | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 43c8bf4..f2002d2 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -481,7 +481,7 @@ static void dwc2_init_fs_ls_pclk_sel(struct dwc2_hsotg *hsotg) * Do core a soft reset of the core. Be careful with this because it * resets all the internal state machines of the core. */ -static int dwc2_core_reset(struct dwc2_hsotg *hsotg) +int dwc2_core_reset(struct dwc2_hsotg *hsotg) { u32 greset; int count = 0; diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index ebf2504..c258d19 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -862,6 +862,7 @@ enum dwc2_halt_status { * The following functions support initialization of the core driver component * and the DWC_otg controller */ +extern int dwc2_core_reset(struct dwc2_hsotg *hsotg); extern void dwc2_core_host_init(struct dwc2_hsotg *hsotg); extern int dwc2_enter_hibernation(struct dwc2_hsotg *hsotg); extern int dwc2_exit_hibernation(struct dwc2_hsotg *hsotg, bool restore); diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index b920e43..d27521c 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -254,6 +254,12 @@ static int dwc2_driver_probe(struct platform_device *dev) spin_lock_init(&hsotg->lock); mutex_init(&hsotg->init_mutex); + /* + * Reset before dwc2_get_hwparams() then it could get power-on real + * reset value form registers. + */ + dwc2_core_reset(hsotg); + /* Detect config values from hardware */ retval = dwc2_get_hwparams(hsotg); if (retval)