From patchwork Thu Aug 7 19:48:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 4692581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3A8DEC0338 for ; Thu, 7 Aug 2014 19:50:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6DA7620160 for ; Thu, 7 Aug 2014 19:50:58 +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 A4C8D20145 for ; Thu, 7 Aug 2014 19:50:57 +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 1XFTgD-0000wZ-4G; Thu, 07 Aug 2014 19:48:53 +0000 Received: from mail-pd0-f202.google.com ([209.85.192.202]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XFTg8-0000qH-MP for linux-arm-kernel@lists.infradead.org; Thu, 07 Aug 2014 19:48:49 +0000 Received: by mail-pd0-f202.google.com with SMTP id w10so1169684pde.3 for ; Thu, 07 Aug 2014 12:48:26 -0700 (PDT) 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; bh=9Gi8G02cJGfJQWcitvluNgb8XtyBITIfnCJFSE3Pk28=; b=icjsUsI05qYylYUKfuwSGXli526+zSOO1FUu4EiCIoM9rUJxqjqMjqM++njd9KgUiW 653uNSCw05Jo8/j2kgUDI2uMpP8TG0I/EEax1clqwj8oHhSr27f9RbSkwCi90KmdZVFz 1xmVwpvr1WhjaFCP6pGPp2Ia4z+3iP6AlHOGUOH4DvV5vwvT7dFSyg1lwENUcp8EioXr ZoruMmJLPFVpmtcZroVDZeQYBbCdTKkTLZs9+GUNyc5jtfokfJT8Z1zkhoALgsU887Ga Q6zfTfyEBCnDpGs6CZeB/xjo/jtcflq2gMeNw86wPvfD+wtUN2pLoLLEg3Zjp9oiNx2b g0sQ== X-Gm-Message-State: ALoCoQmbyKTsWzz1tFE5DgAdSPuZUHRmTmuic2lpbAilkysxdxnWeTuXSp/XRzvPPJyfGU6+FLhA X-Received: by 10.68.222.194 with SMTP id qo2mr10193125pbc.6.1407440906282; Thu, 07 Aug 2014 12:48:26 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id a66si337183yhg.7.2014.08.07.12.48.26 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Aug 2014 12:48:26 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.162.15]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 165E431C1F4; Thu, 7 Aug 2014 12:48:26 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id A5F28806D7; Thu, 7 Aug 2014 12:48:25 -0700 (PDT) From: Doug Anderson To: Greg Kroah-Hartman , Paul Zimmerman Subject: [PATCH] usb: dwc2: Read GNPTXFSIZ when in forced HOST mode. Date: Thu, 7 Aug 2014 12:48:11 -0700 Message-Id: <1407440891-29295-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.0.0.526.g5318336 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140807_124848_745947_127A6911 X-CRM114-Status: UNSURE ( 9.80 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.0 (--) Cc: Heiko Stuebner , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Doug Anderson , Kever Yang , Dinh Nguyen , Sonny Rao , paulz@synopsys.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,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 The documentation for GNPTXFSIZ says that "For host mode, this field is always valid." Since we're already switching to host mode for HPTXFSIZ, let's also read GNPTXFSIZ in host mode. On an rk3288 SoC, without this change we see this at bootup: dwc2 ff580000.usb: gnptxfsiz=00100400 dwc2 ff580000.usb: 128 invalid for host_nperio_tx_fifo_size. Check HW configuration. After this change we see: dwc2 ff580000.usb: gnptxfsiz=04000400 Signed-off-by: Doug Anderson Acked-by: Paul Zimmerman Reviewed-by: Kever Yang --- drivers/usb/dwc2/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 27d2c9b..c184ed43 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -2674,23 +2674,23 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg) hwcfg2 = readl(hsotg->regs + GHWCFG2); hwcfg3 = readl(hsotg->regs + GHWCFG3); hwcfg4 = readl(hsotg->regs + GHWCFG4); - gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ); grxfsiz = readl(hsotg->regs + GRXFSIZ); dev_dbg(hsotg->dev, "hwcfg1=%08x\n", hwcfg1); dev_dbg(hsotg->dev, "hwcfg2=%08x\n", hwcfg2); dev_dbg(hsotg->dev, "hwcfg3=%08x\n", hwcfg3); dev_dbg(hsotg->dev, "hwcfg4=%08x\n", hwcfg4); - dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz); dev_dbg(hsotg->dev, "grxfsiz=%08x\n", grxfsiz); - /* Force host mode to get HPTXFSIZ exact power on value */ + /* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */ gusbcfg = readl(hsotg->regs + GUSBCFG); gusbcfg |= GUSBCFG_FORCEHOSTMODE; writel(gusbcfg, hsotg->regs + GUSBCFG); usleep_range(100000, 150000); + gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ); hptxfsiz = readl(hsotg->regs + HPTXFSIZ); + dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz); dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz); gusbcfg = readl(hsotg->regs + GUSBCFG); gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;