linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	narmstrong@baylibre.com, robh+dt@kernel.org,
	mark.rutland@arm.com, linux-amlogic@lists.infradead.org,
	devicetree@vger.kernel.org, khilman@baylibre.com
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Subject: Re: [PATCH 4/5] clk: meson: meson8b: don't register the XTAL clock when provided via OF
Date: Mon, 23 Sep 2019 11:31:40 +0200	[thread overview]
Message-ID: <1jwodzs6ir.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <20190921151223.768842-5-martin.blumenstingl@googlemail.com>

On Sat 21 Sep 2019 at 17:12, Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote:

> The XTAL clock is an actual crystal on the PCB. Thus the meson8b clock
> driver should not register the XTAL clock - instead it should be
> provided via .dts and then passed to the clock controller.
>
> Skip the registration of the XTAL clock if a parent clock is provided
> via OF. Fall back to registering the XTAL clock if this is not the case
> to keep support for old .dtbs.
>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
>  drivers/clk/meson/meson8b.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c
> index b785b67baf2b..15ec14fde2a0 100644
> --- a/drivers/clk/meson/meson8b.c
> +++ b/drivers/clk/meson/meson8b.c
> @@ -3682,10 +3682,16 @@ static void __init meson8b_clkc_init_common(struct device_node *np,
>  		meson8b_clk_regmaps[i]->map = map;
>  
>  	/*
> -	 * register all clks
> -	 * CLKID_UNUSED = 0, so skip it and start with CLKID_XTAL = 1
> +	 * always skip CLKID_UNUSED and also skip XTAL if the .dtb provides the
> +	 * XTAL clock as input.
>  	 */
> -	for (i = CLKID_XTAL; i < CLK_NR_CLKS; i++) {
> +	if (of_clk_get_parent_count(np))

If we are going for this, I'd prefer if could explicity check for the
clock named "xtal" instead of just checking if DT has clocks.

> +		i = CLKID_PLL_FIXED;
> +	else
> +		i = CLKID_XTAL;
> +
> +	/* register all clks */
> +	for (; i < CLK_NR_CLKS; i++) {
>  		/* array might be sparse */
>  		if (!clk_hw_onecell_data->hws[i])
>  			continue;
> -- 
> 2.23.0

  reply	other threads:[~2019-09-23  9:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-21 15:12 [PATCH 0/5] provide the XTAL clock via OF on Meson8/8b/8m2 Martin Blumenstingl
2019-09-21 15:12 ` [PATCH 1/5] dt-bindings: clock: meson8b: add the clock inputs Martin Blumenstingl
2019-10-02 14:19   ` Rob Herring
2019-09-21 15:12 ` [PATCH 2/5] clk: meson: meson8b: use clk_hw_set_parent in the CPU clock notifier Martin Blumenstingl
2019-09-21 15:12 ` [PATCH 3/5] clk: meson: meson8b: change references to the XTAL clock to use the name Martin Blumenstingl
2019-09-21 15:12 ` [PATCH 4/5] clk: meson: meson8b: don't register the XTAL clock when provided via OF Martin Blumenstingl
2019-09-23  9:31   ` Jerome Brunet [this message]
2019-09-23 20:57     ` Martin Blumenstingl
2019-09-21 15:12 ` [PATCH 5/5] ARM: dts: meson: provide the XTAL clock using a fixed-clock Martin Blumenstingl
2019-09-23  9:29 ` [PATCH 0/5] provide the XTAL clock via OF on Meson8/8b/8m2 Jerome Brunet
2019-09-23 20:56   ` Martin Blumenstingl
2019-09-25 22:47     ` Kevin Hilman
2019-09-26 18:34       ` Martin Blumenstingl

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=1jwodzs6ir.fsf@starbuckisacylon.baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --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=mark.rutland@arm.com \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=narmstrong@baylibre.com \
    --cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).