Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5639828img; Wed, 27 Mar 2019 12:14:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLeMNZBboS6G5c3quCfTVlSWGJJuTHSEESGQmlmKN2wJWdnHBd+Jj43eKsx8vZA/kuaRfp X-Received: by 2002:a17:902:8ec1:: with SMTP id x1mr26952953plo.328.1553714065854; Wed, 27 Mar 2019 12:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714065; cv=none; d=google.com; s=arc-20160816; b=nEEZTRbcqQnkZoN4LjLhbp1I+/f5jctZTXC4jJWnnbFNexG1/J6K3HEmQ7W1GEQ5GV bjDctUMllzSmDhTsWn8bPh222kvMLU3YLAGXIrkyY7nWoABP7nwBJcBlDkS1zXAOrQTs co5LdY9ykNKhyLpsw9qf6+QbXBvQUhYwb5IVUXU4KuWzykp3zhne9M24J0DPKXI9tkKh V5t5vBTwHIEhv2h7IcYMpjYuaVBQPuNrhgmnqwnJzCUherK6VB6jlACyBCYlRPrkNlOB sFTKlb+I1n4HK9LwAKTCWjl7y93aImF/jQ81xWMdshoSdE8COIfK9bKMfoNK+/ONeOmg zc2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SPrDRGnfFrGTGdI8Ixu/Pg3mpnvqdvq4qEah1iBqHAg=; b=VUp4MmOdfZZWsFZOwx8LHKWiI4vWLe5iDa2bHvM9ax7RH55cpe1hzMq//4DJTVkt3L mFEVFC0UnlzH+BWHOsnGf7BlV//AjPVBr/1p35PfaYOKQMrcGu4gIwY+QxnhTyTH1kk5 RB/LUCnoIiulyiAFizVcMJ4hAs6PEMBEA/mNP4Y7TgnPRXHLVRGK7+NHyW6x7xBOoMmG n4+L1p5qdR9kMc2CQA5hDbfjbKlN5Y2IfovugFlcuUR2126914XPAmxm2uU/3JINzZG+ ndBgmqtS4GVaG3r/iCDjiQ265ZhQcuP16Qx9bRffDeP0uY4R4FS6+DLhVpJyjrwvokif NjJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aFHRZown; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k9si18990767pfc.238.2019.03.27.12.14.10; Wed, 27 Mar 2019 12:14:25 -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=@kernel.org header.s=default header.b=aFHRZown; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388946AbfC0TNg (ORCPT + 99 others); Wed, 27 Mar 2019 15:13:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:52086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388734AbfC0SKH (ORCPT ); Wed, 27 Mar 2019 14:10:07 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ECAE221741; Wed, 27 Mar 2019 18:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710206; bh=k54kCTv1u60xloHCbK3Ff8ZrJjnxpilCWaadgutsJpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aFHRZownGUvXlspDT2lo077zi1aIb7+Xb4cqDMhYuhALmT8Q7w3iQChZwG+A9093Y VjNEFmasMbs/N3tdK0/EfcHY3slF4jhw4dz2vEXLrD7aIHxQ4T+cp0/Merydyj62dF vUbevPK4lVrDZCUNYxNi7dNlRjHr+Ri54Ivg+1qY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Katsuhiro Suzuki , Heiko Stuebner , Sasha Levin , linux-clk@vger.kernel.org, linux-rockchip@lists.infradead.org Subject: [PATCH AUTOSEL 5.0 251/262] clk: rockchip: fix frac settings of GPLL clock for rk3328 Date: Wed, 27 Mar 2019 14:01:46 -0400 Message-Id: <20190327180158.10245-251-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Katsuhiro Suzuki [ Upstream commit a0e447b0c50240a90ab84b7126b3c06b0bab4adc ] This patch fixes settings of GPLL frequency in fractional mode for rk3328. In this mode, FOUTVCO is calcurated by following formula: FOUTVCO = FREF * FBDIV / REFDIV + ((FREF * FRAC / REFDIV) >> 24) The problem is in FREF * FRAC >> 24 term. This result always lacks one from target value is specified by rate member. For example first itme of rk3328_pll_frac_rate originally has - rate : 1016064000 - refdiv: 3 - fbdiv : 127 - frac : 134217 - FREF * FBDIV / REFDIV = 1016000000 - (FREF * FRAC / REFDIV) >> 24 = 63999 Thus calculated rate is 1016063999. It seems wrong. If frac has 134218 (it is increased 1 from original value), second term is 64000. All other items have same situation. So this patch adds 1 to frac member in all items of rk3328_pll_frac_rate. Signed-off-by: Katsuhiro Suzuki Acked-by: Elaine Zhang Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin --- drivers/clk/rockchip/clk-rk3328.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/clk/rockchip/clk-rk3328.c b/drivers/clk/rockchip/clk-rk3328.c index faa94adb2a37..65ab5c2f48b0 100644 --- a/drivers/clk/rockchip/clk-rk3328.c +++ b/drivers/clk/rockchip/clk-rk3328.c @@ -78,17 +78,17 @@ static struct rockchip_pll_rate_table rk3328_pll_rates[] = { static struct rockchip_pll_rate_table rk3328_pll_frac_rates[] = { /* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */ - RK3036_PLL_RATE(1016064000, 3, 127, 1, 1, 0, 134217), + RK3036_PLL_RATE(1016064000, 3, 127, 1, 1, 0, 134218), /* vco = 1016064000 */ - RK3036_PLL_RATE(983040000, 24, 983, 1, 1, 0, 671088), + RK3036_PLL_RATE(983040000, 24, 983, 1, 1, 0, 671089), /* vco = 983040000 */ - RK3036_PLL_RATE(491520000, 24, 983, 2, 1, 0, 671088), + RK3036_PLL_RATE(491520000, 24, 983, 2, 1, 0, 671089), /* vco = 983040000 */ - RK3036_PLL_RATE(61440000, 6, 215, 7, 2, 0, 671088), + RK3036_PLL_RATE(61440000, 6, 215, 7, 2, 0, 671089), /* vco = 860156000 */ - RK3036_PLL_RATE(56448000, 12, 451, 4, 4, 0, 9797894), + RK3036_PLL_RATE(56448000, 12, 451, 4, 4, 0, 9797895), /* vco = 903168000 */ - RK3036_PLL_RATE(40960000, 12, 409, 4, 5, 0, 10066329), + RK3036_PLL_RATE(40960000, 12, 409, 4, 5, 0, 10066330), /* vco = 819200000 */ { /* sentinel */ }, }; -- 2.19.1