Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 v9 2/2] phy: cix: add Sky1 USB/DP combo PHY driver
Date: Fri, 04 Dec 2026 12:17:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-249777@kernel.org> (raw)
In-Reply-To: <20261204113906.563606-3-gary.yang@cixtech.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] phy: cix: sky1_udphy_init() and sky1_udphy_reinit() omit
  CMN_READY wait
- [Low] phy: cix: duplicate common and PLL register entries across mode
  tables
--

commit 95a3c95211c8745a0327c54cc4ef9066a334100d
Author: Gary Yang <gary.yang@cixtech.com>

phy: cix: add Sky1 USB/DP combo PHY driver

This commit adds the USB3/DisplayPort combo PHY driver for the CIX Sky1 SoC,
exposing independent USB3 and DP PHY instances along with Type-C orientation
switch and mux support.

> diff --git a/drivers/phy/cix/phy-cix-usbdp.c b/drivers/phy/cix/phy-cix-usbdp.c
> new file mode 100644
> index 0000000000000..e8b0d50624490
> --- /dev/null
> +++ b/drivers/phy/cix/phy-cix-usbdp.c
> @@ -0,0 +1,1839 @@

[ ... ]

> +static const struct reg_sequence sky1_udphy_usbdp_conf_normal[] = {
> +	{CMN_SSM_BIAS_TMR,              0x0018},
> +	{CMN_PLLSM0_PLLPRE_TMR,         0x0030},
> +	{CMN_PLLSM0_PLLLOCK_TMR,        0x00f0},

[ ... ]

> +static const struct reg_sequence sky1_udphy_dp_conf[] = {
> +	{CMN_SSM_BIAS_TMR,              0x0018},
> +	{CMN_PLLSM0_PLLPRE_TMR,         0x0030},
> +	{CMN_PLLSM0_PLLLOCK_TMR,        0x00f0},

[ ... ]

> +static const struct reg_sequence sky1_udphy_usbdp_conf_flip[] = {
> +	/* common_part */
> +	{CMN_SSM_BIAS_TMR,             0x0018},
> +	{CMN_PLLSM0_PLLPRE_TMR,        0x0030},
> +	{CMN_PLLSM0_PLLLOCK_TMR,       0x00f0},

[Severity: Low]
This isn't a bug, but sky1_udphy_usbdp_conf_normal[], sky1_udphy_dp_conf[],
and sky1_udphy_usbdp_conf_flip[] duplicate roughly 80 identical common timer,
PLL0/PLL1, PIPE USB3 Gen2, CDIAG, ISO PLL, and CMN_DIAG_GPANA_0 entries, and
expand identical per-lane writes four times despite PHY_LANE_STRIDE.

Factoring out a shared common table with smaller mode/orientation delta tables
(similar to the per_lane handling in drivers/phy/cix/phy-cix-dp.c) would avoid
this repetition and reduce the risk of the tables drifting out of sync.

[ ... ]

> +/* Reprogram the PHY after the mode or the plug orientation has changed. */
> +static int sky1_udphy_reinit(struct cix_udphy *udphy)
> +{
> +	udphy->active_flip = udphy->flip;
> +
> +	sky1_udphy_set_orientation(udphy);
> +
> +	/*
> +	 * The APB clock is still enabled, so the block can be reset without
> +	 * running the full power-on sequence again.
> +	 */
> +	reset_control_assert(udphy->reset);
> +	reset_control_assert(udphy->preset);
> +	reset_control_deassert(udphy->preset);
> +
> +	sky1_udphy_write_mode_table(udphy);
> +
> +	reset_control_deassert(udphy->reset);
> +
> +	return 0;
> +}
> +
> +static int sky1_udphy_init(struct cix_udphy *udphy)
> +{
> +	int ret;
> +
> +	udphy->active_flip = udphy->flip;
> +
> +	sky1_udphy_set_orientation(udphy);
> +
> +	/* usb rcsu reset is default deassert */
> +	reset_control_assert(udphy->reset);
> +	reset_control_assert(udphy->preset);
> +
> +	ret = sky1_udphy_clk_enable(udphy->apb_clk);
> +	if (ret) {
> +		dev_err(udphy->dev, "failed to enable APB clock\n");
> +		return ret;
> +	}
> +
> +	reset_control_deassert(udphy->preset);
> +
> +	sky1_udphy_write_mode_table(udphy);
> +
> +	reset_control_deassert(udphy->reset);
> +
> +	return 0;
> +}

[Severity: Medium]
Should sky1_udphy_init() and sky1_udphy_reinit() wait for
PHY_PMA_CMN_CTRL1_CMN_READY_BIT after deasserting udphy->reset?

sky1_reset_deassert() only sleeps 50 to 100 us, which does not guarantee the
PMA calibration timers have finished.  Only udphy_dp_phy_set_rate() calls
sky1_udphy_wait_common_ready(), so USB3 callers like cdns3-plat.c can enter
cdns_drd_init() and fail with -ENODEV before the PMA common block is ready.

A PMA startup timeout in sky1_udphy_init() also goes undetected, leaving
apb_clk enabled.  Polling sky1_udphy_wait_common_ready() in both functions
(matching phy-cix-dp.c and phy-rockchip-typec.c) and unwinding with
sky1_udphy_exit() on failure in sky1_udphy_init() avoids both issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204113906.563606-1-gary.yang@cixtech.com?part=2

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

      reply	other threads:[~2026-12-04 12:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 11:39 [PATCH v9 0/2] phy: cix: add Sky1 USB/DP combo PHY support Gary Yang
2026-12-04 11:39 ` [PATCH v9 1/2] dt-bindings: phy: add CIX Sky1 USB/DP combo PHY Gary Yang
2026-12-04 11:54   ` sashiko-bot
2026-12-04 15:14   ` Rob Herring (Arm)
2026-12-04 11:39 ` [PATCH v9 2/2] phy: cix: add Sky1 USB/DP combo PHY driver Gary Yang
2026-12-04 12:17   ` sashiko-bot [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=sashiko-outbox-249777@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox