From: Ali Rouhi <arouhi@sitime.com>
To: "netdev-bot+sashiko@kernel.org" <netdev-bot+sashiko@kernel.org>
Cc: "jiri@resnulli.us" <jiri@resnulli.us>,
"vadim.fedorenko@linux.dev" <vadim.fedorenko@linux.dev>,
"arkadiusz.kubalewski@intel.com" <arkadiusz.kubalewski@intel.com>,
"ivecera@redhat.com" <ivecera@redhat.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"robh@kernel.org" <robh@kernel.org>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"cjubran@nvidia.com" <cjubran@nvidia.com>,
"Oleg.Zadorozhnyi@devoxsoftware.com"
<Oleg.Zadorozhnyi@devoxsoftware.com>,
"prabhakar.mahadev-lad.rj@bp.renesas.com"
<prabhakar.mahadev-lad.rj@bp.renesas.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v16 09/13] dpll: sit9531x: add support to get and set frequency on pins
Date: Tue, 1 Dec 2026 23:51:41 +0000 [thread overview]
Message-ID: <20261201235136.95422-8-arouhi@sitime.com> (raw)
In-Reply-To: <179548085020.3135.4311909833990050378@kernel.org>
On Tue, 24 Nov 2026 00:40:50 +0000, netdev-bot+sashiko@kernel.org wrote:
> > + "PLL%c: Fref * DIVN = %llu Hz is outside its VCO band\n",
> > + 'A' + pll_idx, *fvco);
> > + }
> > +
> > + return 0;
> > +}
>
> [Severity: Medium]
> If Fref * DIVN is above the low-band minimum but outside this PLL's own
> band, sit9531x_get_fvco() warns once and still returns 0. The comment
> above says such a value is usually not the rate the PLL runs at.
>
> For that PLL, sit9531x_output_freq_get() then reports and caches
> div64_u64(fvco, divo). sit9531x_output_divo_calc() rejects the same
> Fvco:
>
> if (!sit9531x_fvco_in_band(pll_idx, fvco)) {
> dev_dbg(sitdev->dev,
> "out%u: PLL%c Fvco %llu Hz is outside its VCO band, rate not settable\n",
> ...
> return -EINVAL;
> }
>
> So would a cascaded PLL report a nonzero DPLL_A_PIN_FREQUENCY that the
> driver itself treats as wrong?
>
> The commit message says "An output whose divider chain does not resolve
> reports 0 Hz". Should sit9531x_output_freq_get() apply the same band
> check and return -ENODATA?
>
> The later patch "dpll: sit9531x: add support to adjust output phase"
> adds the comment "Fref * DIVN outside the VCO band is not the rate the
> PLL runs at" in sit9531x_output_phase_adjust_set(). Even so,
> sit9531x_output_freq_get() still has no band check at the end of the
> series.
No. In v17 sit9531x_get_fvco() returns -ENODATA for a product outside
the PLL's VCO band; the getter reports 0 Hz and the setter refuses the
rate.
> > + ctrl | SIT9531X_DIVO_PHASE_TRIG);
> > +
> > +restore:
> > + ret = sit9531x_write_u8(sitdev, SIT9531X_REG_GPIO_FUNC_CTRL1, orig);
> > + if (ret && !rc)
> > + rc = ret;
>
> [Severity: Medium]
> regs.h describes the flush as "DIVO_PHASE_SEL_REG selects the register
> trigger; pulsing DIVO_PHASE_TRIG high then low flushes".
>
> Here, the final write of orig clears DIVO_PHASE_TRIG and restores
> DIVO_PHASE_SEL_REG in the same transfer. Suppose the profile had the pin
> trigger selected, so SEL_REG is clear in orig. Then the register
> trigger's high-to-low transition happens at the same moment the mux
> switches back to the external pin.
>
> If the flush acts on the falling edge, can the flush be missed while
> sit9531x_output_freq_set() still reports success? Would it help to write
> ctrl (SEL_REG set, TRIG clear) before restoring orig?
>
> The same ordering is still there at the end of the series in
> sit9531x_phase_flush_undo(), which writes the original ctrl straight
> after the TRIG-high write.
v17 lowers the trigger with the register select still set and restores
the select in a separate write after it, the order of the reference
sequence.
> > + sitdev->out[out_idx].freq = 0;
> > + return rc;
> > + }
> > +
> > + *frequency = div64_u64(fvco, divo);
> > + sitdev->out[out_idx].freq = *frequency;
>
> [Severity: Medium]
> Suppose the UPDATE_NVM write fails here but one of the LOOP_LOCK
> attempts that follow succeeds. sitdev->loops_open then ends up false,
> and nothing records that the bank update was never issued. Neither the
> retry in sit9531x_dev_chan_states_update() nor the one in
> sit9531x_dev_stop() will run, since both key on loops_open.
>
> sit9531x_output_freq_set() returns the error, but the five DIVO bytes
> from sit9531x_output_divo_write() stay in the registers. The back flag
> that sit9531x_output_divo_write() fills in is never checked.
>
> On that error, sit9531x_dpll_output_pin_frequency_set() calls
> sit9531x_output_freq_get(). That reads the new DIVO bytes back through
> sit9531x_output_divo_read() and caches Fvco / DIVO in
> sitdev->out[].freq. If the result differs from the old value, the
> setter then sends __dpll_pin_change_ntf().
>
> If the divider only takes effect once UPDATE_NVM is written, user space
> gets an error together with a notification for a rate the part is not
> running. The cached freq follows the uncommitted register contents
> rather than the hardware.
>
> Should a failed UPDATE_NVM be tracked as pending and retried by the
> poll worker? Or should sit9531x_output_freq_set() restore the old DIVO
> bytes before it closes the programming state?
>
> At the end of the series the retry path is sit9531x_prg_relock(), which
> does not repeat the bank update either.
v17 records a failed bank update and issues it again from the poll and
at removal, inside the programming sequence, so the divider the error
path reads back is the one the retry commits.
> [Severity: Medium]
> Can this value fall outside the range the pin advertises? For an output
> without supported-frequencies-hz, sit9531x_pin_props_get() advertises:
>
> ranges[j].min = 1;
> ranges[j].max = 1000000000ULL; /* 1 GHz */
>
> Fvco is at least SIT9531X_FVCO_LOWBAND_MIN (4.9152 GHz). A profile with
> DIVO of 4 or less therefore gives a reported frequency above 1 GHz. When
> there is a DT list, the truncated Fvco / DIVO also need not match any
> listed value.
>
> dpll_pin_freq_set() in the core calls dpll_pin_is_freq_supported() before
> its freq == old_freq shortcut. Writing back the value just read would
> then fail with "frequency is not supported by the device". Is that
> intended?
>
> The 1 GHz cap is unchanged at the end of the series.
It could in v16. In v17 an output without a list advertises the
datasheet rates, the setter accepts up to 2949.12 MHz and 250 MHz on an
LVCMOS output, and the getter rounds to the nearest hertz.
> >
> > + /* Retry pending writes first so the reads below see their result */
> > + if (sitdev->loops_open)
> > + sit9531x_prg_commit(sitdev);
> > +
> > sit9531x_input_off_retry(sitdev);
>
> [Severity: Medium]
> Does this retry run with the Page 3 debug key locked?
>
> When every LOOP_LOCK attempt fails, sit9531x_prg_commit() sets
> loops_open but still relocks the key at the end:
>
> sitdev->loops_open = !!rc2;
>
> msleep(100);
> ...
> rc3 = sit9531x_write_close(sitdev, SIT9531X_REG_OUTSYS_DEBUG,
> SIT9531X_DEBUG_LOCK_VAL);
>
> This retry calls sit9531x_prg_commit() directly, and so does the one in
> sit9531x_dev_stop(). Neither does the unlock that sit9531x_prg_enter()
> performs before every other PRG_DIR_GEN write:
>
> rc = sit9531x_write_u8(sitdev, SIT9531X_REG_OUTSYS_DEBUG,
> SIT9531X_DEBUG_UNLOCK_VAL);
>
> If PRG_DIR_GEN commands only take effect while the key is unlocked, the
> LOOP_LOCK write would be ACKed but have no effect, and loops_open would
> be cleared anyway. sit9531x_dev_stop() would then skip its "output loops
> left unlocked at removal" warning, and later readers of loops_open would
> treat the loops as closed.
>
> This retry also sends UPDATE_NVM again, outside the PRG_CMD sequence.
>
> The later patch "dpll: sit9531x: implement output pin state on a DPLL"
> changes the retry to sit9531x_prg_relock(), which drops the UPDATE_NVM.
> It still writes LOOP_LOCK without opening the debug window, though.
It did in v16. In v17 the retry opens the output-system debug key before
the loop lock, as the first attempt does, and with a bank update pending
it enters the programming sequence first.
> > struct regmap *regmap;
> > const struct sit9531x_chip_info *info;
> > - /* Serializes multi-step register sequences */
> > struct mutex multiop_lock;
> > - /* Serializes a page select and the transfer it is for */
> > struct mutex page_lock;
>
> [Severity: Low]
> This isn't a bug, but removing these two comments looks unrelated to
> frequency get/set, and the commit message doesn't mention it.
>
> The block comment above the struct is not kernel-doc, so checkpatch
> --strict will report "struct mutex definition without comment" for both
> locks. The comments are still missing at the end of the series.
Agreed. v17 leaves both comments in place.
next prev parent reply other threads:[~2026-12-01 23:52 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 22:57 [PATCH net-next v16 00/13] dpll: add SiTime SiT9531x DPLL clock driver Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 02/13] dt-bindings: vendor-prefixes: add SiTime Corporation Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 01/13] dpll: omit pin phase attributes the driver has no value for Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-12-01 23:51 ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 04/13] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-12-01 23:51 ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 03/13] dt-bindings: dpll: add SiTime SiT95316 clock generator Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-12-01 23:51 ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 05/13] dpll: sit9531x: read DPLL types and pin properties from system firmware Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-12-01 23:51 ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 06/13] dpll: sit9531x: register DPLL devices and pins Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-12-01 23:51 ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 07/13] dpll: sit9531x: implement input pin state on a DPLL Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-12-01 23:51 ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 08/13] dpll: sit9531x: add support to get and set priority on input pins Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-12-01 23:51 ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 10/13] dpll: sit9531x: implement output pin state on a DPLL Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-12-01 23:51 ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 09/13] dpll: sit9531x: add support to get and set frequency on pins Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-12-01 23:51 ` Ali Rouhi [this message]
2026-11-19 22:58 ` [PATCH net-next v16 11/13] dpll: sit9531x: add support to adjust output phase Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-12-01 23:51 ` Ali Rouhi
2026-11-19 22:58 ` [PATCH net-next v16 13/13] dpll: sit9531x: model the inter-PLL sync line as a pair of pins Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-12-01 23:51 ` Ali Rouhi
2026-11-19 22:58 ` [PATCH net-next v16 12/13] dpll: sit9531x: add support to get phase offset on the connected input Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-12-01 23:51 ` 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=20261201235136.95422-8-arouhi@sitime.com \
--to=arouhi@sitime.com \
--cc=Oleg.Zadorozhnyi@devoxsoftware.com \
--cc=arkadiusz.kubalewski@intel.com \
--cc=cjubran@nvidia.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=ivecera@redhat.com \
--cc=jiri@resnulli.us \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh@kernel.org \
--cc=vadim.fedorenko@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox