Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Christian Marangi" <ansuelsmth@gmail.com>,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org
Cc: robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v13 5/5] clk: en7523: add support for Airoha AN7583 clock
Date: Tue, 17 Nov 2026 18:38:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-219368@kernel.org> (raw)
In-Reply-To: <20261117182444.103123-6-ansuelsmth@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] clk: en7523: AN7583 MDIO clocks lack rate ops in
  en7581_register_clocks()
--

commit 1cdcca32a0679ec11e0c737e0957ebcf9e9e90ec
Author: Christian Marangi <ansuelsmth@gmail.com>

clk: en7523: add support for Airoha AN7583 clock

This commit adds clock and reset controller support for the Airoha AN7583
SoC to the en7523 clock driver.

> diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
> index f12b69f8d4539..f8eef9fcff472 100644
> --- a/drivers/clk/clk-en7523.c
> +++ b/drivers/clk/clk-en7523.c
[ ... ]
> @@ -369,6 +378,138 @@ static const struct en_clk_desc en7581_base_clks[] = {
[ ... ]
> +	}, {
> +		.id = AN7583_CLK_MDIO0,
> +		.name = "mdio0",
> +
> +		.base_reg = REG_CRYPTO_CLKSRC2,
> +
> +		.base_value = 25000000,
> +
> +		.div_bits = 4,
> +		.div_shift = 15,
> +		.div_step = 1,
> +		.div_offset = 1,
> +	}, {
> +		.id = AN7583_CLK_MDIO1,
> +		.name = "mdio1",
> +
> +		.base_reg = REG_CRYPTO_CLKSRC2,
> +
> +		.base_value = 25000000,
> +
> +		.div_bits = 4,
> +		.div_shift = 19,
> +		.div_step = 1,
> +		.div_offset = 1,
> +	}
> +};
[ ... ]
> @@ -1148,6 +1347,43 @@ static int en7581_clk_hw_init(struct platform_device *pdev,
>  	return en7581_serdes_phy_register(&pdev->dev);
>  }
>  
> +static int an7583_clk_hw_init(struct platform_device *pdev,
> +			      struct clk_hw_onecell_data *clk_data)
> +{
> +	struct en_clk_priv *priv = platform_get_drvdata(pdev);
> +	struct device *dev = &pdev->dev;
> +	struct regmap *map;
> +	void __iomem *base;
> +	u32 val;
> +	int ret;
> +
> +	map = syscon_regmap_lookup_by_phandle(dev->of_node, "airoha,chip-scu");
> +	if (IS_ERR(map))
> +		return PTR_ERR(map);
> +
> +	base = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(base))
> +		return PTR_ERR(base);
> +
> +	priv->base = base;
> +
> +	en7581_register_clocks(dev, clk_data, map, base);

[Severity: Medium]
Does registering AN7583_CLK_MDIO0 and AN7583_CLK_MDIO1 via
en7581_register_clocks() prevent clk_set_rate() from updating their
hardware dividers?

en7581_register_clocks() registers every entry in soc_data->base_clks with
devm_clk_hw_register_fixed_rate(), which uses clk_fixed_rate_ops and
provides no .set_rate, .round_rate, or .determine_rate callbacks.  When the
MDIO controller driver probes, its clk_set_rate() call is a no-op that
returns 0 without programming the 4-bit divider in REG_CRYPTO_CLKSRC2,
leaving the MDIO bus at its 25 MHz boot default instead of 2.5 MHz:

drivers/net/mdio/mdio-airoha.c:airoha_mdio_probe() {
	...
	/* Check if a custom frequency is defined in DT or default to 2.5 MHz */
	if (of_property_read_u32(dev->of_node, "clock-frequency", &freq))
		freq = 2500000;

	ret = clk_set_rate(priv->clk, freq);
	if (ret)
		return ret;
	...
}

Although adjustable clock rate support was noted on v10 as planned for a
separate series, the in-tree airoha-mdio consumer already relies on
clk_set_rate() at this commit.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117182444.103123-1-ansuelsmth@gmail.com?part=5

      reply	other threads:[~2026-11-17 18:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 18:24 [PATCH v13 0/5] clk: add support for Airoha AN7583 clock Christian Marangi
2026-11-17 18:24 ` [PATCH v13 1/5] dt-bindings: clock: airoha: Document support for " Christian Marangi
2026-11-17 18:32   ` sashiko-bot
2026-11-17 18:24 ` [PATCH v13 2/5] clk: en7523: use devm variant for clk_hw_register and fixed clock Christian Marangi
2026-11-17 18:24 ` [PATCH v13 3/5] clk: en7523: protect concurrent access to reset and PCI register Christian Marangi
2026-11-17 18:24 ` [PATCH v13 4/5] clk: en7523: generalize register clocks function Christian Marangi
2026-11-17 18:24 ` [PATCH v13 5/5] clk: en7523: add support for Airoha AN7583 clock Christian Marangi
2026-11-17 18:38   ` sashiko-bot [this message]

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=sashiko-outbox-219368@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ansuelsmth@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.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