From: netdev-bot+sashiko@kernel.org
To: arouhi@sitime.com
Cc: jiri@resnulli.us, ivecera@redhat.com, vadim.fedorenko@linux.dev,
arkadiusz.kubalewski@intel.com, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, prabhakar.mahadev-lad.rj@bp.renesas.com,
cjubran@nvidia.com, Oleg.Zadorozhnyi@devoxsoftware.com,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v17 04/13] dpll: add basic SiTime SiT9531x support
Date: Thu, 03 Dec 2026 00:39:04 +0000 [thread overview]
Message-ID: <179625834403.3146.9112631689439856078@kernel.org> (raw)
In-Reply-To: <20261201235202.97645-5-arouhi@sitime.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The core rails can be switched off and on again during probe
deferral, which power-cycles the running part.
- [Low] The commit message gives an inaccurate reason for skipping
regmap's paged-range support: "A regmap paged range would read the…
- [Low] (Baseline decision: not confirmed.) The driver decides the
variant from two sources and never checks that they agree.
--
dpll: add basic SiTime SiT9531x support
This adds an I2C driver for the SiTime SiT9531x clock generator family.
Probe enables the supplies and the XO clock, releases the optional reset
line without pulsing it, waits TSTART, and reads the variant from the ID
register. Registers are accessed through a flat, uncached 256-byte regmap,
and the driver tracks the page select itself.
> diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c
> new file mode 100644
> index 0000000000000..6b9f3609f61c5
> --- /dev/null
> +++ b/drivers/dpll/sit9531x/core.c
[ ... ]
> +/*
> + * One 256-register page is visible at a time, selected by offset 0xFF on every
> + * page. The map covers that window, uncached; the accessors select the page.
> + */
> +static const struct regmap_config sit9531x_regmap_config = {
> + .reg_bits = 8,
> + .val_bits = 8,
> + .max_register = SIT9531X_PAGE_SEL,
> + .cache_type = REGCACHE_NONE,
> +};
> +
> +/* Caller holds page_lock. */
> +static int sit9531x_page_select(struct sit9531x_dev *sitdev, int page)
> +{
> + int rc;
> +
> + if (sitdev->page == page)
> + return 0;
> +
> + sitdev->page = -1;
> + rc = regmap_write(sitdev->regmap, SIT9531X_PAGE_SEL, page);
[Severity: Low]
The commit message gives this reason for not using a regmap paged range:
A regmap paged range would read the selector back on each access,
doubling the bus traffic.
Is that accurate? _regmap_select_page() changes the page through
_regmap_update_bits() on range->selector_reg. For a non-volatile selector,
the old value comes from _regmap_read(), which uses the cache when there is
one. The write only happens when the value changes:
drivers/base/regmap/regmap.c:_regmap_update_bits() {
...
ret = _regmap_read(map, reg, &orig);
...
if (force_write || (tmp != orig) || map->force_write_field) {
ret = _regmap_write(map, reg, tmp);
...
}
The selector would only be read back on every access because this config
uses REGCACHE_NONE.
zl3073x in the same directory already does this. It uses a
regmap_range_cfg with REGCACHE_MAPLE, and every register except ZL_PAGE_SEL
is volatile:
drivers/dpll/zl3073x/core.c:zl3073x_is_volatile_reg() {
/* Only page selector is non-volatile */
return reg != ZL_PAGE_SEL;
}
regmap also handles a selector that sits on every page (the page_chg logic
in _regmap_select_page()), which is the 0xFF layout used here.
Could the commit message be corrected? Alternatively, could the driver use
a regmap_range_cfg with a cached selector? That would replace the
hand-written sitdev->page and page_lock tracking, and the debugfs dump
would no longer just read whatever page was selected last.
[ ... ]
> +static int sit9531x_supplies_enable(struct sit9531x_dev *sitdev)
> +{
> + unsigned int i, n = ARRAY_SIZE(sit95316_out_supplies);
> + const char * const *names = sit95316_out_supplies;
> + int rc;
> +
> + rc = devm_regulator_bulk_get_enable(sitdev->dev,
> + ARRAY_SIZE(sit9531x_core_supplies),
> + sit9531x_core_supplies);
> + if (rc)
> + return dev_err_probe(sitdev->dev, rc,
> + "Failed to enable the core supplies\n");
> +
> + if (device_is_compatible(sitdev->dev, "sitime,sit95317")) {
> + names = sit95317_out_supplies;
> + n = ARRAY_SIZE(sit95317_out_supplies);
> + }
[Severity: Low]
This isn't a bug, but the variant is taken from two places that are never
compared. The supply list here follows the DT compatible. sitdev->info
(num_outputs, clkout_map) later comes only from the ID register in
sit9531x_dev_probe():
sitdev->info = sit9531x_match_variant(variant_id);
sit9531x_of_match[] has no .data, so nothing links a compatible to an
entry in sit9531x_chip_ids[].
If the DT names the wrong part, probe succeeds without any message. The
supplies requested are those of the DT-declared part, not the detected
one.
Later in the series, output pins outside the detected clkout_map are
warned about and ignored. So what remains is that the supply set follows
the DT and no mismatch is reported.
Would it be worth adding match data per compatible and printing a
dev_warn() when it disagrees with the variant ID?
> + for (i = 0; i < n; i++) {
> + rc = devm_regulator_get_enable_optional(sitdev->dev, names[i]);
> + if (rc && rc != -ENODEV)
> + return dev_err_probe(sitdev->dev, rc,
> + "Failed to enable %s-supply\n",
> + names[i]);
> + }
> +
> + return 0;
> +}
> +
> +static int sit9531x_dev_probe(struct sit9531x_dev *sitdev)
> +{
> + struct clk *xtal_clk;
> + u8 variant_id;
> + int rc;
> +
> + /*
> + * Request before enabling the XO: a probe deferral would gate the XO
> + * and remove the reference of a running part.
> + */
> + sitdev->reset_gpio = devm_gpiod_get_optional(sitdev->dev, "reset",
> + GPIOD_ASIS);
> + if (IS_ERR(sitdev->reset_gpio))
> + return dev_err_probe(sitdev->dev, PTR_ERR(sitdev->reset_gpio),
> + "Failed to request reset gpio\n");
> +
> + /* Before the XO as well, for the same reason */
> + rc = sit9531x_supplies_enable(sitdev);
> + if (rc)
> + return rc;
> +
> + /* Every rate the driver derives starts from the XO feeding XIN. */
> + xtal_clk = devm_clk_get_optional_enabled(sitdev->dev, "xtal");
> + if (IS_ERR(xtal_clk))
> + return dev_err_probe(sitdev->dev, PTR_ERR(xtal_clk),
> + "Failed to get xtal clock\n");
[Severity: Medium]
Can a probe deferral here power-cycle a running part?
By this point sit9531x_supplies_enable() has enabled vdd and vddin with
devm_regulator_bulk_get_enable(). Suppose the XO provider has not probed
yet and devm_clk_get_optional_enabled() returns -EPROBE_DEFER. The devres
unwind then runs regulator_action_disable() on the core rails.
The same thing can happen earlier, in the output rail loop of
sit9531x_supplies_enable(), which only tolerates -ENODEV:
rc = devm_regulator_get_enable_optional(sitdev->dev, names[i]);
if (rc && rc != -ENODEV)
return dev_err_probe(...);
If a vddoN or vdds supply is described in DT but its provider has not
registered yet, the call returns -EPROBE_DEFER. vdd and vddin are disabled
again on unwind.
_regulator_disable() turns the rail off when this driver is its last user
and the rail is not always-on:
drivers/regulator/core.c:_regulator_disable() {
...
if (rdev->use_count == 1 &&
(rdev->constraints && !rdev->constraints->always_on)) {
...
}
That includes rails enabled by the bootloader with regulator-boot-on,
because boot_on does not take a use_count reference.
Each deferral would then cut power to the part, and the efuse or pre-probe
NVM blob configuration that the reset handling tries to keep would be lost.
The commit message says the reset line is requested first "so a deferred
probe does not gate the clock of a running part". The regulators and the
XO don't get the same ordering, and the code at the end of the series
still has this order.
Would it work to get everything that can defer (the XO clock and all the
supplies) before enabling any of them?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201235202.97645-1-arouhi%40sitime.com
next prev parent reply other threads:[~2026-12-03 0:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 23:52 [PATCH net-next v17 00/13] dpll: add SiTime SiT9531x DPLL clock driver Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 02/13] dt-bindings: vendor-prefixes: add SiTime Corporation Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 01/13] dpll: omit pin phase attributes the driver has no value for Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 04/13] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko [this message]
2026-12-01 23:52 ` [PATCH net-next v17 03/13] dt-bindings: dpll: add SiTime SiT95316 clock generator Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 05/13] dpll: sit9531x: read DPLL types and pin properties from system firmware Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 06/13] dpll: sit9531x: register DPLL devices and pins Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 08/13] dpll: sit9531x: add support to get and set priority on input pins Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 07/13] dpll: sit9531x: implement input pin state on a DPLL Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 09/13] dpll: sit9531x: add support to get and set frequency on pins Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 10/13] dpll: sit9531x: implement output pin state on a DPLL Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 11/13] dpll: sit9531x: add support to adjust output phase Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 12/13] dpll: sit9531x: add support to get phase offset on the connected input Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 13/13] dpll: sit9531x: model the inter-PLL sync line as a pair of pins Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
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=179625834403.3146.9112631689439856078@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=Oleg.Zadorozhnyi@devoxsoftware.com \
--cc=arkadiusz.kubalewski@intel.com \
--cc=arouhi@sitime.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@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