From: Daniel Golle <daniel@makrotopia.org>
To: Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Sabrina Dubroca <sd@queasysnail.net>,
Daniel Golle <daniel@makrotopia.org>,
Chen-Yu Tsai <wenst@chromium.org>,
"Garmin.Chang" <Garmin.Chang@mediatek.com>,
Sam Shih <sam.shih@mediatek.com>,
Frank Wunderlich <frank-w@public-files.de>,
Dan Carpenter <dan.carpenter@linaro.org>,
James Liao <jamesjj.liao@mediatek.com>,
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
Date: Tue, 12 Dec 2023 03:19:34 +0000 [thread overview]
Message-ID: <a43ad2a0131ea35988dd490ab235d16d4119bc3a.1702350213.git.daniel@makrotopia.org> (raw)
In-Reply-To: <152b256d253508cdc7514c0f1c5a9324bde83d46.1702350213.git.daniel@makrotopia.org>
From: Sam Shih <sam.shih@mediatek.com>
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 <sam.shih@mediatek.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
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
next prev parent reply other threads:[~2023-12-12 3:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 3:18 [PATCH v5 1/5] dt-bindings: clock: mediatek: add MT7988 clock IDs Daniel Golle
2023-12-12 3:18 ` [PATCH v5 2/5] dt-bindings: reset: mediatek: add MT7988 ethwarp reset IDs Daniel Golle
2023-12-12 9:32 ` AngeloGioacchino Del Regno
2023-12-13 7:00 ` Krzysztof Kozlowski
2023-12-12 3:18 ` [PATCH v5 3/5] dt-bindings: clock: mediatek: add clock controllers of MT7988 Daniel Golle
2023-12-12 9:32 ` AngeloGioacchino Del Regno
2023-12-13 7:04 ` Krzysztof Kozlowski
2023-12-12 3:19 ` Daniel Golle [this message]
2023-12-12 9:31 ` [PATCH v5 4/5] clk: mediatek: add pcw_chg_bit control for PLLs " AngeloGioacchino Del Regno
2023-12-12 3:19 ` [PATCH v5 5/5] clk: mediatek: add drivers for MT7988 SoC Daniel Golle
2023-12-12 9:31 ` AngeloGioacchino Del Regno
2023-12-12 9:33 ` [PATCH v5 1/5] dt-bindings: clock: mediatek: add MT7988 clock IDs AngeloGioacchino Del Regno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a43ad2a0131ea35988dd490ab235d16d4119bc3a.1702350213.git.daniel@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=Garmin.Chang@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=frank-w@public-files.de \
--cc=jamesjj.liao@mediatek.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mturquette@baylibre.com \
--cc=netdev@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
--cc=sam.shih@mediatek.com \
--cc=sboyd@kernel.org \
--cc=sd@queasysnail.net \
--cc=wenst@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®