mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Alex Elder <elder@riscstar.com>,
	sboyd@kernel.org, bmasney+clk@redhat.com,
		jbrunet+clk@baylibre.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, 	andersson@kernel.org,
	konradybcio@kernel.org, abelvesa@kernel.org
Cc: daniel@riscstar.com, mohd.anwar@oss.qualcomm.com,
	 lorenzo.bianconi@oss.qualcomm.com, fabrice.gasnier@foss.st.com,
	 alexandre.torgue@foss.st.com, marex@nabladev.com,
	 changhuang.liang@starfivetech.com, devicetree@vger.kernel.org,
	 linux-clk@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] clk: toshiba: introduce a TC9564 clock/reset driver
Date: Thu, 26 Nov 2026 10:42:26 +0100	[thread overview]
Message-ID: <579859f0e1b53aa6506492a2e5d073f3f991014c.camel@pengutronix.de> (raw)
In-Reply-To: <20261125202141.1288493-3-elder@riscstar.com>

On Mi, 2026-11-25 at 14:21 -0600, Alex Elder wrote:
> Define a new platform driver that manages clocks and resets implemented
> by the Toshiba TC9564 SoC.  There are 21 gate clocks that can be enabled
> and disabled, but currently only the clocks that are (or will soon be)
> used are defined to be controllable.  There are also 13 resets that can
> be asserted or deasserted, but support for some of these is omitted as
> well.
> 
> Two registers manage the state of the clocks, and two others manage
> the state of the resets.  All four registers are found in a region
> mapped for MMIO.  The region is provided via a BAR on one of the PCI
> functions embedded in the TC9564 SoC.
> 
> The I2C and PCIE clocks and resets are treated as CRITICAL, meaning their
> state should never be changed (and a warning is issued if changing their
> state is attempted).
> 
> Co-developed-by: Daniel Thompson <daniel@riscstar.com>
> Signed-off-by: Daniel Thompson <daniel@riscstar.com>
> Signed-off-by: Alex Elder <elder@riscstar.com>
> ---
> v3: - Fixed problems/garbage in the patch header
>     - The Kconfig option now depends on RESET_CONTROLLER, and can now
>       be enabled if COMPILE_TEST is enabled
>     - The generic gate clock controller code is now used rather than
>       implementing a custom one
>     - The PLL and internal fixed clocks IDs are no longer available
>       outside "clk-tc9564.c"
>     - The PLL is initialialized, followed by all fixed rate clocks,
>       followed by the gate clocks, to ensure each clock's parent is
>       initialized before the clock is
>     - Updating the reset registers (read/modify/write) is now protected
>       by a spinlock
>     - "Unnecessary newlines" have been removed
> 
>  MAINTAINERS              |   1 +
>  drivers/clk/Kconfig      |   9 +
>  drivers/clk/Makefile     |   1 +
>  drivers/clk/clk-tc9564.c | 456 +++++++++++++++++++++++++++++++++++++++
>  4 files changed, 467 insertions(+)
>  create mode 100644 drivers/clk/clk-tc9564.c
> 
[...]
> diff --git a/drivers/clk/clk-tc9564.c b/drivers/clk/clk-tc9564.c
> new file mode 100644
> index 0000000000000..306781e2f7b4f
> --- /dev/null
> +++ b/drivers/clk/clk-tc9564.c
> @@ -0,0 +1,456 @@
[...]
> +
> +static int reset_update(struct reset_controller_dev *rcdev,
> +			unsigned long id, bool assert)
> +{
> +	const struct reset_init *reset;
> +	struct tc9564_clock *clock;
> +	unsigned long flags;
> +	void __iomem *reg;
> +	u32 mask;
> +	u32 val;
> +
> +	/* Warn on any attempt to change state of a critical reset */
> +	if (WARN_ON(id == RESET_I2C) || WARN_ON(id == RESET_PCIE))
> +		return 0;

Can't this be checked at reset_control_get() time (in fwnode_xlate) so
that critical reset controls aren't given out to consumers in the first
place?

> +
> +	clock = dev_get_drvdata(rcdev->dev);
> +	reset = &reset_init[id];
> +	reg = clock->ioaddr + reset->offset;
> +	mask = BIT(reset->bit);
> +
> +	spin_lock_irqsave(&clock->lock, flags);

Consider using guard(spinlock).


regards
Philipp

  reply	other threads:[~2026-11-26  9:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 20:21 [PATCH v3 0/3] clk: tc9564: introduce a clock and reset driver Alex Elder
2026-11-25 20:21 ` [PATCH v3 1/3] dt-bindings: toshiba: introduce toshiba,tc9564-clock.yaml Alex Elder
2026-11-25 20:21 ` [PATCH v3 2/3] clk: toshiba: introduce a TC9564 clock/reset driver Alex Elder
2026-11-26  9:42   ` Philipp Zabel [this message]
2026-11-26  9:55   ` Lorenzo Bianconi
2026-11-25 20:21 ` [PATCH v3 3/3] arm64: dts: qcom: qcs6490-rb3gen2: add TC9564 clock node Alex Elder
2026-11-26 10:01   ` Lorenzo Bianconi
2026-11-25 20:33 ` [PATCH v3 0/3] clk: tc9564: introduce a clock and reset driver Alex Elder

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=579859f0e1b53aa6506492a2e5d073f3f991014c.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=abelvesa@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andersson@kernel.org \
    --cc=bmasney+clk@redhat.com \
    --cc=changhuang.liang@starfivetech.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel@riscstar.com \
    --cc=devicetree@vger.kernel.org \
    --cc=elder@riscstar.com \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=jbrunet+clk@baylibre.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.bianconi@oss.qualcomm.com \
    --cc=marex@nabladev.com \
    --cc=mohd.anwar@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --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

all inboxes | Powered by JetHome®