Received: by 2002:a05:7412:361b:b0:f9:2edb:3e4d with SMTP id ie27csp47556rdb; Sun, 17 Dec 2023 13:51:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHkU7BqfVSr9q0mOb7Jly1wxa7o7UXQqZNB3yZLnMAb6CMNMoMj8dJkYmSB/qIIKmWQLy0 X-Received: by 2002:aa7:85d0:0:b0:6d5:4260:bf26 with SMTP id z16-20020aa785d0000000b006d54260bf26mr2032999pfn.6.1702849882352; Sun, 17 Dec 2023 13:51:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702849882; cv=none; d=google.com; s=arc-20160816; b=dmvxdafYQow3PJYKVSraaRexIL9L9VxA+sebESCqn34PVwZ1HyZSISILgS+YF6BZkj Z/p9UP9Z+bcj3TBVEBUmN3270n3fp8nGqx1c+JfML/voNMZdA1MVAbnV9ArxDQu4JBIk qedkQzsjLNL6EahD/71r1JFTCVxvdWo1QUgWSpDApA4dUr+KCj+MnpuaWlHs7+eEqaQ3 LfcjeQWjNPnaeHqBF3427yLS8G+kQ91xnk3nBE9AX1cfgW4JOyWo7Pb7JeH6HIN4KeBP 5WJIftozCA4N0jV0QBE1VrcSbhl/FnZ5nY7G69XU4yQZVug/A4kPH7bHZ7G/6UEiF/9V u5BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:to :from:date; bh=s3kRr3/jiajfGE2LHc0Al4ELdJmWLExVQWom7cSZ7SI=; fh=aWV3XpeXqFuOXcqlbdPn+AaB/OnoAneH2eFkhlNpMCc=; b=Zq79eimrVGWhqn2h7EP7t+gDzW3h1ErU08tU+6zAXVF5ZEv5reXSME5BGGQ16n7yOV S5Z2Y18GSWgGS2NpjBFR0LGJlg2Vpo8E6EEl0GeKfTN3anYryjGEs00pRsPzru9Mr+zQ MTrq48uHttz2d70ud/0kmb7yOfKdnOmrmzr+3ip79iEpzr13jCCsH6sJ4LCkROlSJus4 ExfSqzbLqmE3HH0gNvEn2CbPBuJPTasHwudUN4MSX/ibznoaadjvtGVmhsbLFHmPMskr G/QPAS5NOGfve6+qtYeMW9gpQQQlMTnmu1HI5Qs8W4cm2WcO8qrMa2zda/nnkmengWF/ CrmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-2835-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2835-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d17-20020a056a00245100b006d09555a9efsi11986944pfj.120.2023.12.17.13.51.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 13:51:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2835-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-2835-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2835-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 098A528298F for ; Sun, 17 Dec 2023 21:51:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 934854B15A; Sun, 17 Dec 2023 21:50:21 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2AAE49F6D; Sun, 17 Dec 2023 21:50:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1rEz1V-0001S0-1a; Sun, 17 Dec 2023 21:50:10 +0000 Date: Sun, 17 Dec 2023 21:50:07 +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 v7 4/5] clk: mediatek: add pcw_chg_bit control for PLLs of MT7988 Message-ID: <3b9c65ddb08c8bedf790aacf29871af026b6f0b7.1702849494.git.daniel@makrotopia.org> References: <27f99db432e9ccc804cc5b6501d7d17d72cae879.1702849494.git.daniel@makrotopia.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <27f99db432e9ccc804cc5b6501d7d17d72cae879.1702849494.git.daniel@makrotopia.org> 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 Reviewed-by: AngeloGioacchino Del Regno --- v7: no changes v6: no changes 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