All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: James Liao <jamesjj.liao@mediatek.com>
Cc: Erin Lo <erin.lo@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Mike Turquette <mturquette@baylibre.com>,
	Rob Herring <robh@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Sascha Hauer <kernel@pengutronix.de>,
	Daniel Kurtz <djkurtz@chromium.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-clk@vger.kernel.org, srv_heupstream@mediatek.com,
	Shunli Wang <shunli.wang@mediatek.com>
Subject: Re: [PATCH v12 1/4] clk: mediatek: Add MT2701 clock support
Date: Mon, 29 Aug 2016 10:46:23 -0700	[thread overview]
Message-ID: <20160829174623.GB19826@codeaurora.org> (raw)
In-Reply-To: <1472271377.21203.12.camel@mtksdaap41>

On 08/27, James Liao wrote:
> On Wed, 2016-08-24 at 10:49 -0700, Stephen Boyd wrote:
> > On 08/22, Erin Lo wrote:
> > > +
> > > +static void __init mtk_infrasys_init_early(struct device_node *node)
> > > +{
> > > +	int r, i;
> > > +
> > > +	if (!infra_clk_data) {
> > > +		infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR);
> > > +
> > > +		for (i = 0; i < CLK_INFRA_NR; i++)
> > > +			infra_clk_data->clks[i] = ERR_PTR(-EPROBE_DEFER);
> > > +	}
> > > +
> > > +	mtk_clk_register_factors(infra_fixed_divs, ARRAY_SIZE(infra_fixed_divs),
> > > +						infra_clk_data);
> > > +
> > > +	r = of_clk_add_provider(node, of_clk_src_onecell_get, infra_clk_data);
> > > +	if (r)
> > > +		pr_err("%s(): could not register clock provider: %d\n",
> > > +			__func__, r);
> > > +}
> > > +CLK_OF_DECLARE(mtk_infra, "mediatek,mt2701-infracfg", mtk_infrasys_init_early);
> > 
> > This should use CLK_OF_DECLARE_DRIVER? Has this been tested on
> > latest clk-next? Some recent patches make it so that
> > CLK_OF_DECLARE() prevents platform devices from being created for
> > the associated DT nodes that match during of_clk_init().
> 
> Oops, you are right. Clocks in infra_clks are gone on clk-next, but they
> are good on v4.8-rc1.
> 
> I register clk13m in infra_fixed_divs through CLK_OF_DECLARE() so that
> it can be registered as early as possible because it will be referred by
> the timer driver. Is there a formal way to separate clock registrations
> on the same clock provider? Or should I move infra_clks registration
> into CLK_OF_DECLARE()?

The way to do this is use CLK_OF_DECLARE_DRIVER() and then do the
early clks in the CLK_OF callback and the rest of them in the
driver probe.

-- 
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 v12 1/4] clk: mediatek: Add MT2701 clock support
Date: Mon, 29 Aug 2016 10:46:23 -0700	[thread overview]
Message-ID: <20160829174623.GB19826@codeaurora.org> (raw)
In-Reply-To: <1472271377.21203.12.camel@mtksdaap41>

On 08/27, James Liao wrote:
> On Wed, 2016-08-24 at 10:49 -0700, Stephen Boyd wrote:
> > On 08/22, Erin Lo wrote:
> > > +
> > > +static void __init mtk_infrasys_init_early(struct device_node *node)
> > > +{
> > > +	int r, i;
> > > +
> > > +	if (!infra_clk_data) {
> > > +		infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR);
> > > +
> > > +		for (i = 0; i < CLK_INFRA_NR; i++)
> > > +			infra_clk_data->clks[i] = ERR_PTR(-EPROBE_DEFER);
> > > +	}
> > > +
> > > +	mtk_clk_register_factors(infra_fixed_divs, ARRAY_SIZE(infra_fixed_divs),
> > > +						infra_clk_data);
> > > +
> > > +	r = of_clk_add_provider(node, of_clk_src_onecell_get, infra_clk_data);
> > > +	if (r)
> > > +		pr_err("%s(): could not register clock provider: %d\n",
> > > +			__func__, r);
> > > +}
> > > +CLK_OF_DECLARE(mtk_infra, "mediatek,mt2701-infracfg", mtk_infrasys_init_early);
> > 
> > This should use CLK_OF_DECLARE_DRIVER? Has this been tested on
> > latest clk-next? Some recent patches make it so that
> > CLK_OF_DECLARE() prevents platform devices from being created for
> > the associated DT nodes that match during of_clk_init().
> 
> Oops, you are right. Clocks in infra_clks are gone on clk-next, but they
> are good on v4.8-rc1.
> 
> I register clk13m in infra_fixed_divs through CLK_OF_DECLARE() so that
> it can be registered as early as possible because it will be referred by
> the timer driver. Is there a formal way to separate clock registrations
> on the same clock provider? Or should I move infra_clks registration
> into CLK_OF_DECLARE()?

The way to do this is use CLK_OF_DECLARE_DRIVER() and then do the
early clks in the CLK_OF callback and the rest of them in the
driver probe.

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

  reply	other threads:[~2016-08-29 17:46 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-22  8:29 [PATCH v12 0/4] Add clock support for Mediatek MT2701 Erin Lo
2016-08-22  8:29 ` Erin Lo
2016-08-22  8:29 ` Erin Lo
2016-08-22  8:29 ` [PATCH v12 1/4] clk: mediatek: Add MT2701 clock support Erin Lo
2016-08-22  8:29   ` Erin Lo
2016-08-22  8:29   ` Erin Lo
2016-08-24 17:49   ` Stephen Boyd
2016-08-24 17:49     ` Stephen Boyd
2016-08-24 17:49     ` Stephen Boyd
2016-08-27  4:16     ` James Liao
2016-08-27  4:16       ` James Liao
2016-08-27  4:16       ` James Liao
2016-08-29 17:46       ` Stephen Boyd [this message]
2016-08-29 17:46         ` Stephen Boyd
2016-08-22  8:29 ` [PATCH v12 2/4] reset: mediatek: Add MT2701 reset driver Erin Lo
2016-08-22  8:29   ` Erin Lo
2016-08-22  8:29   ` Erin Lo
2016-08-24 17:50   ` Stephen Boyd
2016-08-24 17:50     ` Stephen Boyd
2016-08-27  4:21     ` James Liao
2016-08-27  4:21       ` James Liao
2016-08-27  4:21       ` James Liao
2016-08-22  8:29 ` [PATCH v12 3/4] arm: dts: mt2701: Add clock controller device nodes Erin Lo
2016-08-22  8:29   ` Erin Lo
2016-08-22  8:29   ` Erin Lo
2016-08-22  8:29 ` [PATCH v12 4/4] arm: dts: mt2701: Use real clock for UARTs Erin Lo
2016-08-22  8:29   ` Erin Lo
2016-08-22  8:29   ` Erin Lo

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=20160829174623.GB19826@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=djkurtz@chromium.org \
    --cc=erin.lo@mediatek.com \
    --cc=jamesjj.liao@mediatek.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=shunli.wang@mediatek.com \
    --cc=srv_heupstream@mediatek.com \
    /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.