From: Krzysztof Kozlowski <krzk@kernel.org>
To: Bjorn Andersson <andersson@kernel.org>
Cc: Stephan Gerhold <stephan.gerhold@linaro.org>,
Saravana Kannan <saravanak@google.com>,
Rob Herring <robh@kernel.org>,
Jassi Brar <jassisinghbrar@gmail.com>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
Georgi Djakov <djakov@kernel.org>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Subject: Re: [PATCH 1/4] dt-bindings: mailbox: qcom,apcs: Add separate node for clock-controller
Date: Wed, 11 Jun 2025 08:30:33 +0200 [thread overview]
Message-ID: <717e3f5f-1753-4715-b569-3d7567508d76@kernel.org> (raw)
In-Reply-To: <jvsdn67x2qm2avaktnpqzoixcd46xuuf6i5kpeolsnewgoqt6q@jid7unlmmu65>
On 11/06/2025 05:31, Bjorn Andersson wrote:
> On Fri, May 23, 2025 at 11:06:04AM +0200, Krzysztof Kozlowski wrote:
>> On Thu, May 22, 2025 at 09:53:12PM GMT, Stephan Gerhold wrote:
>>> +Saravana
>>>
>>> On Wed, May 21, 2025 at 11:20:40AM +0200, Krzysztof Kozlowski wrote:
>>>> On Wed, May 14, 2025 at 10:12:44PM GMT, Stephan Gerhold wrote:
>>>>>>>>> The mailbox itself does not need any clocks and should probe early to
>>>>
>>>> ... so probe it early.
>>>>
>>>>>>>>> unblock the rest of the boot process. The "clocks" are only needed for the
>>>>>>>>> separate clock controller. In Linux, these are already two separate drivers
>>>>>>>>> that can probe independently.
>>>>
>>>> They can probe later, no problem and DT does not stop that. Linux, not
>>>> DT, controls the ways of probing of devices and their children.
>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> Why does this circular dependency need to be broken in the DeviceTree
>>>>>>>> representation?
>>>>>>>>
>>>>>>>> As you describe, the mailbox probes and register the mailbox controller
>>>>>>>> and it registers the clock controller. The mailbox device isn't affected
>>>>>>>> by the clock controller failing to find rpmcc...
>>>>>>>>
>>>>>>>
>>>>>>> That's right, but the problem is that the probe() function of the
>>>>>>> mailbox driver won't be called at all. The device tree *looks* like the
>>>>>>> mailbox depends on the clock, so fw_devlink tries to defer probing until
>>>>>>> the clock is probed (which won't ever happen, because the mailbox is
>>>>>>> needed to make the clock available).
>>>>>>>
>>>>>>> I'm not sure why fw_devlink doesn't detect this cycle and tries to probe
>>>>>>> them anyway, but fact is that we need to split this up in order to avoid
>>>>>>> warnings and have the supplies/consumers set up properly. Those device
>>>>>>> links are created based on the device tree and not the drivers.
>>>>>>
>>>>>> Does "post-init-providers" providers solve your problem?
>>>>>>
>>>>>
>>>>> I would expect that it does, but it feels like the wrong solution to the
>>>>> problem to me. The clock is not really a post-init provider: It's not
>>>>> consumed at all by the mailbox and needed immediately to initialize the
>>>>> clock controller. The real problem in my opinion is that we're
>>>>> describing two essentially distinct devices/drivers in a single device
>>>>> node, and there is no way to distinguish that.
>>>>>
>>>>> By splitting up the two distinct components into separate device tree
>>>>> nodes, the relation between the providers/consumers is clearly
>>>>> described.
>>>>
>>>> You can split devices without splitting the nodes. I do not see reason
>>>> why the DT is the problem here.
>>>>
>>>
>>> The Linux drivers for this particular mailbox/clock controller already
>>> work exactly the way you propose. They are split into two devices that
>>> can probe independently.
>>>
>>> The problem is outside of the drivers, because fw_devlink in Linux
>>> blocks probing until all resources specified in the device tree nodes
>>> become available. fw_devlink has no knowledge that the mailbox described
>>> by this peculiar device tree node does not actually need the clocks:
>>>
>>> apcs1_mbox: mailbox@b011000 {
>>> compatible = "qcom,msm8939-apcs-kpss-global", "syscon";
>>> reg = <0x0b011000 0x1000>;
>>> #mbox-cells = <1>;
>>> clocks = <&a53pll_c1>, <&gcc GPLL0_VOTE>, <&rpmcc RPM_SMD_XO_CLK_SRC>;
>>> clock-names = "pll", "aux", "ref";
>>> #clock-cells = <0>;
>>> };
>>>
>>> Without device-specific quirks in fw_devlink, the fact that these clocks
>>> are only used by an unrelated clock controller only becomes clear if we
>>> split the device tree node like I propose in this series:
>>>
>>> apcs1_mbox: mailbox@b011000 {
>>> compatible = "qcom,msm8939-apcs-kpss-global", "syscon";
>>> reg = <0x0b011000 0x1000>;
>>> #mbox-cells = <1>;
>>>
>>> apcs1_clk: clock-controller {
>>> clocks = <&a53pll_c1>, <&gcc GPLL0_VOTE>, <&rpmcc RPM_SMD_XO_CLK_SRC>;
>>> clock-names = "pll", "aux", "ref";
>>> #clock-cells = <0>;
>>> };
>>> };
>>
>> Above code suggests that clocks are not needed for the mailbox at all.
>> You need to be really sure of that. If that's the case, then this
>> description looks like correct hardware description, more detailed then
>> the first case, though.
>>
>
> I'm still sceptical here.
>
> In the first snippet above, we describe a single IP block which provides
> mailboxes and clocks.
>
> In the second snippet we're saying that the IP block is a mailbox, and
> then it somehow have a subcomponent which is a clock provider.
>
> It seems to me that we're choosing the second option because it better
> fits the Linux implementation, rather than that it would be a better
I initially commented in similar way, however some more explanations
were provided.
> representation of the hardware. To the point that we can't even describe
> the register range of the subcomponent...
I did not check in any manual, so all my comments here are based on
above explanations and DTS.
Subnodes are allowed if they come with their own resources. You are
right there is no separate address space, so that's argument against
subnode. But there is separate clock, not needed for the parent (!!!),
which is an argument in favor.
>
>
> Can you confirm that this is the path we want to go here?
It is an acceptable solution to me, but I am not saying that every
device should be converted that way.
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-06-11 6:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 13:10 [PATCH 0/4] mailbox: qcom-apcs-ipc: Avoid circular dependency with clock controller Stephan Gerhold
2025-05-06 13:10 ` [PATCH 1/4] dt-bindings: mailbox: qcom,apcs: Add separate node for clock-controller Stephan Gerhold
2025-05-11 22:48 ` Bjorn Andersson
2025-05-13 13:16 ` Stephan Gerhold
2025-05-14 16:08 ` Rob Herring
2025-05-14 21:12 ` Stephan Gerhold
2025-05-21 9:20 ` Krzysztof Kozlowski
2025-05-22 19:53 ` Stephan Gerhold
2025-05-23 9:06 ` Krzysztof Kozlowski
2025-05-23 9:29 ` Stephan Gerhold
2025-06-11 3:31 ` Bjorn Andersson
2025-06-11 6:30 ` Krzysztof Kozlowski [this message]
2025-06-21 20:51 ` Stephen Boyd
2025-06-23 13:17 ` Stephan Gerhold
2025-07-17 17:30 ` Bjorn Andersson
2025-05-23 8:42 ` Krzysztof Kozlowski
2025-05-23 8:59 ` Stephan Gerhold
2025-05-23 9:07 ` Krzysztof Kozlowski
2025-05-06 13:10 ` [PATCH 2/4] mailbox: qcom-apcs-ipc: Assign OF node to clock controller child device Stephan Gerhold
2025-05-26 19:47 ` Jassi Brar
2025-05-28 19:21 ` Dmitry Baryshkov
2025-05-06 13:10 ` [PATCH 3/4] clk: qcom: apcs-msm8916: Obtain clock from own OF node Stephan Gerhold
2025-05-06 13:10 ` [PATCH 4/4] clk: qcom: apcs-sdx55: " Stephan Gerhold
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=717e3f5f-1753-4715-b569-3d7567508d76@kernel.org \
--to=krzk@kernel.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=djakov@kernel.org \
--cc=jassisinghbrar@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=saravanak@google.com \
--cc=sboyd@kernel.org \
--cc=stephan.gerhold@linaro.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;
as well as URLs for NNTP newsgroup(s).