From patchwork Mon Nov 20 17:19:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 167284 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp87996vqb; Mon, 20 Nov 2023 09:20:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IGBX2glYGdzdNsmRM/3saawA0tPE8i58MmW/BHl1WvphSCCtt0CSj0lWrVk611MIx8k3jBA X-Received: by 2002:a05:6a20:8f94:b0:187:604a:3add with SMTP id k20-20020a056a208f9400b00187604a3addmr7322624pzj.24.1700500801740; Mon, 20 Nov 2023 09:20:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700500801; cv=none; d=google.com; s=arc-20160816; b=wRdjmITwataK/IMqw1Det4KMhU6TNcf/1Qk5NAXC9pOQjeEKsGm9BV9GdYwud/cA5L Hcw7DxwTMTzkAQ6+gMJO2sei7yyGw6Xnl1XZWNUGwyZqUr/7rnvF1hAkmWiTK1lAeSej VkeHtijWfdVeRzzl2aOJXDNxw6XgzH0t54g3bAZDQYMcNeCAYnN/TRWTdqRanEIuw2o7 MY1AJ9jA55r+faeE6j0giao/WISnTjlCro2VyiGhqQGEsgWwK2Nk3OaSKFjVfban7jYM yNj0a/pI5c9enTYyxuIg3SzDFxqPkgEqz0JQ2iRgGfUkxo2a9cEkCoGFJLQhrQYqjeeV YEjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:to:from:date; bh=pISgyEEbNgckM754GgOyys7xZ+HZ3agTVDRjwAkig0I=; fh=B3Zph78rFuWcOCm/qXBEHRCtpd8DMWv/vsl+j3Z4hjw=; b=ldu37HsSvf2/w2xsXngqMQE33RCnYvKYS86rn4pQBjAK2w0LandZVgo+zykdDuqy95 SXsawayDhqcMNbB7vS8JclAXPUYj078tsVgGLEnvnHitHDEHaW3wVDB+6DqRbMbJQurc Vf8oasIj2lKvut6w1KUsB6ZAf9YcUd1o03OXe72V8r57wG2N8cj9EYzajQzGm9nt/uRL x9gwMH94HLP59qDTtc+HiNjm/52QeO1nr/f9X3OIDRXdHUuLX1bTntrYhAZiM22wEEgA OaX64S4FQ5WMKjPawBYsk4gRf/BBcam7QJ/KZ2pd7v4s5sh6iBG3qJc5diJzYgH1740t M+vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id o1-20020a63fb01000000b0055b640a6b3csi8747428pgh.884.2023.11.20.09.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:20:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D27BB80B8145; Mon, 20 Nov 2023 09:19:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233819AbjKTRT3 (ORCPT + 27 others); Mon, 20 Nov 2023 12:19:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233804AbjKTRTY (ORCPT ); Mon, 20 Nov 2023 12:19:24 -0500 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD39D1AA; Mon, 20 Nov 2023 09:19:17 -0800 (PST) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1r57vQ-0008L6-0R; Mon, 20 Nov 2023 17:19:09 +0000 Date: Mon, 20 Nov 2023 17:19:05 +0000 From: Daniel Golle To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Michael Turquette , Stephen Boyd , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Sabrina Dubroca , Daniel Golle , Jianhui Zhao , Chen-Yu Tsai , "Garmin.Chang" , Edward-JW Yang , Johnson Wang , Sam Shih , Frank Wunderlich , Dan Carpenter , James Liao , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-clk@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 3/4] clk: mediatek: Add pcw_chg_shift control Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 20 Nov 2023 09:19:52 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783104328550569015 X-GMAIL-MSGID: 1783104328550569015 Introduce pcw_chg_shfit control to optionally use that instead of the hardcoded PCW_CHG_MASK macro. This will needed for clocks on the MT7988 SoC. Signed-off-by: Sam Shih Signed-off-by: Daniel Golle --- drivers/clk/mediatek/clk-pll.c | 5 ++++- drivers/clk/mediatek/clk-pll.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c index 513ab6b1b3229..9f08bc5d2a8a2 100644 --- a/drivers/clk/mediatek/clk-pll.c +++ b/drivers/clk/mediatek/clk-pll.c @@ -114,7 +114,10 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw, pll->data->pcw_shift); val |= pcw << pll->data->pcw_shift; writel(val, pll->pcw_addr); - chg = readl(pll->pcw_chg_addr) | PCW_CHG_MASK; + if (pll->data->pcw_chg_shift) + chg = readl(pll->pcw_chg_addr) | BIT(pll->data->pcw_chg_shift); + else + chg = readl(pll->pcw_chg_addr) | PCW_CHG_MASK; writel(chg, pll->pcw_chg_addr); if (pll->tuner_addr) writel(val + 1, pll->tuner_addr); diff --git a/drivers/clk/mediatek/clk-pll.h b/drivers/clk/mediatek/clk-pll.h index f17278ff15d78..d28d317e84377 100644 --- a/drivers/clk/mediatek/clk-pll.h +++ b/drivers/clk/mediatek/clk-pll.h @@ -44,6 +44,7 @@ struct mtk_pll_data { u32 pcw_reg; int pcw_shift; u32 pcw_chg_reg; + int pcw_chg_shift; const struct mtk_pll_div_table *div_table; const char *parent_name; u32 en_reg;