mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 04/13] dpll: add basic SiTime SiT9531x support
Date: Tue, 1 Dec 2026 23:51:39 +0000	[thread overview]
Message-ID: <20261201235136.95422-3-arouhi@sitime.com> (raw)
In-Reply-To: <179548083614.3135.11915403348553233279@kernel.org>

On Tue, 24 Nov 2026 00:40:36 +0000, netdev-bot+sashiko@kernel.org wrote:

> > The register space is 32 pages of 256 registers, selected through offset
> > 0xFF of any page. The regmap is the flat 256-byte window, and the
> > accessors select the page under a lock. A regmap paged range is not
> > used: it reads the selector back on each access, which doubles the bus
> > traffic, and a debugfs access would move the page under the driver.
>
> [Severity: Low]
>
> Does the debugfs part of this rationale hold for regmap ranges?
>
> As far as I can tell, _regmap_select_page() in drivers/base/regmap/regmap.c
> selects the page again on every access through the range, under the
> regmap lock:
>
>     ret = _regmap_update_bits(map, range->selector_reg,
>                               range->selector_mask,
>                               win_page << range->selector_shift,
>                               NULL, false);
>
> So a debugfs access should not leave a range-based driver with a stale
> page.
>
> The flat window chosen here looks like the design that has the
> page-tracking hazard. sit9531x_page_select() trusts the cached value and
> skips the selector write:
>
>     if (sitdev->page == page)
>         return 0;
>
> The regmap debugfs registers file for sit9531x_regmap_config dumps offsets
> 0x00-0xFF of whatever page the driver last selected. It does this without
> taking page_lock, and the dump does not say which page it shows.
>
> Debugfs writes to 0xFF are compiled out by default
> (REGMAP_ALLOW_WRITE_DEBUGFS is undefined), so hitting the stale cache case
> needs a source change.
>
> Could the commit message describe this tradeoff more precisely?

No, and v17 drops the debugfs reason. The message now gives only the bus
traffic: with no register cache, a paged range reads the selector back
on every access.

> > Suggested-by: Ivan Vecera <ivecera@redhat.com>
> > Signed-off-by: Oleg Zadorozhnyi <Oleg.Zadorozhnyi@devoxsoftware.com>
> > Signed-off-by: Ali Rouhi <arouhi@sitime.com>
>
> [Severity: Low]
>
> This isn't a bug, but core.c, core.h and regs.h all name Ali Rouhi first
> as Author in their headers, and MODULE_AUTHOR() lists him first too. If
> he co-developed the patch, should there be a Co-developed-by: tag right
> before his Signed-off-by:, as Documentation/process/submitting-patches.rst
> describes?

v17 adds Co-developed-by: Ali Rouhi ahead of his Signed-off-by, after
Oleg's Signed-off-by as author.

> > +
> > +	/*
> > +	 * Fvco = Fref * (DIVN + frac/2^32); Fref is the rate of the XO feeding
> > +	 * XIN/XO_CLK.
> > +	 */
> > +	xtal_clk = devm_clk_get_optional_enabled(sitdev->dev, "xtal");
>
> [Severity: Medium]
>
> The comment above says the goal is to avoid gating the XO of a running
> part. Doesn't devm_clk_get_optional_enabled() still gate it on every
> failure path after this point?
>
> drivers/clk/clk-devres.c implements it as:
>
>     return __devm_clk_get(dev, id, clk_get_optional,
>                           clk_prepare_enable, clk_disable_unprepare);
>
> So devres calls clk_disable_unprepare() on any probe failure after this
> point, while the part stays out of reset and configured. That includes:
>
>   - the "no xtal rate" -EINVAL return
>   - a gpiod_direction_output() failure
>   - a transient I2C error from sit9531x_read_variant_id()
>   - the "Unknown variant ID" -ENODEV return
>   - a devm_mutex_init() failure
>
> The driver has no .remove and is fully devm-managed, so a sysfs unbind or
> rmmod gates the XO as well.
>
> Later patches in the series add more failure points after the XO enable
> (sit9531x_devm_dpll_init(), devm_request_threaded_irq()), and the XO is
> still devm-enabled.
>
> If the XO is gateable and this driver is its only consumer, won't this
> stop the reference of a chip running from its efuse/NVM configuration?

devres balances the enable on a failed probe and on unbind, as for any
consumer. A clock that must keep running with no driver bound is lost at
clk_disable_unused() unless its provider marks it critical, so holding
the enable while bound can't be that guarantee. The reset line and the
supplies are requested before the enable, so a deferral does not gate
the XO. The v17 message says what devres releases.

> > +			return dev_err_probe(sitdev->dev, rc,
> > +					     "Failed to release the reset line\n");
> > +		fsleep(10000);	/* internal boot after release */
> > +	}
> > +
> > +	rc = sit9531x_read_variant_id(sitdev, &variant_id);
>
> [Severity: Medium]
>
> Should probe get and enable the supplies defined in the binding before
> this first I2C access?
>
> The binding in this series (sitime,sit95316.yaml) documents vdd-supply,
> vddin-supply, vdds-supply and the vddoN-supply rails. It says they are
> there so that "a board with switchable rails" can describe them, and its
> example points vdd-supply/vddin-supply at &reg_1v8/&reg_3v3.
>
> The binding commit does note "The driver does not enable them", and
> sit9531x_dev_probe() makes no regulator call.
>
> If the rail is off at probe on such a board, this read goes to an
> unpowered part. Probe then fails with an I2C error or a misleading
> "Unknown variant ID", and nothing points at the missing supply.
>
> If the bootloader left the rail on, no consumer claims it. Wouldn't
> regulator_late_cleanup() then turn it off? It only skips regulators that
> are always_on or have a nonzero use_count. That would cut power to a
> running DPLL and drop the efuse/NVM configuration this patch tries to
> keep.
>
> A separate point: when reset-gpios is absent, nothing waits before this
> read, because the fsleep() only runs when the reset GPIO exists. Does the
> part need time after the XO is enabled before it answers on I2C?
>
> At the end of the series, drivers/dpll/sit9531x/ still has no regulator
> handling.

Yes. In v17 probe enables vdd and vddin with
devm_regulator_bulk_get_enable(), and vdds and each VDDO rail of the
variant when the board names it, before the XO and the first I2C access.
Probe then waits the 10 ms start-up time, with or without a reset line.

  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 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 02/13] dt-bindings: vendor-prefixes: add SiTime Corporation 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 [this message]
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 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
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: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 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
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

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-3-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

all inboxes | Powered by JetHome®