From: Jerome Brunet <jbrunet@baylibre.com>
To: Chuan Liu <chuan.liu@amlogic.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Kevin Hilman <khilman@baylibre.com>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] clk: meson: Fix glitch free mux related issues
Date: Mon, 29 Sep 2025 14:55:20 +0200 [thread overview]
Message-ID: <1j1pnp5sg7.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <36cd6282-ae1d-43f3-8738-592f043d0ba6@amlogic.com> (Chuan Liu's message of "Mon, 29 Sep 2025 17:31:07 +0800")
On Mon 29 Sep 2025 at 17:31, Chuan Liu <chuan.liu@amlogic.com> wrote:
> On 9/29/2025 4:48 PM, Jerome Brunet wrote:
>> [ EXTERNAL EMAIL ]
>>
>> On Sun 28 Sep 2025 at 22:55, Martin Blumenstingl
>> <martin.blumenstingl@googlemail.com> wrote:
>>
>>> Hello,
>>>
>>> On Sun, Sep 28, 2025 at 8:41 AM Chuan Liu <chuan.liu@amlogic.com> wrote:
>>>>
>>>> On 9/28/2025 2:05 PM, Chuan Liu wrote:
>>>>> Hi Jerome & Martin:
>>>>>
>>>>> Sorry for the imprecise description of the glitch-free mux earlier.
>>>>>
>>>>> Recently, while troubleshooting a CPU hang issue caused by glitches,
>>>>> I realized there was a discrepancy from our previous understanding,
>>>>> so I'd like to clarify it here.
>>> [...]
>>>> An example of the clock waveform is shown below:
>>>>
>>>>
>> 1 2
>> v v
>>>> __ __ __ __ __ __ __ __
>>>> ori: ↑ |__↑ |__↑ |__↑ |__↑ |__↑ |__↑ |__↑ |__↑
>>>> ^
>>>> 1 * cycle original channel.
>>>> _ _ _ _ _ _ _ _ _ _ _ _
>>>> new: ↑ |_↑ |_↑ |_↑ |_↑ |_↑ |_↑ |_↑ |_↑ |_↑ |_↑ |_↑ |_↑
>>>> ^
>>>> 5 * cycles new channel.
>>>> __ __ _ _ _ _
>>>> out: ↑ |__↑ |______________________↑ |_↑ |_↑ |_↑ |_↑
>>>> ^ ^
>>>> start switching mux. switch to new channel.
>> Ok ... but when is it safe to disable the "ori" clock ?
>> Can you do it at '1' already ? or do you have to wait for '2' ?
>
>
> It should wait for "2", because there is a state machine in the
> glitch-free mux, this state machine is driven by the working clock
> provided by its channel 0.
Then I don't think the 2 flags are enough to make it safe
Nothing guarantees that CCF will wait for those 5 cycles to turn off
the clock noted 'ori' above.
I think you need new specific ops for this mux
Something that would
* protect both parents before changing the mux
* do the actual change
* wait for it to settle
* remove the protection
>
>
>>
>>> Thank you for the detailed report!
>>> This is indeed problematic behavior. I guess the result is somewhat
>>> random: depending on load (power draw), silicon lottery (quality),
>>> temperature, voltage supply, ... - one may or may not see crashes
>>> caused by this.
>>>
>>> Based on the previous discussion on this topic, my suggestion is to
>>> split the original patch:
>>> - one to add CLK_SET_RATE_GATE where needed (I think the meson8b.c
>>> driver already has this where needed) to actually enable the
>>> glitch-free mux behavior
>>> - another one with the CLK_OPS_PARENT_ENABLE change (meson8b.c would
>>> also need to be updated) to prevent the glitch-free mux from
>>> temporarily outputting an electrical low signal. Jerome also asked to
>>> document the behavior so we don't forget why we set this flag
>> Yes please split the changes and visit all the controllers shipping this
>> type of muxes.
>>
>>> Both patches should get the proper "Fixes" tags.
>> ... and proper fixes tag maybe different depending on the controller so
>> there might more that just 2 changes.
>>
>>> I think it would also be great if you could include the waveform
>>> example in at least the commit message as it helps understand the
>>> problem.
>>>
>>> Let's also give Jerome some time to comment before you send patches.
>>>
>>>
>>> Best regards,
>>> Martin
>> --
>> Jerome
--
Jerome
next prev parent reply other threads:[~2025-09-29 12:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-29 6:10 [PATCH 0/2] clk: Fix issues related to CLK_IGNORE_UNUSED failures and amlogic glitch free mux Chuan Liu via B4 Relay
2024-09-29 6:10 ` [PATCH 1/2] clk: Fix the CLK_IGNORE_UNUSED failure issue Chuan Liu via B4 Relay
2024-09-30 12:27 ` Jerome Brunet
2024-11-08 13:02 ` Chuan Liu
2024-09-29 6:10 ` [PATCH 2/2] clk: meson: Fix glitch free mux related issues Chuan Liu via B4 Relay
2024-09-30 12:36 ` Jerome Brunet
2024-09-30 20:08 ` Martin Blumenstingl
2024-10-08 5:44 ` Chuan Liu
2024-10-08 6:02 ` Jerome Brunet
2025-09-28 6:05 ` Chuan Liu
2025-09-28 6:40 ` Chuan Liu
2025-09-28 20:55 ` Martin Blumenstingl
2025-09-29 3:15 ` Chuan Liu
2025-09-29 12:36 ` Jerome Brunet
2025-09-30 2:07 ` Chuan Liu
2025-09-29 8:48 ` Jerome Brunet
2025-09-29 9:31 ` Chuan Liu
2025-09-29 12:55 ` Jerome Brunet [this message]
2025-09-30 2:04 ` Chuan Liu
2024-09-30 12:33 ` [PATCH 0/2] clk: Fix issues related to CLK_IGNORE_UNUSED failures and amlogic glitch free mux Jerome Brunet
2024-10-04 13:39 ` [RFC PATCH] clk: core: refine disable unused clocks Jerome Brunet
2024-11-08 7:59 ` Chuan Liu
2024-11-08 8:38 ` Jerome Brunet
2024-11-08 9:23 ` Chuan Liu
2024-11-08 9:59 ` Jerome Brunet
2024-11-08 11:49 ` Chuan Liu
2024-11-12 8:36 ` Jerome Brunet
2024-11-12 10:05 ` Chuan Liu
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=1j1pnp5sg7.fsf@starbuckisacylon.baylibre.com \
--to=jbrunet@baylibre.com \
--cc=chuan.liu@amlogic.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=mturquette@baylibre.com \
--cc=neil.armstrong@linaro.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