From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796258345; b=4qLvOoPYCUHx5DIgYLc3cDTFnXWvP4FNoLrZPQ3DWNUkLyDAOSQWwkK6a30vZ4I9+p2o xdL8YL/el75kfYc7BQO+ujbL1Ak3ThCLWodHGSUdcdhPImoOD7Cw2GsstvApuhl4ewcNU XWKDhBRZ4xK+gRbEODo38TyxF8ckPhRS0iDAe3x3K42hwENyFYG79xZYx0RSgxKnjqm3a 2hsiEz2HxTU3SkQcfAe21HElrl/Y44Vxba7UXvEBlbyBX3P4mtViXx3421BnGnDWuQcl4 UewVzeEcmmib6BsHZeGnfQyrFzmclpNvps6CKzBteQo12r5qbhZubv69+130ZBh+IhQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796258345; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=2lWeAu9h64M+/6/VGg9iRkwXQmRrLsx+tgA/fywIDLY=; b=kGSJptRm3DtYPwWPjHFWZyBqUgiFt0KRVoQ7l0f/Z/1tgK2GRsonU2MFm0Kx7BcdSgOZ QMkToqqGCPHyPFcx1MpGsrygsn1zhHyAeEEYoiIxLQ5Gr1lv1KdBrTqxaM4XNFCgQqZow uTOzwdLflnQb+/hlNutMV8b6wkiig2zWl0RL48JNhMBBHFaE9eiezFw47y0ZzKwmk/gR9 rtLtfLzBP+52w51EukICkg4SJuwmcEk74qI1ijAt8YWbRkwIFx02AMF7CkiKoC3XyJRJk ExQ2/5JKCTPEmfI0Vjkvxh8aUrt6NBKu9yHfp2Fd5tAA+JdqbGQtBDl8kTrMePa3eoQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kbV5vAOb; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A114A606A335; Thu, 3 Dec 2026 00:39:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kbV5vAOb Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72C2D1F000C1; Thu, 3 Dec 2026 00:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796258345; bh=2lWeAu9h64M+/6/VGg9iRkwXQmRrLsx+tgA/fywIDLY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=kbV5vAObLNYT7Z/Z8uw153hYSKs9lY7xY8TQEUDa2UrTEGN1UtIlHdlImwSa91xEC cDoD/neYvzNzZoaiHT8lQMCfgK/EUiaTsWuFpWDBDFVqdaeQ2kti/jx8OTZzZRwwPc /FAtAVix50PjY/fzZNnXDGdIdt3Ux3VX9Wuf9hps1UttvJopyOeSquWNIbDWhUcRQG czm57rRPFVi4I8X3ogRxCVtDz1RCDQP9C2AhiGTjSe+8rFxXofBKJAG1d9YawlSzyx 8uIhaVZ/RxFNYdrqVzJrPmtXdR69sf+pEqckxD4y7fOcSB71myJzVX026Du+VMsPR1 JIYMJ6Ceg+kWQ== Subject: Re: [PATCH net-next v17 04/13] dpll: add basic SiTime SiT9531x support 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 Date: Thu, 03 Dec 2026 00:39:04 +0000 Message-ID: <179625834403.3146.9112631689439856078@kernel.org> In-Reply-To: <20261201235202.97645-5-arouhi@sitime.com> References: <20261201235202.97645-5-arouhi@sitime.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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