Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4617816pxj; Wed, 12 May 2021 09:20:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjVygw6TVEGx5acN1ngwwdwVv3RHvdpNn+jOCZPGn8pOzFQMXtBpEIcGJhL2A2w2/3SkZn X-Received: by 2002:a17:906:3ce9:: with SMTP id d9mr38301072ejh.172.1620836425996; Wed, 12 May 2021 09:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836425; cv=none; d=google.com; s=arc-20160816; b=r2R6gHCuucrflm4XOJ87Z1hVs2Ey5l2QislnCwKiHVhh/kg+eeW3quIIWyWpIBcDJW 3ZrtBblwkOnAFO7Sp/Z9LS5JRA0Urmi7uW0LmX4Xu0NuzEn08kz03A8LUZ/9w8ZtGzO4 gdeljF/JlhCZ1xNL1MEHmRSacveF0A4W6rDn8ZaejVpcJadLwxfJ+Q+wFEQGwrS0o7U0 2eeMv3KEXVSKKcN9apmdjYHSiAelxM0P1F5+hXyEKriEZgCLbmVzt7Kr0+SQcWuPK+FK Dgsdz5Z8Z2zXHIsQSdLlQQn614FbYULjrdWG4rftaWTHZnRWkcuS6qZGeOATor0yRMhN pyMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UZqaZuQLW5XWshMM6umqB+pOZjUDpSIcVx9n6Dmo0iU=; b=zQ1JxDdpsjCJ7SKbtvFL7asxQBUvYOxDJi1te02GzASM0VEJdCTrQQ+4e46G1UnD6M p8gaQxMPL74qB1bR1Y83/INnbpT6qrbZwNIkN5xzj6bNAdMrY+SWDG42m+2kBHvemtwL 1CmxRnIZ8iFL0qhRwCYlM+fF/v+jDNjWPitv8pL/VpPUTyRy9+wm2nqYlW8WBL4U9A7E 1zphil02g4nl9IdS35rPcTRYSEbT6l+W1L2M0yRIT9517dF0AQl1Ff2df2caZREeEP2h KI6073tC4K6H2fhkIbvBB3MyUbFXYjshUXbU5xClI9UgJNri6OMHaiXemxixJGCaDnQr pDFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zhCJC4GO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si364399ejz.429.2021.05.12.09.20.01; Wed, 12 May 2021 09:20:25 -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=@linuxfoundation.org header.s=korg header.b=zhCJC4GO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239691AbhELQKr (ORCPT + 99 others); Wed, 12 May 2021 12:10:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:40848 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235465AbhELP3w (ORCPT ); Wed, 12 May 2021 11:29:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0F4FE61940; Wed, 12 May 2021 15:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832537; bh=caOxPsbfonQftADl/7vtEo8tGVXxxbcHE7qdHZYQ6yc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zhCJC4GOF00p0pfh2SaI9N5N69wuPyDeB8bU1qmCD0aDy5SGzagcRqD8iU+JCsiaS TnSuR7yjNykE+hVN0YINU5jU4S3aAgACiV5dsNrvKKexATBfcKsoqhNYqemJ3dVg4M mSSGC156JvTNYElbxnCCg87qlfqVz0UY7yKpK+5E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Pinchart , Quanyang Wang , Stephen Boyd , Sasha Levin Subject: [PATCH 5.10 320/530] clk: zynqmp: move zynqmp_pll_set_mode out of round_rate callback Date: Wed, 12 May 2021 16:47:10 +0200 Message-Id: <20210512144830.326467678@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Quanyang Wang [ Upstream commit d7fd3f9f53df8bb2212dff70f66f12cae0e1a653 ] The round_rate callback should only perform rate calculation and not involve calling zynqmp_pll_set_mode to change the pll mode. So let's move zynqmp_pll_set_mode out of round_rate and to set_rate callback. Fixes: 3fde0e16d016 ("drivers: clk: Add ZynqMP clock driver") Reported-by: Laurent Pinchart Signed-off-by: Quanyang Wang Link: https://lore.kernel.org/r/20210406154015.602779-1-quanyang.wang@windriver.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/zynqmp/pll.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/clk/zynqmp/pll.c b/drivers/clk/zynqmp/pll.c index 92f449ed38e5..03bfe62c1e62 100644 --- a/drivers/clk/zynqmp/pll.c +++ b/drivers/clk/zynqmp/pll.c @@ -100,9 +100,7 @@ static long zynqmp_pll_round_rate(struct clk_hw *hw, unsigned long rate, /* Enable the fractional mode if needed */ rate_div = (rate * FRAC_DIV) / *prate; f = rate_div % FRAC_DIV; - zynqmp_pll_set_mode(hw, !!f); - - if (zynqmp_pll_get_mode(hw) == PLL_MODE_FRAC) { + if (f) { if (rate > PS_PLL_VCO_MAX) { fbdiv = rate / PS_PLL_VCO_MAX; rate = rate / (fbdiv + 1); @@ -173,10 +171,12 @@ static int zynqmp_pll_set_rate(struct clk_hw *hw, unsigned long rate, long rate_div, frac, m, f; int ret; - if (zynqmp_pll_get_mode(hw) == PLL_MODE_FRAC) { - rate_div = (rate * FRAC_DIV) / parent_rate; + rate_div = (rate * FRAC_DIV) / parent_rate; + f = rate_div % FRAC_DIV; + zynqmp_pll_set_mode(hw, !!f); + + if (f) { m = rate_div / FRAC_DIV; - f = rate_div % FRAC_DIV; m = clamp_t(u32, m, (PLL_FBDIV_MIN), (PLL_FBDIV_MAX)); rate = parent_rate * m; frac = (parent_rate * f) / FRAC_DIV; -- 2.30.2