All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Heiko Stuebner <heiko@sntech.de>, mturquette@linaro.org
Cc: linux@arm.linux.org.uk, linux-kernel@vger.kernel.org,
	dianders@chromium.org, linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/4] clk: Propagate prepare and enable when reparenting orphans
Date: Fri, 10 Apr 2015 17:59:08 -0700	[thread overview]
Message-ID: <552871DC.2020400@codeaurora.org> (raw)
In-Reply-To: <1427988853-9549-2-git-send-email-heiko@sntech.de>

On 04/02/15 08:34, Heiko Stuebner wrote:
> From: Doug Anderson <dianders@chromium.org>
>
> With the existing code, if you find a parent for an orhpan that has
> already been prepared / enabled, you won't enable the parent.  That
> can cause later problems since the clock tree isn't in a consistent
> state.  Fix by propagating the prepare and enable.
>
> NOTE: this does bring up the question about whether the enable of the
> orphan actually made sense.  If the orphan's parent wasn't enabled by
> default (by the bootloader or the default state of the hardware) then
> the original enable of the orphan probably didn't do what the caller
> though it would.  Some users of the orphan might have preferred an
> EPROBE_DEFER be returned until we had a full path to a root clock.
> This patch doesn't address those concerns and really just syncs up the
> state.
>
> Tested on rk3288-evb-rk808 by temporarily considering "sclk_tsadc" as
> a critical clock (to simulate a driver enabling it at bootup).
>
> Before:
>
>    clock                         enable_cnt  prepare_cnt        rate   accuracy   phase
> ----------------------------------------------------------------------------------------
>  xin32k                                   0            0       32768          0 0
>     sclk_hdmi_cec                         0            0       32768          0 0
>     sclk_otg_adp                          0            0       32768          0 0
>     sclk_tsadc                            1            1         993          0 0
>
> After:
>
>    clock                         enable_cnt  prepare_cnt        rate   accuracy   phase
> ----------------------------------------------------------------------------------------
>  xin32k                                   1            1       32768          0 0
>     sclk_hdmi_cec                         0            0       32768          0 0
>     sclk_otg_adp                          0            0       32768          0 0
>     sclk_tsadc                            1            1         993          0 0
>
> Note that xin32k on rk808 is a clock that cannot be disabled in
> hardware (it's an always on clock), so really all we needed to do was
> to sync up the state.
>
> Signed-off-by: Doug Anderson <dianders@chromium.org>
>
> Adapted to recent clk->clk_core changes and move orphan handling to
> a separate function as the main clk_core_reparent function is already
> also used in other contexts.
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---

Sorry I don't get this patch at all. We shouldn't be handing out clocks
to consumers if the clock is an orphan. We also have a problem syncing
enable state in the framework with what is there in hardware when we
boot up. These aren't the same problem but they're related. Let's not
conflate the two.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] clk: Propagate prepare and enable when reparenting orphans
Date: Fri, 10 Apr 2015 17:59:08 -0700	[thread overview]
Message-ID: <552871DC.2020400@codeaurora.org> (raw)
In-Reply-To: <1427988853-9549-2-git-send-email-heiko@sntech.de>

On 04/02/15 08:34, Heiko Stuebner wrote:
> From: Doug Anderson <dianders@chromium.org>
>
> With the existing code, if you find a parent for an orhpan that has
> already been prepared / enabled, you won't enable the parent.  That
> can cause later problems since the clock tree isn't in a consistent
> state.  Fix by propagating the prepare and enable.
>
> NOTE: this does bring up the question about whether the enable of the
> orphan actually made sense.  If the orphan's parent wasn't enabled by
> default (by the bootloader or the default state of the hardware) then
> the original enable of the orphan probably didn't do what the caller
> though it would.  Some users of the orphan might have preferred an
> EPROBE_DEFER be returned until we had a full path to a root clock.
> This patch doesn't address those concerns and really just syncs up the
> state.
>
> Tested on rk3288-evb-rk808 by temporarily considering "sclk_tsadc" as
> a critical clock (to simulate a driver enabling it at bootup).
>
> Before:
>
>    clock                         enable_cnt  prepare_cnt        rate   accuracy   phase
> ----------------------------------------------------------------------------------------
>  xin32k                                   0            0       32768          0 0
>     sclk_hdmi_cec                         0            0       32768          0 0
>     sclk_otg_adp                          0            0       32768          0 0
>     sclk_tsadc                            1            1         993          0 0
>
> After:
>
>    clock                         enable_cnt  prepare_cnt        rate   accuracy   phase
> ----------------------------------------------------------------------------------------
>  xin32k                                   1            1       32768          0 0
>     sclk_hdmi_cec                         0            0       32768          0 0
>     sclk_otg_adp                          0            0       32768          0 0
>     sclk_tsadc                            1            1         993          0 0
>
> Note that xin32k on rk808 is a clock that cannot be disabled in
> hardware (it's an always on clock), so really all we needed to do was
> to sync up the state.
>
> Signed-off-by: Doug Anderson <dianders@chromium.org>
>
> Adapted to recent clk->clk_core changes and move orphan handling to
> a separate function as the main clk_core_reparent function is already
> also used in other contexts.
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---

Sorry I don't get this patch at all. We shouldn't be handing out clocks
to consumers if the clock is an orphan. We also have a problem syncing
enable state in the framework with what is there in hardware when we
boot up. These aren't the same problem but they're related. Let's not
conflate the two.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2015-04-11  0:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 15:34 [PATCH 0/4] clk: improve handling of orphan clocks Heiko Stuebner
2015-04-02 15:34 ` Heiko Stuebner
2015-04-02 15:34 ` [PATCH 1/4] clk: Propagate prepare and enable when reparenting orphans Heiko Stuebner
2015-04-02 15:34   ` Heiko Stuebner
2015-04-11  0:59   ` Stephen Boyd [this message]
2015-04-11  0:59     ` Stephen Boyd
2015-04-02 15:34 ` [PATCH 2/4] clk: add clk_is_orphan() to check if a clocks inherits from an orphan clock Heiko Stuebner
2015-04-02 15:34   ` Heiko Stuebner
2015-04-11  0:49   ` Stephen Boyd
2015-04-11  0:49     ` Stephen Boyd
2015-04-02 15:34 ` [PATCH 3/4] clk: add CLK_DEFER_ORPHAN flag to prevent orphans from being used Heiko Stuebner
2015-04-02 15:34   ` Heiko Stuebner
2015-04-11  0:52   ` Stephen Boyd
2015-04-11  0:52     ` Stephen Boyd
2015-04-11  1:32     ` Heiko Stübner
2015-04-11  1:32       ` Heiko Stübner
2015-04-02 15:34 ` [PATCH 4/4] clk: rockchip: enable CLK_DEFER_ORPHAN for all branches Heiko Stuebner
2015-04-02 15:34   ` Heiko Stuebner

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=552871DC.2020400@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=dianders@chromium.org \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mturquette@linaro.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 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.