Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4392711rdb; Mon, 11 Dec 2023 19:19:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLykjSYZxz5nlYuFg1vmTiD3t3IDRGWt99Bq48pl74ncrf6RjwBgetUmvHqpHTVQowpMRz X-Received: by 2002:a17:90a:1049:b0:286:e125:1a3f with SMTP id y9-20020a17090a104900b00286e1251a3fmr2441770pjd.5.1702351196853; Mon, 11 Dec 2023 19:19:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702351196; cv=none; d=google.com; s=arc-20160816; b=z32HDZWtk5ItdZQpgIisNLhr/RtILX+A8dLWgTFjhtn1p5TXmEMNxVM6+zjUsjPBjA DHZkUySKmZrv2go3KTFq0r7zHt1hrrn+CpcLh6q1E1YRaThpQP2aOSFQYj03PTIv97lZ ojR+sCQvliid/2K/mSQ/F+A7Uh/g0XFtWkkmrSMtqCyi6kiKPf1zP1QaVBIlFL71d16i wcrvi/mAusI/FPZAXhS3BemtESX1FhMAfdBT1I70aB7KH933jVs66y8tRw00i0Dgq3jF 17YY1JfYoAnz7ZoDpuSLLmkHbsGd8OyF/reUYZg0ZdQ/6+/TCNGiWhs3mUUBPutwiDHN 82Ow== 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=Fcv8Vi5ZUFv/ANYiMyYzvw4iJaLbArLioIEUEspblwc=; fh=aWV3XpeXqFuOXcqlbdPn+AaB/OnoAneH2eFkhlNpMCc=; b=y8g30ao4tU11l92yXKpyVFqWcCa8YpECyFt87/b4DGaVbYKI95xvusM+IWReTHy7Ou Q0/Xoy7azDDGuSXnt6SwBepx83vFR70GWRf6/DO0HHD1DIwitT3nW1gIoDf29SCSE8aA nTpSB0WvRjKnQEAaRoqcFHEooHmtATThlmc6r2JvuHv6tkHWFjd1iuDJ0Z4QPglcg263 TW4wTn5e48lG0s7u2gwz/qlNMV+13kKoLtdzrI4p81riknySJvEkZN6IhnXgesTRgj6y VREA/FbtSjBT5XEYZD/X8u62BELfkPd3gLDefgQHmk5NzlADHlNyPF0b5I64bRFn36OS cfiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id r6-20020a17090a560600b00286b854b672si8427672pjf.157.2023.12.11.19.19.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 19:19:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 9408880227DD; Mon, 11 Dec 2023 19:19:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345801AbjLLDTl (ORCPT + 99 others); Mon, 11 Dec 2023 22:19:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232156AbjLLDTk (ORCPT ); Mon, 11 Dec 2023 22:19:40 -0500 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 751BCCD; Mon, 11 Dec 2023 19:19:46 -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 1rCtJ2-0002iU-3D; Tue, 12 Dec 2023 03:19:38 +0000 Date: Tue, 12 Dec 2023 03:19:34 +0000 From: Daniel Golle To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Turquette , Stephen Boyd , Matthias Brugger , AngeloGioacchino Del Regno , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Philipp Zabel , Sabrina Dubroca , Daniel Golle , Chen-Yu Tsai , "Garmin.Chang" , Sam Shih , Frank Wunderlich , Dan Carpenter , James Liao , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org Subject: [PATCH v5 4/5] clk: mediatek: add pcw_chg_bit control for PLLs of MT7988 Message-ID: References: <152b256d253508cdc7514c0f1c5a9324bde83d46.1702350213.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <152b256d253508cdc7514c0f1c5a9324bde83d46.1702350213.git.daniel@makrotopia.org> 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 morse.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 (morse.vger.email [0.0.0.0]); Mon, 11 Dec 2023 19:19:54 -0800 (PST) From: Sam Shih Introduce pcw_chg_bit member to struct mtk_pll_data and use it instead of the previously hardcoded PCW_CHG_MASK macro if set. This will needed for clocks on the MT7988 SoC. Signed-off-by: Sam Shih Signed-off-by: Daniel Golle --- v5: rename to .pcw_chg_bit, use ? operator instead of changing every single existing driver. The approach in v4 doesn't work as if .pcw_chg_reg is unset/0, pll->pcw_chg_addr will default to pll->base_addr + REG_CON1. Hence setting .pcw_chg_bit would be required for *all* drivers instead of just those setting .pcs_chf_reg. And that seems like an excessive change which can easily be avoided by using the ? operator to set the default at runtime (and we can easily cope with that overhead). v4: always set .pcw_chg_shift if .pcw_chg_reg is used instead of having an if-expression in mtk_pll_set_rate_regs(). v3: use git --from ... v2: no changes drivers/clk/mediatek/clk-pll.c | 5 +++-- drivers/clk/mediatek/clk-pll.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c index 513ab6b1b3229..ce453e1718e53 100644 --- a/drivers/clk/mediatek/clk-pll.c +++ b/drivers/clk/mediatek/clk-pll.c @@ -23,7 +23,7 @@ #define CON0_BASE_EN BIT(0) #define CON0_PWR_ON BIT(0) #define CON0_ISO_EN BIT(1) -#define PCW_CHG_MASK BIT(31) +#define PCW_CHG_BIT 31 #define AUDPLL_TUNER_EN BIT(31) @@ -114,7 +114,8 @@ 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; + chg = readl(pll->pcw_chg_addr) | + BIT(pll->data->pcw_chg_bit ? : PCW_CHG_BIT); 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..285c8db958b39 100644 --- a/drivers/clk/mediatek/clk-pll.h +++ b/drivers/clk/mediatek/clk-pll.h @@ -48,6 +48,7 @@ struct mtk_pll_data { const char *parent_name; u32 en_reg; u8 pll_en_bit; /* Assume 0, indicates BIT(0) by default */ + u8 pcw_chg_bit; }; /* -- 2.43.0