From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C536C4167D for ; Fri, 15 Oct 2021 14:53:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 78065611C3 for ; Fri, 15 Oct 2021 14:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240757AbhJOO4E (ORCPT ); Fri, 15 Oct 2021 10:56:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240721AbhJOOz6 (ORCPT ); Fri, 15 Oct 2021 10:55:58 -0400 Received: from mail.bugwerft.de (mail.bugwerft.de [IPv6:2a03:6000:1011::59]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 63D4CC061764; Fri, 15 Oct 2021 07:53:52 -0700 (PDT) Received: from hq-00021.fritz.box (p57bc9963.dip0.t-ipconnect.de [87.188.153.99]) by mail.bugwerft.de (Postfix) with ESMTPSA id ADBBC48E44D; Fri, 15 Oct 2021 14:53:51 +0000 (UTC) From: Daniel Mack To: mturquette@baylibre.com, sboyd@kernel.org Cc: linux-clk@vger.kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org, kuninori.morimoto.gx@renesas.com, Daniel Mack Subject: [PATCH RESEND v4 8/9] clk: cs2000-cp: freeze config during register fiddling Date: Fri, 15 Oct 2021 16:53:25 +0200 Message-Id: <20211015145326.1018458-9-daniel@zonque.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211015145326.1018458-1-daniel@zonque.org> References: <20211015145326.1018458-1-daniel@zonque.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Make sure to freeze the configuration of the chip during the programming of 32-bit registers. This avoids the processing of invalid intermediate states. Signed-off-by: Daniel Mack --- drivers/clk/clk-cs2000-cp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/clk/clk-cs2000-cp.c b/drivers/clk/clk-cs2000-cp.c index 9f99e39b41f2..1baf0595ba59 100644 --- a/drivers/clk/clk-cs2000-cp.c +++ b/drivers/clk/clk-cs2000-cp.c @@ -52,6 +52,7 @@ #define FRACNSRC_DYNAMIC (1 << 0) /* GLOBAL_CFG */ +#define FREEZE (1 << 7) #define ENDEV2 (0x1) /* FUNC_CFG1 */ @@ -335,6 +336,10 @@ static int __cs2000_set_rate(struct cs2000_priv *priv, int ch, { int ret; + ret = cs2000_bset(priv, GLOBAL_CFG, FREEZE, FREEZE); + if (ret < 0) + return ret; + ret = cs2000_select_ratio_mode(priv, rate, parent_rate); if (ret < 0) return ret; @@ -347,6 +352,10 @@ static int __cs2000_set_rate(struct cs2000_priv *priv, int ch, if (ret < 0) return ret; + ret = cs2000_bset(priv, GLOBAL_CFG, FREEZE, 0); + if (ret < 0) + return ret; + priv->saved_rate = rate; priv->saved_parent_rate = parent_rate; -- 2.31.1