Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1829997ybh; Fri, 17 Jul 2020 02:15:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXCgIWAPS+zoGQpBO4MYqgEJf8ysuD3bfHXN8xWAi5AsMj0et3soJKSTvy1vKQg7+7a/fB X-Received: by 2002:a17:906:1453:: with SMTP id q19mr7950199ejc.111.1594977330000; Fri, 17 Jul 2020 02:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594977329; cv=none; d=google.com; s=arc-20160816; b=yVa2E+yE6uNQ9S3rrcVLiP60QydXkrMUlrzRLU9wMotO7JsT/LSalQA1EdFslnC+Gq TTj5wG+lrZQ1rQXyhoCbtBsKw9XvCu+lqZQn7iFLer65V0VhzTINiIXCrjRU4sNtaMLi fSu8bcrRxgUreY1AjeC86FDjRhKTJbEj3NNNmX+wT4s4yPMthiQsaJvik9RHx9xtZlVN 87Wi89khGvhXRCCAzNfR1uiOrWgH+CiSAo71+UwWE8eLiUvE9+yGFcBBEXGyBRLIOC9g lLqMnpqjugI/lojrSXYfDOHoONv0+/8L7BfIYUlxJ5xqPRdVgThKRHdTgz0OXJEYe4Jf +mRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=XWkdqJv8a8A7mA0tnh/9GqoCKGGpyWulhzuIQDJJol4=; b=QU8N+gPb6/42vyZOzmbeLgD9CpOWKFL2x2QZCtZlr/pnR0j3pkGC6o8gypHhV+InwF 5m5br0pOQBPwW/z3TsacPMEkXUAiex7YD/Lf2WAD01SrE1erWHk0xsiyjTon00s1w2va iJPXsMvsawbcRVLoJpEEwnJeHBGe2bWt/ix529wHVf06O1qNzcg2LVrGyFxv6Z78vAX7 qr1+AMW+5glwGa0h2PjAfH2CBUsu8XqV00zZNDmi+bGe/Bf95e2Wo69JJO0SGRbQ1AVD vAmMzptTmPt/ZIoi0xTVvzgRXvxjrkaOOnh60z+XhfjjjnNttfaFL7nLRyy7Ystioges jOBw== ARC-Authentication-Results: i=1; mx.google.com; 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 m15si4656630ejr.38.2020.07.17.02.15.07; Fri, 17 Jul 2020 02:15:29 -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; 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 S1726439AbgGQJMn (ORCPT + 99 others); Fri, 17 Jul 2020 05:12:43 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:58229 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725864AbgGQJMm (ORCPT ); Fri, 17 Jul 2020 05:12:42 -0400 X-Originating-IP: 90.65.108.121 Received: from localhost (lfbn-lyo-1-1676-121.w90-65.abo.wanadoo.fr [90.65.108.121]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id E4FFEFF80C; Fri, 17 Jul 2020 09:12:38 +0000 (UTC) Date: Fri, 17 Jul 2020 11:12:38 +0200 From: Alexandre Belloni To: Claudiu Beznea Cc: mturquette@baylibre.com, sboyd@kernel.org, nicolas.ferre@microchip.com, ludovic.desroches@microchip.com, bbrezillon@kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 07/19] clk: at91: sam9x60-pll: use frac when setting frequency Message-ID: <20200717091238.GL3428@piout.net> References: <1594812267-6697-1-git-send-email-claudiu.beznea@microchip.com> <1594812267-6697-8-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1594812267-6697-8-git-send-email-claudiu.beznea@microchip.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/07/2020 14:24:15+0300, Claudiu Beznea wrote: > In commit a436c2a447e59 ("clk: at91: add sam9x60 PLL driver") > the fractional part of PLL wasn't set on registers but it was > calculated and taken into account for determining div and mul > (see sam9x60_pll_get_best_div_mul()). > I think this becomes an issue only once 4/19 is applied so you should probably squash those two together. > Fixes: a436c2a447e59 ("clk: at91: add sam9x60 PLL driver") > Signed-off-by: Claudiu Beznea > --- > drivers/clk/at91/clk-sam9x60-pll.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/clk/at91/clk-sam9x60-pll.c b/drivers/clk/at91/clk-sam9x60-pll.c > index 00f2afd6e9b6..13e15bd48770 100644 > --- a/drivers/clk/at91/clk-sam9x60-pll.c > +++ b/drivers/clk/at91/clk-sam9x60-pll.c > @@ -16,6 +16,7 @@ > > #define PMC_PLL_CTRL0_DIV_MSK GENMASK(7, 0) > #define PMC_PLL_CTRL1_MUL_MSK GENMASK(31, 24) > +#define PMC_PLL_CTRL1_FRACR_MSK GENMASK(21, 0) > > #define PLL_DIV_MAX (FIELD_GET(PMC_PLL_CTRL0_DIV_MSK, UINT_MAX) + 1) > #define UPLL_DIV 2 > @@ -55,7 +56,7 @@ static int sam9x60_pll_prepare(struct clk_hw *hw) > unsigned long flags; > u8 div; > u16 mul; > - u32 val; > + u32 val, frac; > > spin_lock_irqsave(pll->lock, flags); > regmap_write(regmap, AT91_PMC_PLL_UPDT, pll->id); > @@ -65,9 +66,10 @@ static int sam9x60_pll_prepare(struct clk_hw *hw) > > regmap_read(regmap, AT91_PMC_PLL_CTRL1, &val); > mul = FIELD_GET(PMC_PLL_CTRL1_MUL_MSK, val); > + frac = FIELD_GET(PMC_PLL_CTRL1_FRACR_MSK, val); > > if (sam9x60_pll_ready(regmap, pll->id) && > - (div == pll->div && mul == pll->mul)) { > + (div == pll->div && mul == pll->mul && frac == pll->frac)) { > spin_unlock_irqrestore(pll->lock, flags); > return 0; > } > @@ -80,7 +82,8 @@ static int sam9x60_pll_prepare(struct clk_hw *hw) > regmap_write(regmap, AT91_PMC_PLL_ACR, val); > > regmap_write(regmap, AT91_PMC_PLL_CTRL1, > - FIELD_PREP(PMC_PLL_CTRL1_MUL_MSK, pll->mul)); > + FIELD_PREP(PMC_PLL_CTRL1_MUL_MSK, pll->mul) | > + FIELD_PREP(PMC_PLL_CTRL1_FRACR_MSK, pll->frac)); > > if (pll->characteristics->upll) { > /* Enable the UTMI internal bandgap */ > -- > 2.7.4 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com