From: sashiko-bot@kernel.org
To: "Ali Rouhi" <arouhi@sitime.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v10 11/14] dpll: sit9531x: add support to get phase offset on the connected input pin
Date: Tue, 22 Sep 2026 20:11:47 +0000 [thread overview]
Message-ID: <20260922201147.803701F0089B@smtp.kernel.org> (raw)
In-Reply-To: <20260921201108.42676-12-arouhi@sitime.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dpll: sit9531x: permanent debug tap state corruption on I2C read failure
--
commit 86796ea4e61e041e1adcf2a7bb6d9a9966596b9a
Author: Oleg Zadorozhnyi <Oleg.Zadorozhnyi@devoxsoftware.com>
dpll: sit9531x: add support to get phase offset on the connected input pin
This patch adds support for reporting the phase difference between a PLL's
reference and the PLL itself in the sit9531x driver. It achieves this by
reading the on-chip time-to-digital converter through the debug window.
> diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c
> index c8c3cd6a64baf..8f6f8ffc8dc13 100644
> --- a/drivers/dpll/sit9531x/core.c
> +++ b/drivers/dpll/sit9531x/core.c
[ ... ]
> +/*
> + * sit9531x_phase_offset_read - read phase difference via TDC
> + * @phase_ps: output phase difference in picoseconds
> + *
> + * Reads the Time-to-Digital Converter (TDC) signed 35-bit code from the
> + * PLL page registers, then converts to picoseconds using the VCO
> + * frequency: phase_diff = tdc_code / fvco.
> + *
> + * Caller must hold sitdev->multiop_lock.
> + */
> +int sit9531x_phase_offset_read(struct sit9531x_dev *sitdev, u8 pll_idx,
> + s64 *phase_ps)
> +{
[ ... ]
> + /* Unlock the debug page so the TDC registers are accessible. */
> + rc = sit9531x_write_pll_u8(sitdev, pll_idx,
> + SIT9531X_PLL_REG_DEBUG,
> + SIT9531X_PLL_DEBUG_UNLOCK);
> + if (rc)
> + goto relock;
> +
> + /*
> + * Remember the tap selection so it can be put back. The key
> + * register is re-locked below, but the mux is not part of the key:
> + * leaving it parked on the TDC with a slow sampling clock selected
> + * is a state change the caller did not ask for, and the next reader
> + * of a different tap would have to know to undo it.
> + */
> + if (!sit9531x_read_pll_u8(sitdev, pll_idx,
> + SIT9531X_PLL_REG_DBG_WRITE_CODE,
> + &old_write_code) &&
> + !sit9531x_read_pll_u8(sitdev, pll_idx,
> + SIT9531X_PLL_REG_DBG_READ_CODE,
> + &old_read_code))
> + have_old = true;
[Severity: Medium]
What happens if the initial I2C reads fail here?
If a transient I2C read failure occurs when attempting to save the write
and read codes in sit9531x_phase_offset_read(), have_old remains false but
the function does not abort.
The function then proceeds to overwrite the registers, and eventually skips
the restoration during cleanup because have_old is false:
> +relock:
> + if (have_old) {
> + sit9531x_write_pll_u8(sitdev, pll_idx,
> + SIT9531X_PLL_REG_DBG_READ_CODE,
> + old_read_code);
> + sit9531x_write_pll_u8(sitdev, pll_idx,
> + SIT9531X_PLL_REG_DBG_WRITE_CODE,
> + old_write_code);
> + }
Could this permanently leave the debug tap state corrupted (parked on the TDC
with a slow clock enabled) and break subsequent reads of other taps?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260921201108.42676-1-arouhi@sitime.com?part=11
next prev parent reply other threads:[~2026-09-22 20:12 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 20:11 [PATCH v10 00/14] dpll: add SiTime SiT9531x DPLL clock driver Ali Rouhi
2026-09-21 20:11 ` [PATCH v10 02/14] dt-bindings: dpll: add SiTime SiT95316 clock generator Ali Rouhi
2026-09-26 2:34 ` Jakub Kicinski
2026-09-30 23:33 ` Ali Rouhi
2026-09-21 20:11 ` [PATCH v10 01/14] dt-bindings: vendor-prefixes: add SiTime Corporation Ali Rouhi
2026-09-21 20:11 ` [PATCH v10 03/14] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-09-26 2:34 ` Jakub Kicinski
2026-09-30 23:33 ` Ali Rouhi
2026-09-21 20:11 ` [PATCH v10 04/14] dpll: sit9531x: read DPLL types and pin properties from system firmware Ali Rouhi
2026-09-26 2:34 ` Jakub Kicinski
2026-09-21 20:11 ` [PATCH v10 05/14] dpll: sit9531x: register DPLL devices and pins Ali Rouhi
2026-09-26 2:34 ` Jakub Kicinski
2026-09-21 20:11 ` [PATCH v10 06/14] dpll: sit9531x: implement input pin state on a DPLL Ali Rouhi
2026-09-22 20:11 ` sashiko-bot
2026-09-26 2:34 ` Jakub Kicinski
2026-09-30 23:33 ` Ali Rouhi
2026-09-21 20:11 ` [PATCH v10 07/14] dpll: sit9531x: add support to get and set priority on input pins Ali Rouhi
2026-09-22 20:11 ` sashiko-bot
2026-09-26 2:34 ` Jakub Kicinski
2026-09-21 20:11 ` [PATCH v10 08/14] dpll: sit9531x: add support to get and set frequency on pins Ali Rouhi
2026-09-22 20:11 ` sashiko-bot
2026-09-26 2:34 ` Jakub Kicinski
2026-09-21 20:11 ` [PATCH v10 09/14] dpll: sit9531x: implement output pin state on a DPLL Ali Rouhi
2026-09-22 20:11 ` sashiko-bot
2026-09-26 2:34 ` Jakub Kicinski
2026-09-21 20:11 ` [PATCH v10 10/14] dpll: sit9531x: add support to adjust output phase Ali Rouhi
2026-09-22 20:11 ` sashiko-bot
2026-09-26 2:34 ` Jakub Kicinski
2026-09-21 20:11 ` [PATCH v10 11/14] dpll: sit9531x: add support to get phase offset on the connected input pin Ali Rouhi
2026-09-22 20:11 ` sashiko-bot [this message]
2026-09-26 2:34 ` Jakub Kicinski
2026-09-21 20:11 ` [PATCH v10 12/14] dpll: sit9531x: add support to get fractional frequency offset Ali Rouhi
2026-09-26 2:34 ` Jakub Kicinski
2026-09-21 20:11 ` [PATCH v10 13/14] dpll: sit9531x: model the inter-PLL sync net as a pair of pins Ali Rouhi
2026-09-22 20:11 ` sashiko-bot
2026-09-26 2:34 ` Jakub Kicinski
2026-09-21 20:11 ` [PATCH v10 14/14] dpll: sit9531x: allow the device tree to override two board facts Ali Rouhi
2026-09-22 20:11 ` sashiko-bot
2026-09-26 2:34 ` Jakub Kicinski
2026-09-28 23:29 ` [PATCH v10 00/14] dpll: add SiTime SiT9531x DPLL clock driver Jakub Kicinski
2026-09-29 0:38 ` Ali Rouhi
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=20260922201147.803701F0089B@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arouhi@sitime.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.