Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1344689pxy; Thu, 29 Apr 2021 05:17:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeRP3+qWqhA+Si1UYH7pSFGaIuZSZB6FoUvCCLHMAlq08xydyihd2SO9SX/tu5zMk9pAkj X-Received: by 2002:a17:90a:7e82:: with SMTP id j2mr10574907pjl.51.1619698624379; Thu, 29 Apr 2021 05:17:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619698624; cv=none; d=google.com; s=arc-20160816; b=KVHFfzWNpT7cwIbHCknRftZnMIWOzwJ/XxIJj83BvFw2swntRNBZkKrQUJpeT0K6Ol dKQIsqL26csDTPcf9XGlKITq01RvKtYStnG6WT5/WNWNcaYwJlRb6b6mEbRMMbnC14jo rR/3oHHfFtBcnb7tD0oe6QXbWed42fTmaDxiwBlQdnKtPAOFk0dQ39Qi8DPFebKH0AUC 56UEn7dz0B80ZJT9eDGaSdHjNrWu4YS5nTszeVDpfUpjxpEcDzyEP+kjHS0qEbU+X+bI JcTi0gTAsLZsh7Z9XwREIPc414pZaUyBP6Qi9WBTw0cW79y8UiT12HVDOg8q2fUYsrMY XV4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=yRijLkfkG3QMx5ZZ+V2aLtoew1Ejz/66bv4l23pIpjo=; b=b3hyLqBFrEVzNlvzmXHMbcVknIfFaJc/BwIIvxiHf3xPKjC7q/NIFXkbukCLbg2pAV xcOWZ1F2iKQSstrKOy8smYFb9wYMxWgHPpWbMsBf4jk8Wle6/zewifScZ/4vhebrT83G vsylL4880/xmIcdsjb9QxXQwhR1Ws59r3TjfcFExXpPWIFI1G2mmtZEVj1DZz2zFjhC4 smKrqEfzSX04WJCMaqlI8qFMM8uSCn68hL8qMg7TyF5ywUBKJiopax9neJiW7i596cI/ 6o9tcKajxT6UNFESjWe2uBNNYDHYwVj/jxo172PHhKrp0R6Z11CG3LMFxhBuNBAHxc2I QK0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=FzhLeC4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k14si3212445pfa.113.2021.04.29.05.16.50; Thu, 29 Apr 2021 05:17:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=FzhLeC4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230148AbhD2MPw (ORCPT + 99 others); Thu, 29 Apr 2021 08:15:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231490AbhD2MPv (ORCPT ); Thu, 29 Apr 2021 08:15:51 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49DA7C06138C for ; Thu, 29 Apr 2021 05:15:04 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 82-20020a1c01550000b0290142562ff7c9so6561442wmb.3 for ; Thu, 29 Apr 2021 05:15:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=yRijLkfkG3QMx5ZZ+V2aLtoew1Ejz/66bv4l23pIpjo=; b=FzhLeC4gCNejTx5HoNxqezTO6fZRp9Z7mpGk1i7FcVLYC0Ps/Z0TCymd3LJOB24vsL c9oWNJlBC8hWdw/R4GpnNPXJ/URyvWgMETraIalCaT/NDsWHtKLHi9Z9tjUf5dlbEL+z GIbCK2Tbi0OkvfsN/jSIVUllehkIM55kcb4bFCRpECnzVXkLllhJ4+IYNOPG/DgQqLAG JG3LKj9L1f6Id6JZe7Nui687SfoS+ElcdMbQVVL1GSCX5XKeaR2C0lH+jmaWTeuPH4BO 1RA+7lWSH/w5W8ZIxVGvvrNqEzXkLBwAdYdOBstiTmJTKydTTumFEZomRRheR+Vc9fYr IyUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=yRijLkfkG3QMx5ZZ+V2aLtoew1Ejz/66bv4l23pIpjo=; b=M61BTggtPZrL32d5g5nPABvK28vYD5NW1fSjS4n8qBzxxVy96FZZB/XjGoQ+eUeG9w GkN+ssDyGqYSskNOumGi53rdGo4QQQUi1/0OyVmJakcr49id3RjrqF7Jsue9NasaXNOt ONIG2UwSTgO8ZwSG5o1AH+iGxQLqoFC5RrUIKjRYAVaiIOR769RRTw9lJeiITYRNWb3m uVECekNTpdZsA9gPMB35RKhX6lTCNZaLg2VDRd5xK0aJUBiMSDkyErFXWiDr31jsOJIN U9/ViUFpQAJd16MwpBg/VHx4aItRykEuD8M6Eg+Hde/jl09AIwps34roSIwaB3vuh4tp lVCg== X-Gm-Message-State: AOAM533ZbmUtSlubsclaf5Ib+QQN0czZB5AzteTHi/VN6G1mLMUHLrF/ 2Y6hzPQvalF1pGPSFX/L6ATPBOdYHGrDTWZF X-Received: by 2002:a7b:c344:: with SMTP id l4mr9906537wmj.120.1619698502370; Thu, 29 Apr 2021 05:15:02 -0700 (PDT) Received: from ?IPv6:2a01:e0a:90c:e290:c304:4b2b:4a79:1da9? ([2a01:e0a:90c:e290:c304:4b2b:4a79:1da9]) by smtp.gmail.com with ESMTPSA id h10sm4993111wrt.40.2021.04.29.05.15.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Apr 2021 05:15:01 -0700 (PDT) Subject: Re: [PATCH] clk: meson: g12a: fix gp0 and hifi ranges To: Jerome Brunet Cc: Kevin Hilman , linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210429090325.60970-1-jbrunet@baylibre.com> <979eb290-6fc2-38df-0596-867b82d22226@baylibre.com> <1jim45juf1.fsf@starbuckisacylon.baylibre.com> From: Neil Armstrong Organization: Baylibre Message-ID: <0cfc7286-7be6-57ec-8040-a4370d0b4204@baylibre.com> Date: Thu, 29 Apr 2021 14:15:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <1jim45juf1.fsf@starbuckisacylon.baylibre.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/04/2021 11:45, Jerome Brunet wrote: > > On Thu 29 Apr 2021 at 11:20, Neil Armstrong wrote: > >> On 29/04/2021 11:03, Jerome Brunet wrote: >>> While some SoC samples are able to lock with a PLL factor of 55, others >>> samples can't. ATM, a minimum of 60 appears to work on all the samples >>> I have tried. >>> >>> Even with 60, it sometimes takes a long time for the PLL to eventually >>> lock. The documentation says that the minimum rate of these PLLs DCO >>> should be 3GHz, a factor of 125. Let's use that to be on the safe side. >>> >>> With factor range changed, the PLL seems to lock quickly (enough) so far. >>> It is still unclear if the range was the only reason for the delay. >>> >>> Fixes: 085a4ea93d54 ("clk: meson: g12a: add peripheral clock controller") >>> Signed-off-by: Jerome Brunet >>> --- >>> drivers/clk/meson/g12a.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c >>> index b080359b4645..a805bac93c11 100644 >>> --- a/drivers/clk/meson/g12a.c >>> +++ b/drivers/clk/meson/g12a.c >>> @@ -1603,7 +1603,7 @@ static struct clk_regmap g12b_cpub_clk_trace = { >>> }; >>> >>> static const struct pll_mult_range g12a_gp0_pll_mult_range = { >>> - .min = 55, >>> + .min = 125, >>> .max = 255, >>> }; >>> >>> >> >> I got other issues with GP0 when trying to use it for DSI on VIM3 & VIM3L. >> >> I had to do change the following to have it lock correctly and achieve rates usable for MIPI-DSI requested bandwidth: >> >> diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c >> index cde07f7ebad6..897cd6db5c0f 100644 >> --- a/drivers/clk/meson/clk-pll.c >> +++ b/drivers/clk/meson/clk-pll.c >> @@ -391,9 +391,9 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, >> meson_parm_write(clk->map, &pll->frac, frac); >> } >> >> - /* If the pll is stopped, bail out now */ >> + /* If the pll is stopped, bail out now * / >> if (!enabled) >> - return 0; >> + return 0;*/ > > This enables the PLL everytime set_rate() is called :/ > >> >> if (meson_clk_pll_enable(hw)) { >> pr_warn("%s: pll did not lock, trying to restore old rate %lu\n", >> >> This one is tricky, for DSI the clock rate is set with assigned-clock-rates in DT, but >> then the GP0 is seen as stopped and then the rate is never set. > > Audio does the same - PLL is set and enabled afterward. This has been > working so far. > >> >> When afterwards we enable the PLL, the rate set in the registers is invalid and never locks, >> this permits setting the rate in the registers even if the PLL is >> stopped. > > There something to be explained here cause the register have been set > before bailing out. What is happening ? The pokes before have no effect > or are the value being reset at another point ? > > I understand this need to address this concern but it does not seems > related to this particular patch. > >> >> diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c >> index 1b0167b8de3b..08174724a115 100644 >> --- a/drivers/clk/meson/g12a.c >> +++ b/drivers/clk/meson/g12a.c >> @@ -1602,8 +1602,8 @@ static struct clk_regmap g12b_cpub_clk_trace = { >> }; >> >> static const struct pll_mult_range g12a_gp0_pll_mult_range = { >> - .min = 55, >> - .max = 255, >> + .min = 120, >> + .max = 168, >> }; >> >> I had to change the min/max to achieve a stable and functional rate of 720MHz after the ODs. >> > > How about the range provided in here ? This is range documented by AML > (3GHz < DCO < 6GHz). 168 limits would limit the rate to ~4GHz which is > way below spec and would negatively impact audio clocks. For hifi pll right, not for GP0 ? >> Neil >