From patchwork Wed Nov 2 23:43:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julius Werner X-Patchwork-Id: 9410015 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 6E4C06022E for ; Wed, 2 Nov 2016 23:44:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FCC62A620 for ; Wed, 2 Nov 2016 23:44:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5461E2A625; Wed, 2 Nov 2016 23:44:05 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B97C42A620 for ; Wed, 2 Nov 2016 23:44:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c25CL-0003jh-IQ; Wed, 02 Nov 2016 23:44:01 +0000 Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c25CJ-0003ex-HQ for linux-rockchip@lists.infradead.org; Wed, 02 Nov 2016 23:44:00 +0000 Received: by mail-pf0-x235.google.com with SMTP id i88so19842209pfk.2 for ; Wed, 02 Nov 2016 16:43:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=phgppX5k97DPmDBPvSZsukr1CSiJHFfP+39AZsAPV8U=; b=Bdfo3saoarGmsKD8pDDE/SjCP/3K6bqqVn9pUFK/a0jDD4kRGyAhP1NBOWOujZfCZW uHNjWzIKSckylrZsvVf63snc/1xloaXIkPm1Xsg3RTxANzqCj+Jfap9ZjKRdaGalOw+P Py8KdSpsUYlSPBodyiXnQsKR23OPezdA+xvB8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=phgppX5k97DPmDBPvSZsukr1CSiJHFfP+39AZsAPV8U=; b=T0bkbEEPU3UdJFjuaHMGI6K1miNbIKa7LrQnkWYL4RQB4WzET6NsZLivZkPufSNdVs Gqb1I8dP4Ddm1fk33MIdXt3HICF2yxiLiXegRacbPbE0MfccXy4ZC9BUWhGb/J860fc2 9dUrs8TUOP3u/JZ8Gwe7hl3W71OvEVVxW+BzSSW4T215irBkAxRI9eg98LQUMqjE2N1c VQE8joiT+PxgiGJSfBZ3FrUjK38c6GO8wh6fKi1lmCF72BVRaC+8daADAFDgX2t5IACx RvV+G/lJmp0Nv/i4FbvsUy4EDIt6yYCLtRCr4JUVOxZ7e+P0oEusqR/pMLVrH/qsUll7 EbVw== X-Gm-Message-State: ABUngvdaLcYq4nsxW+B3WtkmdYNteszMF2RHY2CYSfg3iTQKlZypV3Hl9C8FQ8GjCYSt0t9m X-Received: by 10.98.13.130 with SMTP id 2mr11365240pfn.182.1478130215179; Wed, 02 Nov 2016 16:43:35 -0700 (PDT) Received: from jwerner-linux.mtv.corp.google.com ([172.22.64.164]) by smtp.gmail.com with ESMTPSA id 188sm7333482pfd.9.2016.11.02.16.43.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Nov 2016 16:43:34 -0700 (PDT) From: Julius Werner To: Heiko Stuebner Subject: [PATCH] clk: rockchip: Ignore frac divisor for PLL equivalence when it's unused Date: Wed, 2 Nov 2016 16:43:24 -0700 Message-Id: <1478130204-3167-1-git-send-email-jwerner@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161102_164359_718145_12A4C678 X-CRM114-Status: GOOD ( 12.12 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, Julius Werner , linux-kernel@vger.kernel.org, Xing Zheng , Doug Anderson MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Rockchip RK3399 PLLs can be used in two separate modes: integral and fractional. We can select between these two modes with the unambiguously named DSMPD bit. During boot, we check all PLL settings to confirm that they match our PLL table for that frequency, and reinitialize the PLLs where they don't. The settings checked for this include the fractional divider field that is only used in fractional mode, even if we're in integral mode (DSMPD = 1) and that field has no effect. This patch changes the check to only compare the fractional divider if we're actually in fractional mode. This way, we won't reinitialize the PLL in cases where there's absolutely no reason for that, which may avoid glitching child clocks that should better not be glitched (e.g. PWM regulators). Signed-off-by: Julius Werner --- drivers/clk/rockchip/clk-pll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c index 9c1373e..1449c76 100644 --- a/drivers/clk/rockchip/clk-pll.c +++ b/drivers/clk/rockchip/clk-pll.c @@ -795,7 +795,8 @@ static void rockchip_rk3399_pll_init(struct clk_hw *hw) if (rate->fbdiv != cur.fbdiv || rate->postdiv1 != cur.postdiv1 || rate->refdiv != cur.refdiv || rate->postdiv2 != cur.postdiv2 || - rate->dsmpd != cur.dsmpd || rate->frac != cur.frac) { + rate->dsmpd != cur.dsmpd || + (!cur.dsmpd && (rate->frac != cur.frac))) { struct clk *parent = clk_get_parent(hw->clk); if (!parent) {