Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp7045500rdb; Fri, 15 Dec 2023 16:35:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHnvlbZO+Hlj2RIdkUitYUJjrG4mVZyXnu/aWveoU+8jOk5phEdzQb0ZNH+zvclHioTnbf X-Received: by 2002:a05:6214:e47:b0:67e:edc7:2dc4 with SMTP id o7-20020a0562140e4700b0067eedc72dc4mr8297627qvc.123.1702686912240; Fri, 15 Dec 2023 16:35:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702686912; cv=none; d=google.com; s=arc-20160816; b=TJz7WVQ38gjiOVqYKMRyUwERE7n0qfDJN8s8c5OTOgegMDva8a7XOFrt5Kncy5Ul8l 4v46hAs0Ozxmurvcntr4iRNAI+QUh6wjGYsnfxZbziLedFH53aiGMcOtIyHuliRa7qEB xnaKOW+FIqokB1oW5UgcaCkA5rZtkb/ZhHPSjp1TorSnDSFCUXDB82Bt8Ewr+yIEseWP SU++KoaSDcFJXCw+Md/yq+pY+ZyDho5UVkA0zaJ95u6fZN6bVDpofr4V8KVfMM3BuPhp RElYFXA5bByL67/UDKzD4p8pJeeQ1RSljT+iVNnjSBVR2R9MeE5s/vc1qATAxQyfaPk8 SMEw== 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=b1SxbJsT5wPgpGQsgDz26mhS8TIzyse1ptorI7vwkxk=; fh=aWV3XpeXqFuOXcqlbdPn+AaB/OnoAneH2eFkhlNpMCc=; b=XM9aDHbhcLeB0bLoReMj2/CPU7ApppVr92xRQcaFyED1oUeBrhJNeWjDQarp/0egbM OsvTJcXOl/sawadbBRdtXN9b8Ut4mkHu5ffHAyDMcfoRNPCsYSHOTzGjj+X5fJCFTG0A t6+rRIe3spl5CvTQEwM9Ctoo0EGKr+wLGdGX7cP8wrf7Bwi4eEH3B6/3G0L/fO6iG50i 04/uiYLR5AvHP6/i4a4+cGSqUUrFfNowp5gdsK53VWa6FfZt7Pj2StXqwnP6cwgsRmsR 3mkbc5gYP6AgBtS50hV+eYsR/bIJQx2MlCfWnD2j9ysKtnkxTqVHn5s8hvQw4C6cWBRW N3xA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1908-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1908-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s16-20020a0cb310000000b0067a8bf10affsi1291182qve.220.2023.12.15.16.35.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 16:35:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1908-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1908-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1908-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 001671C243F2 for ; Sat, 16 Dec 2023 00:35:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E42B341C93; Sat, 16 Dec 2023 00:23:32 +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 C753F44C91; Sat, 16 Dec 2023 00:23:27 +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 1rEISb-0001Yp-15; Sat, 16 Dec 2023 00:23:18 +0000 Date: Sat, 16 Dec 2023 00:23:14 +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 v6 4/5] clk: mediatek: add pcw_chg_bit control for PLLs of MT7988 Message-ID: <384cb034139239e06d1f8091492f47263b66e2e9.1702685864.git.daniel@makrotopia.org> References: <27f99db432e9ccc804cc5b6501d7d17d72cae879.1702685864.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.1702685864.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 --- 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