Received: by 10.213.65.68 with SMTP id h4csp3245022imn; Mon, 9 Apr 2018 17:21:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+q7T9soN9lkmtb9LO41zJSyw7s9UZacP/FSBlvgfr4BH3Zv98oJp1A6PJUCFF8GK1qbY/o X-Received: by 10.99.117.12 with SMTP id q12mr12953953pgc.395.1523319693074; Mon, 09 Apr 2018 17:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523319693; cv=none; d=google.com; s=arc-20160816; b=0mCsPsaPB/Sdr8+GDn2bzMrw8rE0R/1S8bMFO9B+CVa4Y8Dk9wb+pqEMAYUpTv2Fou rIjCmRF4cC6A2rReNfz2YrRJ4Qrv6fqeDjN8/PHx0P9nQYBALiw194ALtyOBZHmsJIXi KxUs0G9dnzD3Qwq8oeBX5Zlh4BXRPxinFl4H96GKh2TE/KzO1337qgqT175iFYHWJyri rc8vdOgoWUlmP+80Ejin+CyDP6/d/V49zFKKZAChHZ3b1KS7StTKa9Ll6gU0i4pUY946 jxXWecj7WHlFbC26YIpUC1BPPjEw2Qmt5/TaL1tnuV8r+AQKD1lhTdnFq+2lVGG+nMQX G5xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=MglSacAcCxFDhrbYEw99COxIM8zRWq9KhZ4wSD7RQMk=; b=CZvc4R7Yb/1XNE/pfhgjN+jE8nQZaE8jGpzZA7aE8N7a18XoiotRsP6MtLTF3Q6jLT iu1kmncMkubPu5aKkVYN/5mu6FkdBxf8WyZOZDHplNhbANL0CqSPIvM5yaj8prDAGCoS 2FrwWx17KZCDBCgaIc3gs/lfMC97z+UJ3p0BUcJHb4JPxDievBQzOCIRej5M+EPsj8LY 3vhkT4Z2fpTYgbN3G60wNuezK76RPkZB4Hj/6/EeV4so40OoQTNq0Jmi6+GPm9brCpIp Jgg21Xn421rMlg9psPHz23k7TLhcAzgVDW8w0GHtv1GRcC1VEq6q8kRVfOcI8gqBHAmN NFKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziemianowicz.com header.s=somekey header.b=Z/Kt2Cwa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z69si1092792pfl.209.2018.04.09.17.20.56; Mon, 09 Apr 2018 17:21:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziemianowicz.com header.s=somekey header.b=Z/Kt2Cwa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751947AbeDJARQ (ORCPT + 99 others); Mon, 9 Apr 2018 20:17:16 -0400 Received: from sender-of-o52.zoho.com ([135.84.80.217]:21357 "EHLO sender-of-o52.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751629AbeDJARO (ORCPT ); Mon, 9 Apr 2018 20:17:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1523319412; s=somekey; d=ziemianowicz.com; i=marcin@ziemianowicz.com; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type; l=1170; bh=MglSacAcCxFDhrbYEw99COxIM8zRWq9KhZ4wSD7RQMk=; b=Z/Kt2CwaC2q+e+kX/tgZqwPG+t0auHvY1ZMAEqBw7sGQ19VIrdrwxsPklJbVmy4u sUxsHCSH+qYGxhpHpMp3t7SnwJYNfc5xSA/uVGozeL0nwz9sibraAEp8ZCJPzH8e4QJ ygDWACg59opR29aXMFyWQt612KY7FYId+JHeiCg0= Received: from hak8or (98.15.121.23 [98.15.121.23]) by mx.zohomail.com with SMTPS id 15233194120511004.612107987669; Mon, 9 Apr 2018 17:16:52 -0700 (PDT) Date: Mon, 9 Apr 2018 20:16:49 -0400 From: Marcin Ziemianowicz To: Boris Brezillon , Nicolas Ferre , Alexandre Belloni , Greg Kroah-Hartman Cc: Michael Turquette , Stephen Boyd , Alan Stern , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH v2 2/2] clk: at91: Fix for PLL set_rate changes not being actually written to PLL peripheral bits Message-ID: <20180410001649.GA62245@hak8or> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-ZohoMailClient: External Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a USB device is connected to the USB host port on the SAM9N12 then you get "-62" error which seems to indicate USB replies from the device are timing out. Looking around, I saw the USB bus was running at half speed. Going further, it seems that in ..._set_rate() the PLL wasn't actually being adjusted. Writing the multiplier and divider values to the peripheral fixes the bus running at half speed. Signed-off-by: Marcin Ziemianowicz --- drivers/clk/at91/clk-pll.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c index 534961766ae5..db7155fe9346 100644 --- a/drivers/clk/at91/clk-pll.c +++ b/drivers/clk/at91/clk-pll.c @@ -288,6 +288,14 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, pll->div = div; pll->mul = mul; + // Set the PLL as per above div and mil values. + regmap_update_bits(pll->regmap, AT91_CKGR_PLLBR, + AT91_PMC_DIV | AT91_PMC_MUL, + (div << 0) | (mul << 16)); + + pr_debug("clk-pll: setting new rate, (%lu hz / %u) * %u = %lu hz\n", + parent_rate, div, mul, rate); + return 0; } -- 2.17.0