From: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: sashiko-reviews@lists.linux.dev,
Mattijs Korpershoek <mkorpershoek@kernel.org>
Cc: conor+dt@kernel.org, neil.armstrong@linaro.org,
olteanv@gmail.com, robh@kernel.org, vkoul@kernel.org,
linux-phy@lists.infradead.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 2/2] phy: qcom: qmp-usb: Add support for SA8255P
Date: Wed, 22 Jul 2026 16:32:23 +0200 [thread overview]
Message-ID: <875x27hz7s.fsf@kernel.org> (raw)
In-Reply-To: <20260722140157.619571F000E9@smtp.kernel.org>
On Wed, Jul 22, 2026 at 14:01, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
>
> New issues:
> - [High] Incorrect power domain sequencing in `d3_to_d0` and `d0_to_d3` transitions, violating hardware constraints.
>
> Pre-existing issues:
> - [High] Unbalanced clock prepare/enable and disable/unprepare, leading to `pipe_clk` enable count leak.
> --
>
> --- Patch [2]: [PATCH v3 2/2] phy: qcom: qmp-usb: Add support for SA8255P ---
> commit 2b06432a4f84c161e8379370587f792f91bca968
> Author: Sriram Dash <quic_sriramd@quicinc.com>
> Subject: phy: qcom: qmp-usb: Add support for SA8255P
>
> The Qualcomm automotive SA8255p SoC relies on firmware to configure
> platform resources, including clocks, interconnects and TLMM.
> This commit adds support for the SA8255p SoC in the QMP USB driver by
> using SCMI power protocols to manage platform resources via runtime PM
> framework APIs. Two sets of resources are modeled as "core" and "transfer"
> power domain suppliers.
>
>> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
>> index c5507168e1354..881f4ce23241e 100644
>> --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
>> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
> [ ... ]
>> @@ -1865,6 +1890,77 @@ static const struct qmp_phy_cfg glymur_usb3_uniphy_cfg = {
>> .regs = qmp_v7_usb3phy_regs_layout,
>> };
>>
>> +static int qmp_usb_domain_attach(struct qmp_usb *qmp)
>> +{
>> + struct dev_pm_domain_attach_data pd_data = {
>> + .pd_flags = PD_FLAG_NO_DEV_LINK,
>> + .pd_names = (const char *[]) { "transfer", "core" },
>> + .num_pd_names = 2,
>> + };
> [ ... ]
>> +/* d3_to_d0 transition by turning on all the suppliers */
>> +static int qmp_usb_d3_to_d0(struct qmp_usb *qmp)
>> +{
>> + int ret;
>> +
>> + if (!qmp->pd_list)
>> + return 0;
>> +
>> + ret = pm_runtime_resume_and_get(qmp->pd_list->pd_devs[0]);
>> + if (ret)
>> + return ret;
>> +
>> + ret = pm_runtime_resume_and_get(qmp->pd_list->pd_devs[1]);
>
> [Severity: High]
> Does resuming the 'transfer' domain before the 'core' domain cause hardware
> bus hangs?
>
> The commit message states that the "core" domain controls the GDSC (power),
> while the "transfer" domain controls clocks. It appears this sequence turns
> on the clocks before enabling power to the logic.
I have not observed any issues during my testing on a SA8775p board with
SCMI firmware (that's compatible with this driver)
>
>> + if (ret)
>> + pm_runtime_put_sync(qmp->pd_list->pd_devs[0]);
>> +
>> + return ret;
>> +}
>> +
>> +/* d0_to_d3 transition by turning off all the suppliers */
>> +static void qmp_usb_d0_to_d3(struct qmp_usb *qmp)
>> +{
>> + if (!qmp->pd_list)
>> + return;
>> +
>> + pm_runtime_put_sync(qmp->pd_list->pd_devs[1]);
>> + pm_runtime_put_sync(qmp->pd_list->pd_devs[0]);
>
> [Severity: High]
> Similarly, does suspending the 'core' domain before the 'transfer' domain
> cause issues?
>
> This sequence disables the GDSC (power) before disabling the clocks, which
> might also violate hardware constraints and lead to timeouts or freezes.
I have not observed any issues during my testing on a SA8775p board with
SCMI firmware (that's compatible with this driver)
>
>> +}
> [ ... ]
>> @@ -2126,14 +2234,23 @@ static int __maybe_unused qmp_usb_runtime_resume(struct device *dev)
>> return 0;
>> }
>
> [Severity: High]
> This is a pre-existing issue, but does this early bailout lead to a pipe_clk
> enable count leak?
>
> The code right above this addition in qmp_usb_runtime_resume() is:
>
> if (!qmp->phy->init_count) {
> dev_vdbg(dev, "PHY not initialized, bailing out\n");
> return 0;
> }
>
> During the standard PHY lifecycle, this check appears to cause an unbalanced
> clock prepare/enable and disable/unprepare state:
>
> 1. phy_init() starts with init_count == 0, so qmp_usb_runtime_resume() skips
> enabling clocks.
> 2. After phy_init() completes, init_count is 1, so phy_pm_runtime_put() causes
> qmp_usb_runtime_suspend() to disable pipe_clk, triggering a clock framework
> underflow warning since it was never enabled.
> 3. Conversely, during phy_exit(), init_count is 1, so qmp_usb_runtime_resume()
> enables pipe_clk. Then qmp_usb_exit() decrements init_count to 0.
> 4. Finally, phy_pm_runtime_put() triggers qmp_usb_runtime_suspend() (which
> has a similar bailout check), leaving pipe_clk permanently enabled and
> preventing the system from hitting deep sleep states.
>
> Can this state tracking be fixed to ensure the clocks are properly matched
> during suspend and resume?
This is unrelated to the patch I've submitted. Should this be send out
as a seperate fix?
>
>>
>> + ret = qmp_usb_d1_to_d0(qmp);
>> + if (ret < 0) {
>> + dev_err(qmp->dev, "Failed to transition to d0 state\n");
>> + return ret;
>> + }
>> +
>> ret = clk_bulk_prepare_enable(qmp->num_clks, qmp->clks);
>> - if (ret)
>> + if (ret) {
>> + qmp_usb_d0_to_d1(qmp);
>> return ret;
>> + }
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260722-phy-qcom-qmp-usb-8255-v3-0-e789070b48f7@kernel.org?part=2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
prev parent reply other threads:[~2026-07-22 14:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 13:45 [PATCH v3 0/2] Add support for SA8255P in the qcom-qmp-usb phy driver Mattijs Korpershoek
2026-07-22 13:45 ` [PATCH v3 1/2] dt-bindings: phy: Add sa8255p USB PHY Mattijs Korpershoek
2026-07-22 13:54 ` sashiko-bot
2026-07-22 13:45 ` [PATCH v3 2/2] phy: qcom: qmp-usb: Add support for SA8255P Mattijs Korpershoek
2026-07-22 14:01 ` sashiko-bot
2026-07-22 14:32 ` Mattijs Korpershoek [this message]
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=875x27hz7s.fsf@kernel.org \
--to=mkorpershoek@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@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