From: Michael Turquette <mturquette@baylibre.com>
To: "Heiko Stübner" <heiko@sntech.de>,
"Jerome Brunet" <jbrunet@baylibre.com>
Cc: Dong Aisheng <aisheng.dong@nxp.com>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
Stephen Boyd <sboyd@codeaurora.org>,
Stephen Boyd <sboyd@kernel.org>, Shawn Guo <shawnguo@kernel.org>
Subject: Re: [PATCH v2 4/8] clk: migrate the count of orphaned clocks at init
Date: Sun, 11 Mar 2018 22:54:08 -0700 [thread overview]
Message-ID: <1520834013.z6bypcssbs.astroid@resonance.none> (raw)
In-Reply-To: <1970074.VYjjbDuVRv@diego>
Excerpts from Heiko Stübner's message of February 15, 2018 1:01 pm:
> Am Mittwoch, 14. Februar 2018, 14:43:36 CET schrieb Jerome Brunet:
>> The orphan clocks reparents should migrate any existing count from the
>> orphan clock to its new acestor clocks, otherwise we may have
>> inconsistent counts in the tree and end-up with gated critical clocks
>>
>> Assuming we have two clocks, A and B.
>> * Clock A has CLK_IS_CRITICAL flag set.
>> * Clock B is an ancestor of A which can gate. Clock B gate is left
>> enabled by the bootloader.
>>
>> Step 1: Clock A is registered. Since it is a critical clock, it is
>> enabled. The clock being still an orphan, no parent are enabled.
>>
>> Step 2: Clock B is registered and reparented to clock A (potentially
>> through several other clocks). We are now in situation where the enable
>> count of clock A is 1 while the enable count of its ancestors is 0, which
>> is not good.
>>
>> Step 3: in lateinit, clk_disable_unused() is called, the enable_count of
>> clock B being 0, clock B is gated and and critical clock A actually gets
>> disabled.
>>
>> This situation was found while adding fdiv_clk gates to the meson8b
>> platform. These clocks parent clk81 critical clock, which is the mother
>> of all peripheral clocks in this system. Because of the issue described
>> here, the system is crashing when clk_disable_unused() is called.
>>
>> The situation is solved by reverting
>> commit f8f8f1d04494 ("clk: Don't touch hardware when reparenting during
>> registration"). To avoid breaking again the situation described in this
>> commit
>> description, enabling critical clock should be done before walking the
>> orphan list. This way, a parent critical clock may not be accidentally
>> disabled due to the CLK_OPS_PARENT_ENABLE mechanism.
>>
>> Fixes: f8f8f1d04494 ("clk: Don't touch hardware when reparenting during
>> registration") Cc: Stephen Boyd <sboyd@codeaurora.org>
>> Cc: Shawn Guo <shawnguo@kernel.org>
>> Cc: Dong Aisheng <aisheng.dong@nxp.com>
>> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
>
> On a rk3288-veyron Chromebook
> Tested-by: Heiko Stuebner <heiko@sntech.de>
>
> This made the hdmi on the machine work again with 4.16-rc1 .
> (hdmi-cec clock is sourced from the i2c connected pmic which provides
> the 32kHz clock needed)
>
> So it would be really cool if this could make it into 4.16-rc :-)
I separated this patch out into clk-fixes to be set for -rc5 or -rc6.
Regards,
Mike
>
>
> Heiko
>
next prev parent reply other threads:[~2018-03-12 18:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-14 13:43 [PATCH v2 0/8] clk: helpers and fixes Jerome Brunet
2018-02-14 13:43 ` [PATCH v2 1/8] clk: divider: export clk_div_mask() helper Jerome Brunet
2018-02-14 13:43 ` [PATCH v2 2/8] clk: mux: add helper function for index/value translation Jerome Brunet
2018-02-14 13:43 ` [PATCH v2 3/8] clk: fix determine rate error with pass-through clock Jerome Brunet
2018-02-14 13:43 ` [PATCH v2 4/8] clk: migrate the count of orphaned clocks at init Jerome Brunet
[not found] ` <CGME20180215125542eucas1p218f5797e7254c28d9a6437d579220e52@eucas1p2.samsung.com>
2018-02-15 12:55 ` Marek Szyprowski
[not found] ` <CGME20180305090647eucas1p14c01d34dd2eef3eaab8752bf90591c4c@eucas1p1.samsung.com>
2018-03-05 9:06 ` Marek Szyprowski
2018-02-15 21:01 ` Heiko Stübner
2018-03-12 5:54 ` Michael Turquette [this message]
2018-02-14 13:43 ` [PATCH v2 5/8] clk: call the clock init() callback before any other ops callback Jerome Brunet
2018-02-14 13:43 ` [PATCH v2 6/8] clk: fix mux clock documentation Jerome Brunet
2018-02-14 13:43 ` [PATCH v2 7/8] clk: divider: read-only divider can propagate rate change Jerome Brunet
2018-02-19 17:30 ` [v2,7/8] " David Lechner
2018-02-14 13:43 ` [PATCH v2 8/8] clk: qcom: use divider_ro_round_rate helper Jerome Brunet
2018-03-11 22:31 ` [PATCH v2 0/8] clk: helpers and fixes Michael Turquette
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=1520834013.z6bypcssbs.astroid@resonance.none \
--to=mturquette@baylibre.com \
--cc=aisheng.dong@nxp.com \
--cc=heiko@sntech.de \
--cc=jbrunet@baylibre.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@codeaurora.org \
--cc=sboyd@kernel.org \
--cc=shawnguo@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®