From: Jerome Brunet <jbrunet@baylibre.com>
To: Alex Elder <elder@riscstar.com>
Cc: sboyd@kernel.org, bmasney+clk@redhat.com,
jbrunet+clk@baylibre.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, andersson@kernel.org,
konradybcio@kernel.org, abelvesa@kernel.org, kees@kernel.org,
gustavoars@kernel.org, mohd.anwar@oss.qualcomm.com,
lorenzo.bianconi@oss.qualcomm.com, danielt@kernel.org,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-hardening@vger.kernel.org,
linux-kernel@vger.kernel.org, Brian Masney <masneyb@kernel.org>,
Daniel Thompson <daniel@riscstar.com>
Subject: Re: [PATCH v3 2/4] clk: toshiba: introduce a TC9564 SoC clock driver
Date: Tue, 13 Oct 2026 16:16:10 +0200 [thread overview]
Message-ID: <1jwlrlfzyt.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <155e6870-db07-4d28-af36-9b570280fdaa@riscstar.com>
On mar. 13 oct. 2026 at 08:37, Alex Elder <elder@riscstar.com> wrote:
> On 10/13/26 2:03 AM, Jerome Brunet wrote:
>> On lun. 12 oct. 2026 at 14:59, Alex Elder <elder@riscstar.com> wrote:
>>
>>>>> + TC9564_CLOCK_INIT0(MAC0_TX, 7),
>>>>> + TC9564_CLOCK_INIT0(MAC0_RX, 14),
>>>>> + TC9564_CLOCK_INIT0(MAC0_125M, 29),
>>>>> + TC9564_CLOCK_INIT0(MAC0_312_5M, 30),
>>>>
>>>> Are those really just providing the oscillator parent ?
>>>> That is what they will appear to do without a proper recalc_rate()
>>>
>>> They are fixed clocks that can be gated, but their
>>> rate cannot be changed.
>>
>> It is not a problem if the rate cannot be changed but still
>> a consumer could call clk_get_rate() and change its behavior
>> based on the result, so it is better if it does reflect the
>> reality to some extent.
>>
>> Just add fixed_factor clock elements on the path of clocks
>> where do know the output does not match the input osc
>
> OK. And because I'm not sure whether it matches reality, I'll
> do so in the code, and not expose these in devicetree. (If
> this is not correct, please say so.)
>
I don't think the DT folks like us messing with the binding IDs (Conor,
any opinion on this ?)
IMO, just do your best trying to figure things out and keep the IDs.
If we get some rate wrong, it is fine, we'll fix that later on.
It is even easier if you comment what you are unsure of.
What was not OK is pretending all the clock come directly
from the OSC through a gate. This is clearly no the case.
>>> Looking at __clk_core_init(), should I define a
>>> recalc_rate() callback that just returns the
>>> equivalent of get_rate()?
>>>
>>>> Their names suggest that maybe, it is not the osc coming out
>>>> of them ...
>>>
>>> We have requested a clock tree that explains exactly
>>> how these clock rates are derived from the 25 MHz
>>> oscillator. They're all fixed rates, and although
>>> we could easily speculate how they're derived, we
>>> don't have the documentation.
>>
>> If you know the input and output, you have enough to figure
>> out a fixed factor. If later on someone gets more information
>> than you, they'll just modify the clock tree.
>
> OK.
>
>> If you no idea what the ouput rate is, at least clearly say
>> so in the comment so a future user or contributor can easily
>> understand the situation.
>
> I'm pretty sure I know the output rate of all clocks, but
> if not I'll make sure there is such a comment.
Great
>
>>>>> + TC9564_CLOCK_INIT0(MAC0_ALL, 31),
>>
>> [...]
>>
>>>>> +
>>>>> + clk = devm_clk_get(dev, NULL);
>>>>> + if (IS_ERR(clk))
>>>>> + return dev_err_probe(dev, PTR_ERR(clk),
>>>>> + "failed to get input clock\n");
>>>>
>>>> Nothing is using this. This is not how you set the parent. See above
>>>
>>> It will once I have the clocks get properly parented.
>>
>> No it won't. You don't need a consumer clock reference. just drop it.
> OK, yes, the parent(s) will be specified in the init data.
> Sorry for this, and thank you for pointing it out.
>>>>> +
>>>>> + clocks = tc9564_clk_init(dev);
>>>>> + if (IS_ERR(clocks))
>>>>> + return dev_err_probe(dev, PTR_ERR(clocks),
>>>>> + "failed to initialize clocks\n");
>>>>> +
>>>>> + /* Force all clocks to be initially disabled */
>>>>> + tc9564_clock_disable_all(clocks);
>>>>
>>>> Why is this needed ? In general a provider should never act the provided
>>>> clock on its own. Let the framework deal with the used clocks
>>>
>>> The intent was to start with everything disabled--a known
>>> state. Sashiko pointed out this races with a user that
>>> could get the clock right away, so I intend to do this
>>> by initially disabling all the clocks before they're
>>> all registered.
>>
>> We do not do that because (in general) there maybe devices already using
>> a clock provided by your device and setup at a prior stage (like the
>> bootloader). Doing so would break them.
>>
>> Leave this alone, the framework will disable the unused clock for you
>> once the init is done and most devices have probed.
>
> OK, I'll drop this. Thank you very much for your review.
>
> -Alex
--
Jerome
next prev parent reply other threads:[~2026-10-13 14:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 15:24 [PATCH v3 0/4] clk: introduce TC9564 clock support Alex Elder
2026-10-12 15:24 ` [PATCH v3 1/4] dt-bindings: clock: introduce toshiba,tc9564-clock.yaml Alex Elder
2026-10-12 20:58 ` Conor Dooley
2026-10-12 15:24 ` [PATCH v3 2/4] clk: toshiba: introduce a TC9564 SoC clock driver Alex Elder
2026-10-12 19:02 ` Alex Elder
2026-10-12 19:10 ` Jerome Brunet
2026-10-12 19:59 ` Alex Elder
2026-10-13 7:03 ` Jerome Brunet
2026-10-13 13:37 ` Alex Elder
2026-10-13 14:16 ` Jerome Brunet [this message]
2026-10-12 15:24 ` [PATCH v3 3/4] arm64: dts: qcom: define a fixed 25 MHz clock Alex Elder
2026-10-12 16:02 ` Konrad Dybcio
2026-10-12 16:04 ` Alex Elder
2026-10-12 15:24 ` [PATCH v3 4/4] arm64: dts: qcom: qcs6490-rb3gen2: add the clock controller Alex Elder
2026-10-12 16:02 ` Konrad Dybcio
2026-10-12 16:04 ` Alex Elder
2026-10-12 19:10 ` [PATCH v3 0/4] clk: introduce TC9564 clock support Jerome Brunet
2026-10-12 19:59 ` Alex Elder
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=1jwlrlfzyt.fsf@starbuckisacylon.baylibre.com \
--to=jbrunet@baylibre.com \
--cc=abelvesa@kernel.org \
--cc=andersson@kernel.org \
--cc=bmasney+clk@redhat.com \
--cc=conor+dt@kernel.org \
--cc=daniel@riscstar.com \
--cc=danielt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=elder@riscstar.com \
--cc=gustavoars@kernel.org \
--cc=jbrunet+clk@baylibre.com \
--cc=kees@kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.bianconi@oss.qualcomm.com \
--cc=masneyb@kernel.org \
--cc=mohd.anwar@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.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