mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ali Rouhi <arouhi@sitime.com>
To: Jakub Kicinski <kuba@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>,
	"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 v15 04/13] dpll: add basic SiTime SiT9531x support
Date: Thu, 19 Nov 2026 21:20:16 +0000	[thread overview]
Message-ID: <20261119212014.13180-2-arouhi@sitime.com> (raw)
In-Reply-To: <20261117021809.2220080-1-kuba@kernel.org>

On Mon, 16 Nov 2026 18:18:09 -0800, Jakub Kicinski wrote:

> > +static int sit9531x_page_select(struct sit9531x_dev *sitdev, int page)
> > +{
> > +	int rc;
> > +
> > +	if (sitdev->page == page)
> > +		return 0;
>
> [Severity: Low]
> Could this use regmap's paged range support instead of a private page
> cache?
>
> sit9531x_regmap_config has no .ranges and max_register is 0xFF, so regmap
> only sees a single window. sit9531x_page_select() skips the selector write
> whenever sitdev->page matches. Nothing ever checks that cached value
> against the chip, and outside of resume it is only reset when a regmap
> access fails.
>
> Something outside these accessors may change register 0xFF, for example an
> I2C tool or a regmap debugfs write. If that happens, sitdev->page goes
> stale. The next sit9531x_read_u8(), sit9531x_write_u8() or
> sit9531x_update_pll_u8() for the cached page then skips the select. It
> reads or writes the same offset on whatever page the chip is actually on.
>
> Later in the series, "dpll: sit9531x: add support to get and set priority
> on input pins" treats a priority table rewritten "by a profile reload or
> an I2C tool" as a supported case. An I2C tool has to write 0xFF to reach
> that table. A regmap debugfs registers dump would also only show the page
> that happens to be selected.
>
> regmap's struct regmap_range_cfg supports a selector inside the window,
> here selector_reg = 0xFF, window_start = 0 and window_len = 0x100. With
> REGCACHE_NONE it reads the selector back before switching. It also keeps
> the select and the access together under the regmap lock.
>
> The sibling zl3073x driver already does this:
>
> drivers/dpll/zl3073x/core.c:
> static const struct regmap_range_cfg zl3073x_regmap_range = {
> 	.range_min	= ZL_RANGE_OFFSET,
> 	...
> 	.selector_reg	= ZL_PAGE_SEL,
> 	...
> 	.window_start	= 0,
> 	.window_len	= ZL_PAGE_SIZE,
> };
>
> The commit message describes the flat-window design but doesn't say why
> the regmap mechanism wasn't used. Is there a reason for that?

Earlier revisions used regmap_range_cfg. With an uncached map it reads
the selector back before every access, which doubles the bus traffic of
the poll, and it lets a debugfs access switch the page between two
accesses of the driver. The flat window keeps the select and the
transfer under one lock. The commit message will say so. The table
rewritten "by an I2C tool" in patch 08 is picked up by the poll, which
reads the table every tick; a tool that leaves the page moved under a
bound driver has used I2C_SLAVE_FORCE, the documented override, and the
driver does not detect it.

> > +		return dev_err_probe(sitdev->dev, PTR_ERR(sitdev->reset_gpio),
> > +				     "Failed to request reset gpio\n");
> > +	if (sitdev->reset_gpio)
> > +		fsleep(10000);	/* internal boot after release */
> > +
> > +	rc = sit9531x_read_variant_id(sitdev, &variant_id);
>
> [Severity: Medium]
> Should sit9531x_dev_probe() enable the supplies before it releases reset
> and does the first I2C access?
>
> The binding in this series, sitime,sit95316.yaml, documents vdd-supply,
> vddin-supply, vdds-supply and the vddoN-supply rails. Nothing under
> drivers/dpll/sit9531x/ gets or enables a regulator, either in this patch
> or by the end of the series.
>
> The binding commit says:
>
>   "The driver does not enable them, since the boards so far power the part
>   permanently; describing them gives a board with switchable rails a way
>   to say so."
>
> A board that describes switchable rails per the binding gets no consumer
> for them. If the rail is off at probe, the chip comes out of reset
> unpowered and the variant ID read fails.
>
> If the bootloader left the rail on, regulator_late_cleanup() in
> drivers/regulator/core.c finds use_count == 0 on a regulator that is not
> always-on. On DT systems, where have_full_constraints() is true, it then
> disables the rail late in boot:
>
> 	if (rdev->use_count)
> 		goto unlock;
> 	...
> 	if (have_full_constraints()) {
> 		rdev_info(rdev, "disabling\n");
> 		ret = _regulator_do_disable(rdev);
>
> Wouldn't the chip then lose power while the driver is still bound? That
> would drop the pre-probe NVM configuration the commit message says is
> kept. It would also leave sitdev->page out of sync with the chip. Later
> register accesses would then fail, or reach a part that has rebooted from
> efuse.

Correct, and the late cleanup case is real for a rail that is not
always-on. The driver does not claim the supplies in this submission;
until a follow-up adds the regulators with their power-up delay, a board
with switchable rails marks them always-on.

  reply	other threads:[~2026-11-19 21:20 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 20:26 [PATCH net-next v15 00/13] dpll: add SiTime SiT9531x DPLL clock driver Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 01/13] dpll: omit pin phase attributes the driver has no value for Ali Rouhi
2026-11-11 15:35   ` Ivan Vecera
2026-11-10 20:26 ` [PATCH net-next v15 02/13] dt-bindings: vendor-prefixes: add SiTime Corporation Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 04/13] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi [this message]
2026-11-10 20:26 ` [PATCH net-next v15 03/13] dt-bindings: dpll: add SiTime SiT95316 clock generator Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 05/13] dpll: sit9531x: read DPLL types and pin properties from system firmware Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 06/13] dpll: sit9531x: register DPLL devices and pins Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 07/13] dpll: sit9531x: implement input pin state on a DPLL Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 08/13] dpll: sit9531x: add support to get and set priority on input pins Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 09/13] dpll: sit9531x: add support to get and set frequency on pins Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 10/13] dpll: sit9531x: implement output pin state on a DPLL Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 11/13] dpll: sit9531x: add support to adjust output phase Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 12/13] dpll: sit9531x: add support to get phase offset on the connected input pin Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 13/13] dpll: sit9531x: model the inter-PLL sync line as a pair of pins Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-17  9:27 ` [PATCH net-next v15 00/13] dpll: add SiTime SiT9531x DPLL clock driver Paolo Abeni

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=20261119212014.13180-2-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@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®