Devicetree
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>, sashiko-bot@kernel.org
Cc: sashiko-reviews@lists.linux.dev, conor+dt@kernel.org,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org
Subject: Re: [PATCH v8 3/7] clk: nuvoton: ma35d1: Retrieve HXT/LXT from DT when possible
Date: Mon, 05 Oct 2026 11:06:50 +0200	[thread overview]
Message-ID: <1jmrss7byt.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <875wzhjhe6.fsf@bootlin.com>

On Sun 04 Oct 2026 at 23:16, Miquel Raynal <miquel.raynal@bootlin.com> wrote:

>> This commit modifies the clock driver to retrieve the external HXT and LXT
>> clocks from the device tree instead of registering them directly. It falls
>> back to registering LXT for backward compatibility with older device trees.
>>
>>> diff --git a/drivers/clk/nuvoton/clk-ma35d1.c b/drivers/clk/nuvoton/clk-ma35d1.c
>>> index ceebcbd8c18b3..ed61a990870e4 100644
>>> --- a/drivers/clk/nuvoton/clk-ma35d1.c
>>> +++ b/drivers/clk/nuvoton/clk-ma35d1.c
>> [ ... ]
>>> @@ -240,12 +257,18 @@ static int ma35d1_clocks_probe(struct platform_device *pdev)
>>>  		return -EINVAL;
>>>  	}
>>>  
>>> -	hws[HXT] = ma35d1_clk_fixed("hxt", 24000000);
>>
>> [Severity: Critical]
>> Does this unconditional removal break ABI compatibility with older device
>> trees?
>>
>> Because HXT (index 0) is exported as a public ABI in the DT bindings,
>> removing its explicit registration leaves hws[HXT] as NULL in the provider's
>> clock array. If an existing downstream or older device tree consumer explicitly
>> references this clock via clocks = <&clk HXT>, won't the provider's
>> of_clk_hw_onecell_get() fail to resolve the clock and return an error?
>
> Jerome, your wisdom matters here :-) For me this is a false positive,
> because nobody outside this driver should access hws[HXT] and the clock
> is still referenced through the DT, just not provided by this
> driver. For me this is not an issue we should consider, let me know
> otherwise.

Strictly speaking there is (used to be) a clock at this index so it is
not a false positive. Someone crazy enough could have gone through here
to get the OSC even if does not make a lot of sense.

This clock should never have existed to start with but it got in the
bindings ... and that is the pain of dealing with bad bindings :/

You've got 2 options:
* Removing the ID from the bindings explaining clearly that it conflicts
  with the fact this clock is actually an input according to the same
  bindings. I suspect the DT maintainers won't like this much ...

* Keep the bad support binding in the driver: You'll need a pass-through
  clock element where the parent data is the fw_name and a fallback to
  an `hxt-fake-internal' fixed clock. Feel free to add a comment
  explaining how bad it is to use that clock and what user should be
  doing instead.

You'll probably need to play that last trick with the lxt anyway ?

>
> Miquèl

-- 
Jerome

  reply	other threads:[~2026-10-05  9:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-04 20:45 [PATCH v8 0/7] clk: nuvoton: ma35d1: Fix mux parenting and peripheral clock rates Miquel Raynal
2026-10-04 20:45 ` [PATCH v8 1/7] clk: nuvoton: ma35d1: Use clk_hw pointers as mux parents Miquel Raynal
2026-10-04 20:45 ` [PATCH v8 2/7] clk: nuvoton: ma35d1: Avoid possible error pointer dereferencing Miquel Raynal
2026-10-04 20:45 ` [PATCH v8 3/7] clk: nuvoton: ma35d1: Retrieve HXT/LXT from DT when possible Miquel Raynal
2026-10-04 20:59   ` sashiko-bot
2026-10-04 21:16     ` Miquel Raynal
2026-10-05  9:06       ` Jerome Brunet [this message]
2026-10-04 20:45 ` [PATCH v8 4/7] clk: nuvoton: ma35d1: Reparent the gates correctly Miquel Raynal
2026-10-04 20:45 ` [PATCH v8 5/7] clk: nuvoton: ma35d1: Reparent SYSPLL correctly Miquel Raynal
2026-10-04 20:55   ` sashiko-bot
2026-10-04 21:19     ` Miquel Raynal
2026-10-05  9:12       ` Jerome Brunet
2026-10-06  7:57         ` Miquel Raynal
2026-10-04 20:45 ` [PATCH v8 6/7] arm64: dts: nuvoton: ma35d1: Drop HXT clock output name Miquel Raynal
2026-10-04 20:45 ` [PATCH v8 7/7] arm64: dts: nuvoton: ma35d1: Add LXT crystal and clock-names Miquel Raynal

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=1jmrss7byt.fsf@starbuckisacylon.baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=robh@kernel.org \
    --cc=sashiko-bot@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