From: "Xuyang Dong" <dongxuyang@eswincomputing.com>
To: sashiko-reviews@lists.linux.dev
Cc: mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, p.zabel@pengutronix.de,
huangyifeng@eswincomputing.com, dongxuyang@eswincomputing.com,
benoit.monin@bootlin.com, bmasney@redhat.com,
ningyu@eswincomputing.com, linmin@eswincomputing.com,
pinkesh.vaghela@einfochips.com
Subject: Re: Re: [PATCH v6 2/3] clk: eswin: Add eic7700 HSP clock driver
Date: Wed, 20 May 2026 15:39:21 +0800 (GMT+08:00) [thread overview]
Message-ID: <61fe8681.6622.19e44532865.Coremail.dongxuyang@eswincomputing.com> (raw)
In-Reply-To: <20260519090034.CCED6C2BCB3@smtp.kernel.org>
>
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Low] Global static clock arrays are modified during probe without locking, breaking support for multiple instances.
> - [Low] The Kconfig symbol `COMMON_CLK_EIC7700_HSP` lacks the `default ARCH_ESWIN` property, which is inconsistent with the base clock driver.
> --
>
> commit 5c87f865ca8ae746d80ff71fdbbce73f7be502ec
> Author: Xuyang Dong <dongxuyang@eswincomputing.com>
>
> clk: eswin: Add eic7700 HSP clock driver
>
> Add driver for the ESWIN EIC7700 high-speed peripherals system clock
> controller and register an auxiliary device for system reset controller
> which is named as "hsp-reset".
>
> > diff --git a/drivers/clk/eswin/Kconfig b/drivers/clk/eswin/Kconfig
> > index 0406ec499ec9c..37857bd773356 100644
> > --- a/drivers/clk/eswin/Kconfig
> > +++ b/drivers/clk/eswin/Kconfig
> [ ... ]
> > @@ -13,3 +13,16 @@ config COMMON_CLK_EIC7700
> > SoC. The clock controller generates and supplies clocks to various
> > peripherals within the SoC.
> > Say yes here to support the clock controller on the EIC7700 SoC.
> > +
> > +config COMMON_CLK_EIC7700_HSP
> > + tristate "EIC7700 HSP Clock Driver"
> > + depends on ARCH_ESWIN || COMPILE_TEST
>
> This isn't a bug, but should this config have default ARCH_ESWIN to match
> the base clock driver? Without it, the high-speed peripheral clocks might
> be unexpectedly disabled by default on ESWIN platforms.
>
Hi Sashiko,
The HSP clock reset device can be built as a kernel module.
However, if 'default ARCH_ESWIN' is set, it will be compiled directly
into the kernel instead of as a module.
> > + select AUXILIARY_BUS
> > + select COMMON_CLK_EIC7700
> > + select RESET_EIC7700_HSP if RESET_CONTROLLER
> > + select REGMAP_MMIO
>
> [ ... ]
> > diff --git a/drivers/clk/eswin/clk-eic7700-hsp.c b/drivers/clk/eswin/clk-eic7700-hsp.c
> > new file mode 100644
> > index 0000000000000..3383aa64948a6
> > --- /dev/null
> > +++ b/drivers/clk/eswin/clk-eic7700-hsp.c
> [ ... ]
> > +static struct eswin_fixed_factor_clock eic7700_hsp_factor_clks[] = {
> > + ESWIN_FACTOR(EIC7700_HSP_CLK_FAC_CFG_DIV2, "factor_hsp_cfg_div2",
> > + hsp_cfg, 1, 2, 0),
> > + ESWIN_FACTOR(EIC7700_HSP_CLK_FAC_CFG_DIV4, "factor_hsp_cfg_div4",
> > + hsp_cfg, 1, 4, 0),
> > + ESWIN_FACTOR(EIC7700_HSP_CLK_FAC_MMC_DIV10, "factor_hsp_mmc_div10",
> > + hsp_mmc, 1, 10, 0),
> > +};
> [ ... ]
> > +static int eic7700_hsp_clk_probe(struct platform_device *pdev)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct auxiliary_device *adev;
> > + struct eswin_clock_data *data;
> > + struct regmap *regmap;
> > + struct clk_hw *hw;
> > + int i, ret;
> > +
> > + data = eswin_clk_init(pdev, EIC7700_HSP_NR_CLKS);
> > + if (IS_ERR(data))
> > + return dev_err_probe(dev, PTR_ERR(data),
> > + "failed to get clk data!\n");
> > +
> > + regmap = devm_regmap_init_mmio(dev, data->base,
> > + &eic7700_hsp_regmap_config);
> > + if (IS_ERR(regmap))
> > + return dev_err_probe(dev, PTR_ERR(regmap),
> > + "failed to get regmap!\n");
> > +
> > + ret = eswin_clk_register_fixed_factor(dev, eic7700_hsp_factor_clks,
> > + ARRAY_SIZE(eic7700_hsp_factor_clks),
> > + data);
>
> Is it safe to pass the global static array eic7700_hsp_factor_clks to this
> function?
>
> Looking at eswin_clk_register_fixed_factor() in drivers/clk/eswin/clk.c, it
> modifies the array during probe:
>
> int eswin_clk_register_fixed_factor(...)
> {
> ...
> clks[i].hw = *clk_hw;
> data->clk_data.hws[clks[i].id] = clk_hw;
> ...
> }
>
> If multiple instances of this driver probe concurrently or defer, could this
> data race corrupt the CCF parent-child linkages? The same pattern appears
> to affect eic7700_hsp_gate_clks and eic7700_hsp_mux_clks.
>
No. There is only one compatible string in the DTS, so there will only be
a single driver instance. Therefore, concurrent probing cannot occur, and
the CCF parent-child linkages will not be corrupted by a data race.
Best regards,
Xuyang Dong
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260519081431.1424-1-dongxuyang@eswincomputing.com?part=2
next prev parent reply other threads:[~2026-05-20 7:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 8:14 [PATCH v6 0/3] Add driver support for ESWIN EIC7700 HSP clock and reset generator dongxuyang
2026-05-19 8:16 ` [PATCH v6 1/3] dt-bindings: clock: Add ESWIN eic7700 " Xuyang Dong
2026-05-19 8:16 ` [PATCH v6 2/3] clk: eswin: Add eic7700 HSP clock driver dongxuyang
2026-05-19 9:00 ` sashiko-bot
2026-05-20 7:39 ` Xuyang Dong [this message]
2026-05-19 8:16 ` [PATCH v6 3/3] reset: eswin: Add eic7700 HSP reset driver Xuyang Dong
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=61fe8681.6622.19e44532865.Coremail.dongxuyang@eswincomputing.com \
--to=dongxuyang@eswincomputing.com \
--cc=benoit.monin@bootlin.com \
--cc=bmasney@redhat.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=huangyifeng@eswincomputing.com \
--cc=krzk+dt@kernel.org \
--cc=linmin@eswincomputing.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=ningyu@eswincomputing.com \
--cc=p.zabel@pengutronix.de \
--cc=pinkesh.vaghela@einfochips.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sboyd@kernel.org \
/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