Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753691AbdHIRWS (ORCPT ); Wed, 9 Aug 2017 13:22:18 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38388 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752642AbdHIRWQ (ORCPT ); Wed, 9 Aug 2017 13:22:16 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2CED560115 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sboyd@codeaurora.org Date: Wed, 9 Aug 2017 10:22:13 -0700 From: "sboyd@codeaurora.org" To: Eugeniy Paltsev Cc: "linux-kernel@vger.kernel.org" , "mark.rutland@arm.com" , "mturquette@baylibre.com" , "robh+dt@kernel.org" , "linux-clk@vger.kernel.org" , "linux-snps-arc@lists.infradead.org" Subject: Re: [PATCH] ARC: clk: introduce HSDKv1 pll driver Message-ID: <20170809172213.GB2146@codeaurora.org> References: <20170714153128.8945-1-Eugeniy.Paltsev@synopsys.com> <20170804015351.GW2146@codeaurora.org> <1502297028.2586.4.camel@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1502297028.2586.4.camel@synopsys.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1583 Lines: 52 On 08/09, Eugeniy Paltsev wrote: > On Thu, 2017-08-03 at 18:53 -0700, Stephen Boyd wrote: > > On 07/14, Eugeniy Paltsev wrote: > > > + /* input divider = reg.idiv + 1 */ > > > + idiv = 1 + ((val & CGU_PLL_CTRL_IDIV_MASK) >> > > > CGU_PLL_CTRL_IDIV_SHIFT); > > > + /* fb divider = 2*(reg.fbdiv + 1) */ > > > + fbdiv = 2 * (1 + ((val & CGU_PLL_CTRL_FBDIV_MASK) >> > > > CGU_PLL_CTRL_FBDIV_SHIFT)); > > > + /* output divider = 2^(reg.odiv) */ > > > + odiv = 1 << ((val & CGU_PLL_CTRL_ODIV_MASK) >> > > > CGU_PLL_CTRL_ODIV_SHIFT); > > > > Maybe just drop these comments. They're just repeating the code. > > Actually I would prefer to keep them, as "2^(reg.odiv)" is more? > human-readable then > "1 << ((val & CGU_PLL_CTRL_ODIV_MASK) >> CGU_PLL_CTRL_ODIV_SHIFT)" Alright. > > > > + > > > + rate = (u64)parent_rate * fbdiv; > > > + do_div(rate, idiv * odiv); > > > + > > > + return rate; > > > +} > > > + > > > +static long hsdk_pll_round_rate(struct clk_hw *hw, unsigned long > > > rate, > > > + unsigned long *prate) > > > +{ > > > + int i; > > > + long best_rate; > > > + struct hsdk_pll_clk *clk = to_hsdk_pll_clk(hw); > > > + const struct hsdk_pll_cfg *pll_cfg = clk->pll_cfg; > > > + > > > + if (pll_cfg[0].rate == 0) > > > + return -EINVAL; > >? > > This happens? > > Only if we add bad hsdk_pll_cfg table. But it is quite cold code - we > change pll configuration quite rare, so maybe it's better to keep this > assert? Can it be a BUILD_BUG_ON() somehow? -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project