From: sashiko-bot@kernel.org
To: "Gary Yang" <gary.yang@cixtech.com>
Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org, vkoul@kernel.org,
neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH v7 2/2] phy: cix: add Sky1 USB/DP combo PHY driver
Date: Wed, 02 Dec 2026 11:49:49 +0000 [thread overview]
Message-ID: <sashiko-outbox-245639@kernel.org> (raw)
In-Reply-To: <20261202112955.4189591-3-gary.yang@cixtech.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] phy: cix: udphy_dp_phy_configure() updates dp_lanes before
deferred reinit
--
commit 6e4b9a67038e72e16be73a6054110e0fe8ccde59
Author: Gary Yang <gary.yang@cixtech.com>
phy: cix: add Sky1 USB/DP combo PHY driver
This commit adds a driver for the CIX Sky1 USB/DP combo PHY, exposing
USB3 and DisplayPort PHYs and registering a Type-C orientation switch
and mode mux.
> diff --git a/drivers/phy/cix/phy-cix-usbdp.c b/drivers/phy/cix/phy-cix-usbdp.c
> new file mode 100644
> index 0000000000000..e5da39f75d56e
> --- /dev/null
> +++ b/drivers/phy/cix/phy-cix-usbdp.c
> @@ -0,0 +1,1722 @@
[ ... ]
> +static int udphy_dp_phy_configure(struct phy *phy,
> + union phy_configure_opts *opts)
> +{
> + struct cix_udphy *udphy = phy_get_drvdata(phy);
> + struct phy_configure_opts_dp *dp = &opts->dp;
> + int ret;
> +
> + guard(mutex)(&udphy->mutex);
[ ... ]
> + if (dp->set_rate) {
> + ret = udphy_dp_phy_verify_link_rate(dp);
> + if (ret)
> + return ret;
> + }
> +
> + if (dp->set_lanes) {
> + ret = udphy_dp_phy_verify_lanes(udphy, dp);
> + if (ret)
> + return ret;
> + }
> +
> + if (dp->set_voltages) {
> + ret = udphy_dp_phy_verify_voltages(udphy, dp);
> + if (ret)
> + return ret;
> + }
> +
> + /*
> + * The mode or the plug orientation may have changed while the DP PHY
> + * was already powered with the previous configuration, in which case
> + * the reprogramming was deferred until the lanes are free. Reprogram
> + * the PHY from the rate-setting call, which starts every link
> + * training run, and not from the voltage updates that follow it:
> + * resetting the block there would wipe the training progress.
> + * Otherwise the link would be trained against the previous lane
> + * mapping.
> + */
> + if (dp->set_rate && udphy->needs_reinit) {
> + ret = udphy->cfg->udphy_reinit(udphy);
> + if (ret) {
> + dev_err(udphy->dev, "failed to reconfigure udphy\n");
> + return ret;
> + }
> +
> + udphy->needs_reinit = false;
> +
> + /*
> + * The lane count configured in the previous mode only applies
> + * to that mode, so let the new mode's lane count apply unless
> + * the caller configured one for this mode already. Keep the
> + * bus width in sync as udphy_dp_phy_power_on() does.
> + */
> + udphy->dp_lanes = udphy_dp_lanes_after_reinit(udphy);
> +
> + phy_set_bus_width(phy, udphy_dplane_get(udphy));
> +
> + if (udphy->next_mode == UDPHY_MODE_DP)
> + udphy->cur_mode &= ~UDPHY_MODE_USB;
> + else if (udphy->u3_initialized)
> + udphy->cur_mode |= UDPHY_MODE_USB;
> + }
> +
> + /* All of the options are valid, so they can be applied now. */
> + if (dp->set_lanes) {
> + udphy->dp_lanes = dp->lanes;
> + udphy->lanes_configured = true;
> + }
[Severity: Medium]
Can setting udphy->dp_lanes = dp->lanes when dp->set_rate is false raise
udphy->dp_lanes to 4 while udphy->needs_reinit is still pending?
After a mux switch from 2-lane USB+DP to 4-lane DP while the DP PHY is
powered on, udphy_dp_phy_verify_lanes() validates dp->lanes against
udphy_dplane_get() (which uses udphy->next_mode and allows 4 lanes),
while the deferred udphy_reinit() only runs when dp->set_rate is true.
A phy_configure() call with set_lanes = 1 and set_rate = 0 (explicitly
anticipated by the comment above calling udphy_dp_lanes_after_reinit())
commits udphy->dp_lanes = 4 before the register table is switched, so
any voltage update in the same call or before set_rate runs writes
DisplayPort TX swing and pre-emphasis levels onto the two outer PMA
lanes that still carry USB3 signals.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202112955.4189591-1-gary.yang@cixtech.com?part=2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Gary Yang" <gary.yang@cixtech.com>
Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org, vkoul@kernel.org,
neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH v7 2/2] phy: cix: add Sky1 USB/DP combo PHY driver
Date: Wed, 02 Dec 2026 11:49:49 +0000 [thread overview]
Message-ID: <sashiko-outbox-245639@kernel.org> (raw)
In-Reply-To: <20261202112955.4189591-3-gary.yang@cixtech.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] phy: cix: udphy_dp_phy_configure() updates dp_lanes before
deferred reinit
--
commit 6e4b9a67038e72e16be73a6054110e0fe8ccde59
Author: Gary Yang <gary.yang@cixtech.com>
phy: cix: add Sky1 USB/DP combo PHY driver
This commit adds a driver for the CIX Sky1 USB/DP combo PHY, exposing
USB3 and DisplayPort PHYs and registering a Type-C orientation switch
and mode mux.
> diff --git a/drivers/phy/cix/phy-cix-usbdp.c b/drivers/phy/cix/phy-cix-usbdp.c
> new file mode 100644
> index 0000000000000..e5da39f75d56e
> --- /dev/null
> +++ b/drivers/phy/cix/phy-cix-usbdp.c
> @@ -0,0 +1,1722 @@
[ ... ]
> +static int udphy_dp_phy_configure(struct phy *phy,
> + union phy_configure_opts *opts)
> +{
> + struct cix_udphy *udphy = phy_get_drvdata(phy);
> + struct phy_configure_opts_dp *dp = &opts->dp;
> + int ret;
> +
> + guard(mutex)(&udphy->mutex);
[ ... ]
> + if (dp->set_rate) {
> + ret = udphy_dp_phy_verify_link_rate(dp);
> + if (ret)
> + return ret;
> + }
> +
> + if (dp->set_lanes) {
> + ret = udphy_dp_phy_verify_lanes(udphy, dp);
> + if (ret)
> + return ret;
> + }
> +
> + if (dp->set_voltages) {
> + ret = udphy_dp_phy_verify_voltages(udphy, dp);
> + if (ret)
> + return ret;
> + }
> +
> + /*
> + * The mode or the plug orientation may have changed while the DP PHY
> + * was already powered with the previous configuration, in which case
> + * the reprogramming was deferred until the lanes are free. Reprogram
> + * the PHY from the rate-setting call, which starts every link
> + * training run, and not from the voltage updates that follow it:
> + * resetting the block there would wipe the training progress.
> + * Otherwise the link would be trained against the previous lane
> + * mapping.
> + */
> + if (dp->set_rate && udphy->needs_reinit) {
> + ret = udphy->cfg->udphy_reinit(udphy);
> + if (ret) {
> + dev_err(udphy->dev, "failed to reconfigure udphy\n");
> + return ret;
> + }
> +
> + udphy->needs_reinit = false;
> +
> + /*
> + * The lane count configured in the previous mode only applies
> + * to that mode, so let the new mode's lane count apply unless
> + * the caller configured one for this mode already. Keep the
> + * bus width in sync as udphy_dp_phy_power_on() does.
> + */
> + udphy->dp_lanes = udphy_dp_lanes_after_reinit(udphy);
> +
> + phy_set_bus_width(phy, udphy_dplane_get(udphy));
> +
> + if (udphy->next_mode == UDPHY_MODE_DP)
> + udphy->cur_mode &= ~UDPHY_MODE_USB;
> + else if (udphy->u3_initialized)
> + udphy->cur_mode |= UDPHY_MODE_USB;
> + }
> +
> + /* All of the options are valid, so they can be applied now. */
> + if (dp->set_lanes) {
> + udphy->dp_lanes = dp->lanes;
> + udphy->lanes_configured = true;
> + }
[Severity: Medium]
Can setting udphy->dp_lanes = dp->lanes when dp->set_rate is false raise
udphy->dp_lanes to 4 while udphy->needs_reinit is still pending?
After a mux switch from 2-lane USB+DP to 4-lane DP while the DP PHY is
powered on, udphy_dp_phy_verify_lanes() validates dp->lanes against
udphy_dplane_get() (which uses udphy->next_mode and allows 4 lanes),
while the deferred udphy_reinit() only runs when dp->set_rate is true.
A phy_configure() call with set_lanes = 1 and set_rate = 0 (explicitly
anticipated by the comment above calling udphy_dp_lanes_after_reinit())
commits udphy->dp_lanes = 4 before the register table is switched, so
any voltage update in the same call or before set_rate runs writes
DisplayPort TX swing and pre-emphasis levels onto the two outer PMA
lanes that still carry USB3 signals.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202112955.4189591-1-gary.yang@cixtech.com?part=2
next prev parent reply other threads:[~2026-12-02 11:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 11:29 [PATCH v7 0/2] phy: cix: add Sky1 USB/DP combo PHY support Gary Yang
2026-12-02 11:29 ` Gary Yang
2026-12-02 11:29 ` [PATCH v7 1/2] dt-bindings: phy: add CIX Sky1 USB/DP combo PHY Gary Yang
2026-12-02 11:29 ` Gary Yang
2026-12-02 11:29 ` [PATCH v7 2/2] phy: cix: add Sky1 USB/DP combo PHY driver Gary Yang
2026-12-02 11:29 ` Gary Yang
2026-12-02 11:49 ` sashiko-bot [this message]
2026-12-02 11:49 ` sashiko-bot
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=sashiko-outbox-245639@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gary.yang@cixtech.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.