From patchwork Fri Jan 5 17:09:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10146837 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3EEE5601A1 for ; Fri, 5 Jan 2018 17:14:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2044D28782 for ; Fri, 5 Jan 2018 17:14:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 152612871F; Fri, 5 Jan 2018 17:14:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 951E82871F for ; Fri, 5 Jan 2018 17:14:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=3Hi/zI6u3FYGloB/Md+dATDlvgI1zz3mCaDezreMeks=; b=VMpockpalOcn5zCr4pw2E1koGZ fBcSdExhLoUlefi8YgufJnnMoaUWz53xknhqYk1m+PBlHqwHH7FbZdLErQCxwCB1se11XOaf/xfnb pSKJ6lilFzpkb/iuNe8P0GO/jf2zcK3lncwctgO2JxQ1A9Lzu+8AdNxYiy6FCUWRieC1dPv5RiviG VplZe+RTtJpDJ9/Fm+JDOHRxiTVU9ETXbGAwuuyhu79I7secXVXSC7CaEGql4cM2b1GjFu/WJeV77 ROuruooN8bzzIX6tGURPyULRLRLfzsqrQnAa3PFMrqBO6P35CkLjd4TPTqcWVEOLq0sopmIRWAMP1 VCms4Odw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eXVZI-0005os-HP; Fri, 05 Jan 2018 17:14:08 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eXVVZ-0001vZ-HR for linux-arm-kernel@lists.infradead.org; Fri, 05 Jan 2018 17:10:21 +0000 Received: by mail-wr0-x241.google.com with SMTP id p17so4888738wre.7 for ; Fri, 05 Jan 2018 09:10:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SvqmIi4JX7FUmE1hctK4hcawSrjR038rkKJJ0LAXBHw=; b=rpdkbKFV7OSY+NTAq2vYFxIO+IdC+twvL2JGL4p+mqJmWmoQhcPHnBsDs7R5Kf2k+1 dh5emdwbUh/eHCIorUVQcfx9e2dmBr9PxaK4vVNPDkB5lzYBEg9/7HX/wjQ/PoSjttiN Y/FwY4pvbiH0zg0lhU5+53eSIRxCU5eNPsQyl0fYYjG9C+f8BpeYzd9wdHj/cObdk4jB 50m2u3Pq2dpEiQNvhcn4RHx7X1MgFWk59klHPN7sU1z1LQXZS3k6O54/pB1JjkWz66xT MBYPCyB4oc6dJzinWUTdgwQN0L2BqL/pYBMiFUJ7ZY8k1xLb78xqv1399PdjDa2kUxnz LyNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SvqmIi4JX7FUmE1hctK4hcawSrjR038rkKJJ0LAXBHw=; b=Dqy8rAdfVTWTVDkL4uinF3xtofq22xGTmTlwApjQs3PF9epVrUv/8YLn4xyCLPUom0 xHsFqwT044a0s90RVbLwETiuAV7S/mTiKZ2nCVI4s6Id03Tbyt2odtUkC2BK3lZqWlqc tCuBqbCba9UUKaettxkWT1zqYMvF5Pp1ZzLkxSJh9Sg4xLnfnPQdqZGM+pJ4vuBaizE0 0eZKIqEQKCQo2R8y6hFkl89MTyVAW8HfaEzT1Cmz+z9DQHT2qqTaedX4Cng+T5JewnRA XMtdUQHsI96oPbJePTS3bvVlZ5R7k2b0AoLXKs1xgDTcj0FQWbHNZNknlzCHSr0Ln0nL EVxQ== X-Gm-Message-State: AKGB3mKo9ZE7ScLaNbw2fjDfqdOGLufUTXqdScfe54z5ieTDIla6uKIn /lfVAQLZS51AuuuXo5kOG04y2Q== X-Google-Smtp-Source: ACJfBouRKCRpQKvMZFx0esiS0ie1zf8uP0RIn6NkeWBDkw8fVQIzmsVyggSHEyZk+XkCDmIviAvPxA== X-Received: by 10.223.190.18 with SMTP id n18mr3369519wrh.108.1515172205508; Fri, 05 Jan 2018 09:10:05 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id g17sm3263661wra.6.2018.01.05.09.10.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2018 09:10:04 -0800 (PST) From: Jerome Brunet To: Stephen Boyd , Michael Turquette , linux-clk@vger.kernel.org Subject: [PATCH 2/5] clk: lpc32xx: read-only divider can propagate rate change Date: Fri, 5 Jan 2018 18:09:56 +0100 Message-Id: <20180105170959.17266-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180105170959.17266-1-jbrunet@baylibre.com> References: <20180105170959.17266-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180105_091017_669522_36A58B5A X-CRM114-Status: GOOD ( 10.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Zapolskiy , David Brown , Sylvain Lemieux , Andy Gross , linux-arm-kernel@lists.infradead.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When a divider clock has CLK_DIVIDER_READ_ONLY set, it means that the register shall be left un-touched, but it does not mean the clock should stop rate propagation if CLK_SET_RATE_PARENT is set This properly handled in qcom clk-regmap-divider but it was not in the lpc32xx divider Fixes: f7c82a60ba26 ("clk: lpc32xx: add common clock framework driver") Signed-off-by: Jerome Brunet --- drivers/clk/nxp/clk-lpc32xx.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/clk/nxp/clk-lpc32xx.c b/drivers/clk/nxp/clk-lpc32xx.c index f5d815f577e0..729333766f97 100644 --- a/drivers/clk/nxp/clk-lpc32xx.c +++ b/drivers/clk/nxp/clk-lpc32xx.c @@ -963,6 +963,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) { struct lpc32xx_clk_div *divider = to_lpc32xx_div(hw); + struct clk_hw *hw_parent = clk_hw_get_parent(hw); unsigned int bestdiv; /* if read only, just return current value */ @@ -972,6 +973,15 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate, bestdiv &= div_mask(divider->width); bestdiv = _get_div(divider->table, bestdiv, divider->flags, divider->width); + + /* Even a read-only clock can propagate a rate change */ + if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { + if (!hw_parent) + return -EINVAL; + + *prate = clk_hw_round_rate(hw_parent, rate * bestdiv); + } + return DIV_ROUND_UP(*prate, bestdiv); }