From: "Yu-Chun Lin [林祐君]" <eleanor.lin@realtek.com>
To: Brian Masney <bmasney@redhat.com>
Cc: "mturquette@baylibre.com" <mturquette@baylibre.com>,
"sboyd@kernel.org" <sboyd@kernel.org>,
"robh@kernel.org" <robh@kernel.org>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"Edgar Lee [李承諭]" <cylee12@realtek.com>,
"Jyan Chou [周芷安]" <jyanchou@realtek.com>,
"afaerber@suse.com" <afaerber@suse.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-realtek-soc@lists.infradead.org"
<linux-realtek-soc@lists.infradead.org>,
"James Tai [戴志峰]" <james.tai@realtek.com>,
"CY_Huang[黃鉦晏]" <cy.huang@realtek.com>,
"Stanley Chang[昌育德]" <stanley_chang@realtek.com>
Subject: RE: [PATCH v11 08/11] clk: realtek: Add support for MMC-tuned PLL clocks
Date: Fri, 31 Jul 2026 08:13:43 +0000 [thread overview]
Message-ID: <b6a9451f04e34051b06d16778b12feb4@realtek.com> (raw)
In-Reply-To: <amt_dXo576fJeqKU@redhat.com>
Hi Brian,
> Hi Yu-Chun,
>
> On Tue, Jul 28, 2026 at 10:28:03PM +0800, Yu-Chun Lin wrote:
> > From: Cheng-Yu Lee <cylee12@realtek.com>
(...)
> > +static int rtk_clk_regmap_pll_mmc_phase_get_phase(struct clk_hw *hw)
> > +{
> > + struct clk_hw *hwp;
> > + struct rtk_clk_regmap_pll_mmc *clkm;
> > + int phase_id;
> > + int ret;
> > + u32 val;
>
> Put in reverse Christmas tree order. You can combine the two int rows.
>
Ack.
> > +
> > + hwp = clk_hw_get_parent(hw);
> > + if (!hwp)
> > + return -ENOENT;
> > +
> > + clkm = to_clk_pll_mmc(hwp);
> > + phase_id = (hw == &clkm->phase0_hw) ? 0 : 1;
> > + ret = get_phsel(clkm, phase_id, &val);
> > + if (ret)
> > + return ret;
> > +
> > + val = DIV_ROUND_CLOSEST(val * CYCLE_DEGREES, PHASE_STEPS);
> > +
> > + return val;
> > +}
> > +
> > +const struct clk_ops rtk_clk_pll_mmc_phase_ops = {
> > + .set_phase = rtk_clk_regmap_pll_mmc_phase_set_phase,
> > + .get_phase = rtk_clk_regmap_pll_mmc_phase_get_phase,
> > +};
> > +EXPORT_SYMBOL_NS_GPL(rtk_clk_pll_mmc_phase_ops, "REALTEK_CLK");
>
> Just looking at existing clk drivers, there's 5 that use
> EXPORT_SYMBOL_NS_GPL(). 3 of them use CLK_FOO, so let's just make this
> CLK_REALTEK for consistency with the other drivers. I like this because it's
> framework/clk subsystem. I'm not going to call this out on the other patches.
>
Ack. Will rename to CLK_REALTEK.
> > +
(...)
> > +static int rtk_clk_regmap_pll_mmc_set_rate(struct clk_hw *hw, unsigned
> long rate,
> > + unsigned long parent_rate)
> {
> > + struct rtk_clk_regmap_pll_mmc *clkm = to_clk_pll_mmc(hw);
> > + u32 val = RTK_PLL_MMC_SSC_DIV_N_VAL;
> > + int ret;
> > +
> > + /*
> > + * The 'rate' and 'parent_rate' are intentionally unused here.
> > + *
> > + * Despite receiving various rate requests (e.g., 26MHz, 52MHz,
> 200MHz),
> > + * this function consistently configures the hardware for 27MHz
> (0x1b).
> > + * This is because these settings reflect the input reference clock
> > + * frequency to the SSCPLL, not the final PLL output frequency.
> > + *
> > + * The actual frequency division to achieve the requested eMMC rate
> > + * is handled internally by the downstream eMMC host controller.
> > + */
> > +
> > + ret = regmap_update_bits(clkm->clkr.regmap,
> > + clkm->ssc_dig_ofs +
> RTK_PLL_SSC_DIG_EMMC1_OFFSET,
> > + RTK_PLL_FLAG_INITAL_EMMC_MASK,
> > + 0x0 <<
> RTK_PLL_FLAG_INITAL_EMMC_SHIFT);
>
> determine_rate() above implies that this PLL can do multiple frequencies.
> There will be a mismatch between what the clk core thinks the frequency is
> compared to what's actually programmed in the hardware. Should
> determine_rate above also return the fixed rate as well?
>
> Brian
You're right. This PLL is actually configured to operate at a fixed
frequency for the MMC.
Will update determine_rate() like this:
val = RTK_PLL_MMC_SSC_DIV_N_VAL + 2;
req->rate = req->best_parent_rate / 4 * val +
(req->best_parent_rate / 4 * 1517) / 8192;
Best Regards,
Yu-Chun
next prev parent reply other threads:[~2026-07-31 8:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 14:27 [PATCH v11 00/11] clk / reset: realtek: Add RTD1625 clock and reset support Yu-Chun Lin
2026-07-28 14:27 ` [PATCH v11 01/11] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller Yu-Chun Lin
2026-07-30 16:28 ` Brian Masney
2026-07-31 6:08 ` Krzysztof Kozlowski
2026-07-31 7:56 ` Yu-Chun Lin [林祐君]
2026-07-28 14:27 ` [PATCH v11 02/11] reset: Add Realtek basic reset support Yu-Chun Lin
2026-07-28 14:27 ` [PATCH v11 03/11] reset: realtek: Add RTD1625 reset controller driver Yu-Chun Lin
2026-07-28 14:27 ` [PATCH v11 04/11] clk: realtek: Introduce a common probe() Yu-Chun Lin
2026-07-30 16:33 ` Brian Masney
2026-07-28 14:28 ` [PATCH v11 05/11] clk: realtek: Add support for phase locked loops (PLLs) Yu-Chun Lin
2026-07-30 16:31 ` Brian Masney
2026-07-28 14:28 ` [PATCH v11 06/11] clk: realtek: Add support for gate clock Yu-Chun Lin
2026-07-30 16:35 ` Brian Masney
2026-07-28 14:28 ` [PATCH v11 07/11] clk: realtek: Add support for mux clock Yu-Chun Lin
2026-07-30 16:35 ` Brian Masney
2026-07-28 14:28 ` [PATCH v11 08/11] clk: realtek: Add support for MMC-tuned PLL clocks Yu-Chun Lin
2026-07-30 16:44 ` Brian Masney
2026-07-31 8:13 ` Yu-Chun Lin [林祐君] [this message]
2026-07-28 14:28 ` [PATCH v11 09/11] clk: realtek: Add RTD1625-CRT clock controller driver Yu-Chun Lin
2026-07-30 16:54 ` Brian Masney
2026-07-31 8:17 ` Yu-Chun Lin [林祐君]
2026-07-31 15:02 ` Brian Masney
2026-07-28 14:28 ` [PATCH v11 10/11] clk: realtek: Add RTD1625-ISO " Yu-Chun Lin
2026-07-30 16:55 ` Brian Masney
2026-07-28 14:28 ` [PATCH v11 11/11] arm64: dts: realtek: Add clock support for RTD1625 Yu-Chun Lin
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=b6a9451f04e34051b06d16778b12feb4@realtek.com \
--to=eleanor.lin@realtek.com \
--cc=afaerber@suse.com \
--cc=bmasney@redhat.com \
--cc=conor+dt@kernel.org \
--cc=cy.huang@realtek.com \
--cc=cylee12@realtek.com \
--cc=devicetree@vger.kernel.org \
--cc=james.tai@realtek.com \
--cc=jyanchou@realtek.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-realtek-soc@lists.infradead.org \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=stanley_chang@realtek.com \
/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