From patchwork Fri Jan 29 02:20:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 8157581 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 C5B409FC36 for ; Fri, 29 Jan 2016 02:21:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6F4A2037C for ; Fri, 29 Jan 2016 02:21:25 +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 D59F420328 for ; Fri, 29 Jan 2016 02:21:24 +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 1aOyge-0006ty-EY; Fri, 29 Jan 2016 02:21:24 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOygS-0006oX-0m for linux-rockchip@bombadil.infradead.org; Fri, 29 Jan 2016 02:21:12 +0000 Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]) by merlin.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1aOygP-00080C-TZ for linux-rockchip@lists.infradead.org; Fri, 29 Jan 2016 02:21:11 +0000 Received: by mail-pf0-x235.google.com with SMTP id x125so33722722pfb.0 for ; Thu, 28 Jan 2016 18:20:48 -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:in-reply-to:references; bh=EO3NpZMYaK26R+wusU4vQtsUssMrGJULxQTciwJxsTY=; b=PcAg6cTcZBsw+azUJ13NI5TDquUEqHODpdglmg1wKzFRF0Na0Vq2bRULpFcm7kIn6g i/vRhIHcADjr1IYwNhgfZiKWJmWz69YSF6I2aliJBa5hWuvUJUMolWhUR4AnweiJoajO 7+4pRyf5a83i7jaWIbyqzJoBbWRc+FfvzSBW0= 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=EO3NpZMYaK26R+wusU4vQtsUssMrGJULxQTciwJxsTY=; b=NmL9bbh2OGfMY5Aq693qwkKcJOD7r2EGPI/ibDGiy6dF/W6J8SSiKthdX8FREpigTF Gt6eF8I4rNGIm37e5ioW+jL8TKVwT6CbEPGLMsxEBmVb9mQaRSTqFwjvm2P/pWA9fcvU kQIF5Pjez3oErGH37e7XvESCZDrUtvawW60OhfJA7wq17NGGzE2NEJqXF+oZY6v4jl/x u3zZy/lKuxGCpSHc8g1hcRYTWD1EyNGSDU3wJky2r340IGrjIiKhc5T95yPOAhg8b3Ow 6Jtc5U5Gflvu6gzSJWtfmMcR8r6feoYjh+jbqpnkADg98WBM6od6bIEkasqzkH2OMwdj JS7g== X-Gm-Message-State: AG10YOTe1mno9Jl7plrVbA/zan6OhXJ8hVMShbu2ERPeK7Vwsa87VPecX4dJJAaVJfqjNQ== X-Received: by 10.98.64.27 with SMTP id n27mr9727489pfa.58.1454034047466; Thu, 28 Jan 2016 18:20:47 -0800 (PST) Received: from tictac.mtv.corp.google.com ([172.22.65.76]) by smtp.gmail.com with ESMTPSA id ux2sm19314864pac.46.2016.01.28.18.20.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Jan 2016 18:20:46 -0800 (PST) From: Douglas Anderson To: John Youn , balbi@ti.com, kever.yang@rock-chips.com Subject: [PATCH v6 10/22] usb: dwc2: host: Properly set the HFIR Date: Thu, 28 Jan 2016 18:20:01 -0800 Message-Id: <1454034013-24657-11-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1454034013-24657-1-git-send-email-dianders@chromium.org> References: <1454034013-24657-1-git-send-email-dianders@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160128_212110_091639_4AD71BE2 X-CRM114-Status: GOOD ( 13.78 ) 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, stefan.wahren@i2se.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, linux-rpi-kernel@lists.infradead.org, gregory.herrero@intel.com, 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=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 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 --- Changes in v6: - Incorporated Properly set the HFIR patch to big series in v6 - Add Heiko's Tested-by. Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None 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 ed73b26818c0..a5db20f12ee4 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -2245,10 +2245,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; } /**