All of lore.kernel.org
 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 v12 5/5] clk: en7523: add support for Airoha AN7583 clock
Date: Tue, 10 Nov 2026 00:51:49 +0000	[thread overview]
Message-ID: <sashiko-outbox-205906@kernel.org> (raw)
In-Reply-To: <20261110000753.508-6-ansuelsmth@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] clk: en7523: AN7583 MDIO clocks lack rate ops in
  en7581_register_clocks()
- [Medium] clk: en7523: mismatched clk_ops callbacks in
  an7583_data.pcie_ops
--

commit 80220805154b9c38bb07ac1b3edf5679520c435d
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 7d302498c3d51..7523ec7e0d8aa 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[] = {
>  	}
>  };
>  
> +static const struct en_clk_desc an7583_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,
> +	}
> +};

[Severity: Medium]
Can AN7583_CLK_MDIO0 and AN7583_CLK_MDIO1 change their rate when registered
through en7581_register_clocks()?

en7581_register_clocks() registers every entry in base_clks with
devm_clk_hw_register_fixed_rate(), whose clk_fixed_rate_ops lacks
.determine_rate and .set_rate callbacks.  When airoha_mdio_probe() in
drivers/net/mdio/mdio-airoha.c calls clk_set_rate() to divide the 25 MHz
default clock down to 2.5 MHz, clk_set_rate() returns 0 without updating
the 4-bit divider in REG_CRYPTO_CLKSRC2, leaving the MDIO bus at 25 MHz.
Earlier series discussion noted that adjustable clock rate support is
planned for a separate series, but the in-tree airoha-mdio consumer already
relies on clk_set_rate().

[ ... ]

> @@ -1329,6 +1565,18 @@ static const struct en_clk_soc_data en7581_data = {
>  	.hw_init = en7581_clk_hw_init,
>  };
>  
> +static const struct en_clk_soc_data an7583_data = {
> +	.base_clks = an7583_base_clks,
> +	/* We increment num_clocks by 1 to account for additional PCIe clock */
> +	.num_clocks = ARRAY_SIZE(an7583_base_clks) + 1,
> +	.pcie_ops = {
> +		.is_enabled = en7581_pci_is_enabled,
> +		.prepare = en7581_pci_enable,
> +		.unprepare = en7581_pci_disable,
> +	},
> +	.hw_init = an7583_clk_hw_init,
> +};

[Severity: Medium]
Should pcie_ops pair .prepare and .unprepare with .is_prepared rather than
.is_enabled?

Because en7581_pci_enable() and en7581_pci_disable() are wired to .prepare
and .unprepare while .is_prepared, .disable, and .pci_unprepare are NULL,
clk_unprepare_unused_subtree() sees prepare_count == 0 with no .is_prepared
callback and skips .unprepare, while clk_disable_unused_subtree() sees
.is_enabled return true with no .disable callback.  If the PCIe clock is
enabled in REG_PCI_CONTROL at boot and no consumer claims EN7523_CLK_PCIE,
clk_disable_unused() never gates it.

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

      reply	other threads:[~2026-11-10  0:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  0:07 [PATCH v12 0/5] clk: add support for Airoha AN7583 clock Christian Marangi
2026-11-10  0:07 ` [PATCH v12 1/5] dt-bindings: clock: airoha: Document support for " Christian Marangi
2026-11-10  0:19   ` sashiko-bot
2026-11-10  0:07 ` [PATCH v12 2/5] clk: en7523: use devm variant for clk_hw_register and fixed clock Christian Marangi
2026-11-10  0:07 ` [PATCH v12 3/5] clk: en7523: protect concurrent access to reset and PCI register Christian Marangi
2026-11-10 11:33   ` Philipp Zabel
2026-11-10  0:07 ` [PATCH v12 4/5] clk: en7523: generalize register clocks function Christian Marangi
2026-11-10  0:07 ` [PATCH v12 5/5] clk: en7523: add support for Airoha AN7583 clock Christian Marangi
2026-11-10  0:51   ` 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-205906@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.