From patchwork Fri Jan 22 23:56:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 8094931 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 012669F440 for ; Fri, 22 Jan 2016 23:57:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 19B51205BB for ; Fri, 22 Jan 2016 23:57:05 +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 3F692205B8 for ; Fri, 22 Jan 2016 23:57:04 +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 1aMlZd-000161-M9; Fri, 22 Jan 2016 23:57:01 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aMlZZ-0000wR-Bo for linux-rockchip@lists.infradead.org; Fri, 22 Jan 2016 23:57:00 +0000 Received: by mail-pa0-x22d.google.com with SMTP id yy13so48920562pab.3 for ; Fri, 22 Jan 2016 15:56:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=fKoTO6XaXKqI4RA1KdPQGcnnAhiRrmK2cWRxzqVG/d8=; b=YBsnJZqWA31tWYJN7XQm21XJTyaGsdCBBI8s014tepywCz4bmEmuq6r6t5JozyvqQu 4o7S+YOM9eSgzEHHUO2TLWpQbZkpQYApV9uKUdWijzbWQBP2ICEAEc1JBsurzlIJvGIG vEy6hpof+kvAdTWedgvioqp0K1ePTfyBb/9wc= 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=fKoTO6XaXKqI4RA1KdPQGcnnAhiRrmK2cWRxzqVG/d8=; b=HoAO3XwqMKJs9+dPI9Fag6Evf1bLIEwxxmGVbkpXrX7D5gPOzyHwyQC/757jF7V+mg jOsuAm8/qdadZ2POecP7vujNKEk+2LyHGMqR71Je4YS1D8v9+dO4Dxc6cFey4wsq8g+U +q7iIoTvLR84N3rKWBsQ6jemwwdvLFSlzMGM5uGLHpv14aUSOVHGa9MfwGrdpUyQbL0F HHTX9Mx2iaxRN858IwH+Qfi0BPKbzVqXXWDyHKv2XWyWvwW5g9fuz6nDncGiTgZwcUJn 1N0IIVNThoHuV4VWCF+XDErtZrfBAJ36fiI/8ZnRr5Ae+2lMuR18YhckfqWyXGNu9Ehz ks0w== X-Gm-Message-State: AG10YOSp2QnpfuI6TM00p8t5Kk5IxtEol4ZzTxY9pbeUStD3Krb9FQ3PKTaeA1G4cgfdNQ== X-Received: by 10.66.234.226 with SMTP id uh2mr8380147pac.20.1453506995693; Fri, 22 Jan 2016 15:56:35 -0800 (PST) Received: from tictac.mtv.corp.google.com ([172.22.65.76]) by smtp.gmail.com with ESMTPSA id t70sm12191013pfi.8.2016.01.22.15.56.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Jan 2016 15:56:35 -0800 (PST) From: Douglas Anderson To: John Youn , balbi@ti.com, kever.yang@rock-chips.com Subject: [PATCH] usb: dwc2: host: Properly set the HFIR Date: Fri, 22 Jan 2016 15:56:10 -0800 Message-Id: <1453506971-31445-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160122_155657_446328_99ED2924 X-CRM114-Status: GOOD ( 12.03 ) 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: huangtao@rock-chips.com, gregory.herrero@intel.com, heiko@sntech.de, johnyoun@synopsys.com, gregkh@linuxfoundation.org, ming.lei@canonical.com, linux-usb@vger.kernel.org, Douglas Anderson , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, yousaf.kaukab@intel.com, stern@rowland.harvard.edu, william.wu@rock-chips.com, Julius Werner , dinguyen@opensource.altera.com 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,RP_MATCHES_RCVD,T_DKIM_INVALID,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 According to the most up to date version of the dwc2 databook, the FRINT field of the HFIR register should be programmed to: * 125 us * (PHY clock freq for HS) - 1 * 1000 us * (PHY clock freq for FS/LS) - 1 This is opposed to older versions of the doc that claimed it should be: * 125 us * (PHY clock freq for HS) * 1000 us * (PHY clock freq for FS/LS) In case you didn't spot it, the difference is the "- 1". Let's add the "- 1" to match the newest user manual. It's presumed that the "- 1" should have always been there and that this was always a documentation error. If some hardware needs the "- 1" and other hardware doesn't, we'll have to add a configuration parameter for it in the future. I checked things before and after this patch on rk3288 using a Total Phase Beagle 5000 analyzer. Before this patch, a low speed mouse shows constant Frame Timing Jitter errors. After this patch errors have gone away. Before this patch SOF packets move forward about 1 us per 4 ms. After this patch the SOF packets move backward about 1 us per 255 ms. Some specific SOF timestamps from the analyzer are below. Before: 6.603.790 6.603.916 6.604.041 6.604.166 ... 6.607.541 6.607.667 6.607.792 6.607.917 ... 6.611.417 6.611.543 6.611.668 6.611.793 After: 6.215.159 6.215.284 6.215.408 6.215.533 6.215.658 ... 6.470.658 6.470.783 6.470.907 ... 6.726.032 6.726.157 6.725.281 6.725.406 Signed-off-by: Douglas Anderson Tested-by: Heiko Stuebner --- drivers/usb/dwc2/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 39a0fa8a4c0a..c7798476e25b 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -2251,10 +2251,10 @@ u32 dwc2_calc_frame_interval(struct dwc2_hsotg *hsotg) if ((hprt0 & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT == HPRT0_SPD_HIGH_SPEED) /* High speed case */ - return 125 * clock; + return 125 * clock - 1; else /* FS/LS case */ - return 1000 * clock; + return 1000 * clock - 1; } /**